@spec-wave/cli 1.7.0 → 1.7.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/package.json
CHANGED
package/src/commands/doctor.mjs
CHANGED
|
@@ -897,8 +897,15 @@ async function checkAi(ctx) {
|
|
|
897
897
|
|
|
898
898
|
// Se o token permitir, confere os secrets do Actions no repo.
|
|
899
899
|
if (ctx.token && cfg?.owner && cfg?.repo) {
|
|
900
|
-
|
|
901
|
-
|
|
900
|
+
// Fato do `scm.verify({deep: true})` — o plugin coleta, o core julga. Chamar
|
|
901
|
+
// a API aqui era a última chamada crua que o bloco G deixou para trás.
|
|
902
|
+
const segredos = fatoDaPorta(ctx.scmVerify, 'automationSecretNames');
|
|
903
|
+
if (segredos.estado !== 'ok') {
|
|
904
|
+
notes.push(segredos.estado === 'ilegivel'
|
|
905
|
+
? 'Secrets do Actions não verificáveis com este token (requer admin no repo).'
|
|
906
|
+
: 'Secrets do Actions não verificáveis agora: a porta de scm não respondeu.');
|
|
907
|
+
} else {
|
|
908
|
+
const secretNames = segredos.valor;
|
|
902
909
|
// Dois modos de autenticação nos workflows: GitHub App da org
|
|
903
910
|
// (SPEC_WAVE_APP_ID + SPEC_WAVE_APP_PRIVATE_KEY, App antes do PAT) ou os
|
|
904
911
|
// PATs. Com a App presente, o GH_PROJECT_TOKEN vira fallback opcional.
|
|
@@ -929,12 +936,6 @@ async function checkAi(ctx) {
|
|
|
929
936
|
'que os tokens funcionam nem que têm o escopo necessário).'
|
|
930
937
|
);
|
|
931
938
|
}
|
|
932
|
-
} catch (err) {
|
|
933
|
-
if (err.status === 403) {
|
|
934
|
-
notes.push('Secrets do Actions não verificáveis com este token (403 — requer admin no repo).');
|
|
935
|
-
} else {
|
|
936
|
-
notes.push(`Secrets do Actions não verificáveis agora: ${err.message}`);
|
|
937
|
-
}
|
|
938
939
|
}
|
|
939
940
|
}
|
|
940
941
|
return { name, status, detail: notes.join('\n') };
|
|
@@ -35,7 +35,7 @@ import { loadArtifact } from '../lib/doc-source.mjs';
|
|
|
35
35
|
import { buildBugContext } from '../lib/bug-context.mjs';
|
|
36
36
|
import { slugify } from '../lib/slugify.mjs';
|
|
37
37
|
import { parseDependencies, orderStories, formatDependencyLine } from '../lib/dependencies.mjs';
|
|
38
|
-
import { STREAM_DIR_ENV, runStreamed, streamFileFor, withStreamJson } from '../lib/implement-stream.mjs';
|
|
38
|
+
import { STREAM_DIR_ENV, runStreamed, specKitEnv, streamFileFor, withStreamJson } from '../lib/implement-stream.mjs';
|
|
39
39
|
import { loadProjectConfig } from '../lib/board.mjs';
|
|
40
40
|
import { planBoardMoves, applyBoardMoves } from '../lib/implement-board.mjs';
|
|
41
41
|
import { markFeaturePrsReady } from '../lib/pr-ready.mjs';
|
|
@@ -1398,7 +1398,7 @@ async function writeContextAndRunSpecKit({
|
|
|
1398
1398
|
}
|
|
1399
1399
|
} else {
|
|
1400
1400
|
try {
|
|
1401
|
-
(deps.exec ?? execSync)(command, { stdio: 'inherit' });
|
|
1401
|
+
(deps.exec ?? execSync)(command, { stdio: 'inherit', env: specKitEnv(process.env) });
|
|
1402
1402
|
} catch (err) {
|
|
1403
1403
|
p.log.error(`spec-kit implement falhou: ${err.message}`);
|
|
1404
1404
|
process.exitCode = 1;
|
package/src/commands/update.mjs
CHANGED
|
@@ -159,6 +159,25 @@ export function diffLabels(existing, fileAi, devAgent) {
|
|
|
159
159
|
return { missing, changed, orphan };
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
+
/**
|
|
163
|
+
* Diff de labels do repositório, por papel (RFC-005 §7.4). Num repo de CÓDIGO
|
|
164
|
+
* as labels são do hub — é lá que as issues vivem —, então o diff é vazio e o
|
|
165
|
+
* tracker nem é consultado. Sem este corte o `update` comparava o repo de
|
|
166
|
+
* código com as labels do fluxo: criava as 40+ num repo que nunca as teve e
|
|
167
|
+
* acusava as de modelo (`spec-wave:model:*`) como órfãs a remover, porque o
|
|
168
|
+
* config de um repo de código não tem bloco `ai`.
|
|
169
|
+
*
|
|
170
|
+
* @param {'hub'|'code'} role
|
|
171
|
+
* @param {() => Promise<Array<{name,color,description}>>} listTags
|
|
172
|
+
* @param {object} [fileAi]
|
|
173
|
+
* @param {object} [devAgent]
|
|
174
|
+
* @returns {Promise<{ missing: object[], changed: object[], orphan: object[] }>}
|
|
175
|
+
*/
|
|
176
|
+
export async function repoLabelDiff(role, listTags, fileAi, devAgent) {
|
|
177
|
+
if (role === 'code') return { missing: [], changed: [], orphan: [] };
|
|
178
|
+
return diffLabels(await listTags(), fileAi, devAgent);
|
|
179
|
+
}
|
|
180
|
+
|
|
162
181
|
/**
|
|
163
182
|
* Decide se uma label órfã pode ser deletada (função PURA — testável sem rede).
|
|
164
183
|
*
|
|
@@ -410,8 +429,12 @@ export async function update(options = {}) {
|
|
|
410
429
|
if (remote === null) repoFiles.push({ ...f, reason: 'ausente', local });
|
|
411
430
|
else if (remote !== local) repoFiles.push({ ...f, reason: 'desatualizado', local });
|
|
412
431
|
}
|
|
413
|
-
|
|
414
|
-
|
|
432
|
+
labelDiff = await repoLabelDiff(
|
|
433
|
+
role,
|
|
434
|
+
async () => (await requireTracker({ token: tk, owner, repo })).listTags(),
|
|
435
|
+
config?.ai,
|
|
436
|
+
config?.devAgent,
|
|
437
|
+
);
|
|
415
438
|
repoChecked = true;
|
|
416
439
|
s.stop('Repositório comparado.');
|
|
417
440
|
} catch (err) {
|
|
@@ -25,6 +25,30 @@ import { createInterface } from 'node:readline';
|
|
|
25
25
|
|
|
26
26
|
export const STREAM_DIR_ENV = 'SPEC_WAVE_STREAM_DIR';
|
|
27
27
|
|
|
28
|
+
// Token da assinatura para o agente interno (RFC-008). O Claude Code não
|
|
29
|
+
// repassa o próprio CLAUDE_CODE_OAUTH_TOKEN aos comandos do Bash dele, então,
|
|
30
|
+
// sob um executor Claude (Fleet Job em modo assinatura), o `claude -p` do
|
|
31
|
+
// spec-kit nascia sem credencial ("Not logged in"). Quem monta o ambiente (o
|
|
32
|
+
// fleet-runner) repete o token neste nome, e a CLI o devolve SÓ ao filho.
|
|
33
|
+
export const SUBSCRIPTION_TOKEN_ENV = 'SPEC_WAVE_CLAUDE_OAUTH_TOKEN';
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Ambiente do comando do spec-kit (função PURA). Com o token no nome da
|
|
37
|
+
* spec-wave e sem o do Claude Code, o filho recebe o do Claude Code; o nome da
|
|
38
|
+
* spec-wave não segue adiante — o agente interno não precisa dele, e cada
|
|
39
|
+
* nível a mais que o enxerga é exposição sem motivo.
|
|
40
|
+
*
|
|
41
|
+
* @param {Record<string, string|undefined>} env
|
|
42
|
+
* @returns {Record<string, string|undefined>}
|
|
43
|
+
*/
|
|
44
|
+
export function specKitEnv(env) {
|
|
45
|
+
const out = { ...env };
|
|
46
|
+
const alias = out[SUBSCRIPTION_TOKEN_ENV];
|
|
47
|
+
delete out[SUBSCRIPTION_TOKEN_ENV];
|
|
48
|
+
if (alias && !out.CLAUDE_CODE_OAUTH_TOKEN) out.CLAUDE_CODE_OAUTH_TOKEN = alias;
|
|
49
|
+
return out;
|
|
50
|
+
}
|
|
51
|
+
|
|
28
52
|
// Acrescenta o formato stream-json ao Claude Code quando o comando não escolhe
|
|
29
53
|
// formato. Só para `claude`: as flags não existem nos outros agentes.
|
|
30
54
|
// Comando composto (pipe, `;`, `&&`, redirecionamento) fica como está: as
|
|
@@ -62,10 +86,10 @@ export function streamFileFor(dir, issueNumber) {
|
|
|
62
86
|
// Roda o comando (via shell, como o execSync de sempre) gravando cada linha do
|
|
63
87
|
// stdout em `streamFile` e ecoando o resumo. stdin e stderr continuam herdados.
|
|
64
88
|
// Resolve com o exit code (1 quando morto por sinal).
|
|
65
|
-
export function runStreamed(command, { streamFile, cwd, write = (s) => process.stdout.write(s) }) {
|
|
89
|
+
export function runStreamed(command, { streamFile, cwd, env = process.env, write = (s) => process.stdout.write(s) }) {
|
|
66
90
|
mkdirSync(path.dirname(streamFile), { recursive: true });
|
|
67
91
|
return new Promise((resolve, reject) => {
|
|
68
|
-
const child = spawn(command, { shell: true, cwd, stdio: ['inherit', 'pipe', 'inherit'] });
|
|
92
|
+
const child = spawn(command, { shell: true, cwd, env: specKitEnv(env), stdio: ['inherit', 'pipe', 'inherit'] });
|
|
69
93
|
const lines = createInterface({ input: child.stdout });
|
|
70
94
|
lines.on('line', (line) => {
|
|
71
95
|
// Arquivo primeiro: é a fonte da tela ao vivo. Falha de disco não pode
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spec-wave",
|
|
3
3
|
"displayName": "Spec Wave",
|
|
4
|
-
"version": "1.7.
|
|
4
|
+
"version": "1.7.2",
|
|
5
5
|
"description": "Fluxo spec-driven no GitHub (RFC-001): Projects v2, labels de gatilho, spec/plan gerados por Action, decomposição em duas etapas e implementação orientada a Stories/Tasks.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Astratech",
|