@polymorphism-tech/morph-spec 10.11.1 → 10.12.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.
Files changed (77) hide show
  1. package/README.md +2 -2
  2. package/bin/morph-spec.js +2 -0
  3. package/claude-plugin.json +1 -1
  4. package/docs/CHEATSHEET.md +1 -1
  5. package/docs/QUICKSTART.md +1 -1
  6. package/framework/CLAUDE.md +4 -3
  7. package/framework/MORPH.md +14 -12
  8. package/framework/commands/morph-review.md +1 -1
  9. package/framework/commands/morph-status.md +2 -6
  10. package/framework/docs/CLI.md +21 -6
  11. package/framework/hooks/claude-code/core/enforce-phase-writes.js +12 -11
  12. package/framework/hooks/claude-code/core/gate-guard.js +19 -14
  13. package/framework/hooks/claude-code/core/heavy-gate.js +4 -1
  14. package/framework/hooks/claude-code/core/loop-detect.js +8 -7
  15. package/framework/hooks/claude-code/core/masked-exit.js +5 -2
  16. package/framework/hooks/claude-code/core/protect-spec-files.js +13 -11
  17. package/framework/hooks/claude-code/core/state-sync.js +20 -12
  18. package/framework/hooks/claude-code/core/validate-completion.js +6 -5
  19. package/framework/hooks/claude-code/core/worktree-context.js +47 -43
  20. package/framework/hooks/shared/gate-question.js +8 -0
  21. package/framework/hooks/shared/next-step.js +54 -23
  22. package/framework/hooks/shared/owner-words.js +146 -0
  23. package/framework/hooks/shared/report-progress.js +84 -10
  24. package/framework/phases.json +7 -7
  25. package/framework/rules/implement-report.md +8 -7
  26. package/framework/rules/plan-grammar.md +4 -1
  27. package/framework/schemas/feature.schema.json +3 -2
  28. package/framework/skills/core/create-umbraco-lp/SKILL.md +1 -1
  29. package/framework/skills/core/migrate-lp-to-umbraco/SKILL.md +1 -1
  30. package/framework/skills/core/morph-apply/SKILL.md +6 -5
  31. package/framework/skills/core/morph-apply/references/hotfix.md +6 -2
  32. package/framework/skills/core/morph-apply/references/review.md +9 -5
  33. package/framework/skills/core/morph-plan/SKILL.md +5 -5
  34. package/framework/skills/core/morph-plan/references/interview.md +1 -1
  35. package/framework/skills/core/morph-uiux/SKILL.md +10 -6
  36. package/framework/templates/docs/plan.md +1 -1
  37. package/package.json +1 -1
  38. package/src/commands/e2e/e2e.js +31 -29
  39. package/src/commands/project/status.js +28 -184
  40. package/src/commands/state/advance.js +44 -20
  41. package/src/commands/state/approve.js +70 -59
  42. package/src/commands/state/archive.js +20 -15
  43. package/src/commands/state/auto-approval.js +25 -23
  44. package/src/commands/state/create.js +35 -32
  45. package/src/commands/state/finish.js +179 -58
  46. package/src/commands/state/gate-check.js +43 -31
  47. package/src/commands/state/gate-decision.js +18 -14
  48. package/src/commands/state/list.js +23 -14
  49. package/src/commands/state/next.js +4 -5
  50. package/src/commands/state/report-check.js +47 -23
  51. package/src/commands/validation/plan-check.js +30 -14
  52. package/src/commands/validation/verify.js +39 -18
  53. package/src/dashboard/app/components/ActivityFeed.jsx +8 -8
  54. package/src/dashboard/app/components/CommandPalette.jsx +1 -1
  55. package/src/dashboard/app/components/GatePauses.jsx +8 -8
  56. package/src/dashboard/app/components/PhaseRail.jsx +6 -6
  57. package/src/dashboard/app/components/SessionMap.jsx +7 -7
  58. package/src/dashboard/app/lib/format.js +6 -2
  59. package/src/dashboard/app/lib/phases.js +48 -16
  60. package/src/dashboard/app/pages/FeatureDetail.jsx +87 -59
  61. package/src/dashboard/app/pages/Features.jsx +18 -18
  62. package/src/dashboard/app/pages/Guide.jsx +4 -4
  63. package/src/dashboard/app/pages/PhasePipeline.jsx +7 -7
  64. package/src/dashboard/app/pages/Portfolio.jsx +3 -3
  65. package/src/dashboard/scanner/activity-scanner.js +20 -6
  66. package/src/dashboard/scanner/features-scanner.js +43 -8
  67. package/src/dashboard/scanner/project-api.js +2 -0
  68. package/src/dashboard/vite.config.js +2 -0
  69. package/src/lib/next-step.js +3 -2
  70. package/src/lib/plan/checks.js +30 -15
  71. package/src/lib/plan/critique.js +6 -4
  72. package/src/lib/recap/recap.js +46 -20
  73. package/src/lib/risk-detector.js +260 -98
  74. package/src/lib/view/feature-html.js +19 -25
  75. package/src/lib/view/feature-view.js +6 -6
  76. package/src/utils/audience.js +27 -0
  77. package/src/utils/refusal-line.js +2 -2
@@ -28,21 +28,28 @@ import { isTestArtifact } from '../../lib/worktree/ignored-triage.js';
28
28
  import { waitForPrChecks } from '../../lib/ci/pr-checks.js';
29
29
  import { atomicWriteJson } from '../../core/state/state-manager.js';
30
30
  import { recordGateEvent } from '../../../framework/hooks/shared/gate-event.js';
31
+ import { parsePlan } from '../../lib/plan/plan-parser.js';
32
+ import { reviewReportsFromDir } from '../../lib/review-reports.js';
33
+ import { implementProgressFrom } from '../../../framework/hooks/shared/report-progress.js';
34
+ import {
35
+ CHECK_RESULT_SAY, GATE_NAME, PROOF_SAY, STATUS_SAY, TESTS, WORK_NAME, featureName, featureRef, scenarioLabel,
36
+ } from '../../../framework/hooks/shared/owner-words.js';
31
37
 
32
38
  const PR_TYPE_BY_WORK_TYPE = { feature: 'feat', bug: 'fix', hotfix: 'fix', chore: 'chore' };
33
39
 
34
40
  /** Git's soft limit for a subject line. */
35
41
  const PR_TITLE_MAX = 72;
36
42
 
37
- // `{type}({slug}): {subject}`, the subject from `name` (unless it is the default slug), then
38
- // `description`, first line only; with neither, `{type}: {slug}`.
39
- export function buildPrTitle(feature, fj) {
43
+ // `{type}({slug}): {subject}`, the subject from the plan's `Nome`, then `name` (unless it is the
44
+ // default slug), then `description`, first line only; with none, `{type}: {slug}`.
45
+ export function buildPrTitle(feature, fj, summary = null) {
40
46
  const type = PR_TYPE_BY_WORK_TYPE[fj?.workType] || 'chore';
41
47
 
48
+ const planned = typeof summary?.name === 'string' ? summary.name.trim() : '';
42
49
  const named = typeof fj?.name === 'string' ? fj.name.trim() : '';
43
50
  // The default `name` IS the slug, which as a subject would only repeat the scope.
44
51
  const described = typeof fj?.description === 'string' ? fj.description.trim() : '';
45
- const raw = (named && named !== feature ? named : described).split('\n')[0].trim();
52
+ const raw = (planned || (named && named !== feature ? named : described)).split('\n')[0].trim();
46
53
  if (!raw) return `${type}: ${feature}`;
47
54
 
48
55
  const prefix = `${type}(${feature}): `;
@@ -55,13 +62,95 @@ export function buildPrTitle(feature, fj) {
55
62
  const ISSUE_URL_RE = /https?:\/\/github\.com\/([\w.-]+\/[\w.-]+)\/issues\/(\d+)/;
56
63
  const ISSUE_KEYWORD_RE = /\b(close[sd]?|fix(e[sd])?|resolve[sd]?|refs?)\s+([\w.-]+\/[\w.-]+)?#\d+/i;
57
64
 
65
+ const ISSUE_KEYWORD_ALL_RE = new RegExp(ISSUE_KEYWORD_RE.source, 'gi');
66
+
67
+ const readText = (path) => { try { return readFileSync(path, 'utf8'); } catch { return null; } };
68
+ const readJsonFile = (path) => { try { return JSON.parse(readFileSync(path, 'utf8')); } catch { return null; } };
69
+ const flat = (s) => String(s ?? '').replace(/\s+/g, ' ').trim();
70
+
71
+ /** What a PR body is built from; every file is optional (a resumed finish reads the pruned archive). */
72
+ export function prSourcesFor(dir) {
73
+ if (!dir) return null;
74
+ const planText = readText(join(dir, '2-plan', 'plan.md'));
75
+ const plan = planText ? parsePlan(planText) : null;
76
+ const checksText = readText(join(dir, '2-plan', 'checks.json'));
77
+ const checksSummary = readJsonFile(join(dir, '2-plan', 'checks.json'))?.summary ?? null;
78
+ const progress = implementProgressFrom(checksText, readText(join(dir, '3-implement', 'report.md')));
79
+ const verifier = existsSync(join(dir, '4-review')) ? reviewReportsFromDir(dir).verifier : null;
80
+ const recap = readJsonFile(join(dir, 'recap.json'));
81
+ const summary = {
82
+ name: plan?.summary?.name ?? checksSummary?.name ?? recap?.summary?.name ?? null,
83
+ today: plan?.summary?.today ?? recap?.summary?.today ?? null,
84
+ after: plan?.summary?.after ?? checksSummary?.after ?? recap?.summary?.after ?? null,
85
+ watch: plan?.summary?.watch ?? recap?.summary?.watch ?? [],
86
+ };
87
+ return { plan, summary, progress, verifierChecks: verifier?.checks ?? null, recap };
88
+ }
89
+
90
+ const PROOF_GLYPH = { PROVADO: '✓', FALHA: '✕', 'NÃO PROVADO': '!' };
91
+
92
+ function proofLines(src) {
93
+ const planned = src.plan?.scenarios?.length ? src.plan.scenarios : (src.recap?.scenarios ?? []);
94
+ if (!planned.length) return null;
95
+ const progress = new Map((src.progress?.checks ?? []).map((c) => [c.id, c]));
96
+ const verified = src.verifierChecks
97
+ ? new Map(src.verifierChecks.map((c) => [c.id, c]))
98
+ : new Map((src.recap?.scenarios ?? []).filter((c) => c.status).map((c) => [c.id, c]));
99
+ const rows = planned.map((c) => {
100
+ const titled = { ...c, title: c.title ?? progress.get(c.id)?.title ?? null };
101
+ const label = scenarioLabel(titled);
102
+ const how = c.proof ? PROOF_SAY[String(c.proof).toLowerCase()] ?? c.proof : null;
103
+ const v = verified.get(c.id);
104
+ if (v) {
105
+ const said = CHECK_RESULT_SAY[v.status] ?? 'sem resultado da conferência';
106
+ return { ok: v.status === 'PROVADO', line: `- ${PROOF_GLYPH[v.status] ?? '·'} ${label} — ${said} pela revisão independente${how ? `, por ${how}` : ''}.`, id: c.id, evidence: flat(v.evidence) };
107
+ }
108
+ const status = progress.get(c.id)?.status ?? null;
109
+ const said = status ? `${STATUS_SAY[status] ?? status}, sem conferência independente` : 'sem registro de construção';
110
+ return { ok: false, built: status === 'feito', line: `- ${status === 'feito' ? '✓' : '·'} ${label} — ${said}${how ? ` (prova prevista: ${how})` : ''}.`, id: c.id, evidence: flat(progress.get(c.id)?.evidence) };
111
+ });
112
+ const total = rows.length;
113
+ const head = verified.size
114
+ ? `${rows.filter((r) => r.ok).length} de ${total} ${total === 1 ? 'cenário conferido' : 'cenários conferidos'} pela revisão independente.`
115
+ : `${rows.filter((r) => r.built).length} de ${total} ${total === 1 ? 'cenário feito' : 'cenários feitos'}; a conferência independente não deixou registro.`;
116
+ return { head, rows };
117
+ }
118
+
58
119
  // The description's own keyword wins (`Refs #N` keeps the issue open); a bare issue link closes it.
59
- export function prBodyFor(feature, fj) {
120
+ // Without a plan to read, the body is the description.
121
+ export function prBodyFor(feature, fj, { dir = null, sources = undefined } = {}) {
60
122
  const described = typeof fj?.description === 'string' ? fj.description.trim() : '';
61
- const body = described || `Feature ${feature} — integrada via morph-spec finish --pr.`;
62
123
  const issue = described.match(ISSUE_URL_RE);
63
- if (!issue || ISSUE_KEYWORD_RE.test(described)) return body;
64
- return `${body}\n\nCloses ${issue[1]}#${issue[2]}`;
124
+ const keywords = described.match(ISSUE_KEYWORD_ALL_RE) ?? [];
125
+ const closing = keywords.length ? keywords.join('\n') : issue ? `Closes ${issue[1]}#${issue[2]}` : null;
126
+ const src = sources === undefined ? prSourcesFor(dir) : sources;
127
+ const proof = src ? proofLines(src) : null;
128
+ const s = src?.summary ?? {};
129
+ if (!proof && !s.today && !s.after) {
130
+ const body = described || `${feature}: entrega aberta pelo morph-spec.`;
131
+ if (!issue || keywords.length) return body;
132
+ return `${body}\n\nCloses ${issue[1]}#${issue[2]}`;
133
+ }
134
+
135
+ const out = ['## O que muda para quem usa', ''];
136
+ if (s.today) out.push(`- Hoje: ${flat(s.today)}`);
137
+ if (s.after) out.push(`- Depois: ${flat(s.after)}`);
138
+ if (!s.today && !s.after) out.push(`- ${featureName(feature, fj, s)}`);
139
+ if (s.watch?.length) out.push('', 'Atenção:', ...s.watch.map((w) => `- ${flat(w)}`));
140
+
141
+ out.push('', '## Prova', '');
142
+ if (proof) out.push(proof.head, '', ...proof.rows.map((r) => r.line));
143
+ else out.push('O plano não lista cenários para conferir.');
144
+
145
+ out.push('', '## Detalhe técnico', '', `- Feature: \`${feature}\``, `- Branch: \`${buildBranchName(feature)}\``);
146
+ if (fj?.workType) out.push(`- Tipo: ${WORK_NAME[fj.workType] ?? fj.workType}`);
147
+ const adrs = src?.plan?.adrs ?? [];
148
+ if (adrs.length) out.push('- Decisões:', ...adrs.map((a) => ` - ${a.id}: ${flat(a.title)}`));
149
+ const evidence = (proof?.rows ?? []).filter((r) => r.evidence);
150
+ if (evidence.length) out.push('- Evidência por cenário:', ...evidence.map((r) => ` - Cenário ${r.id.replace(/^C/i, '')}: ${r.evidence}`));
151
+ if (described) out.push('', '<details><summary>Pedido original</summary>', '', described, '', '</details>');
152
+ if (closing) out.push('', closing);
153
+ return out.join('\n');
65
154
  }
66
155
 
67
156
  // Regenerated from the tree: on a merge, the default's copy is as good as ours.
@@ -96,6 +185,25 @@ function joinDefault(tree, defaultBranch) {
96
185
  }
97
186
  }
98
187
 
188
+ // A human line, then the command the session runs on its own line.
189
+ const say = (human, session = null) => (session ? `${human}\npara a sessão: ${session}` : human);
190
+
191
+ // `Nome (slug)` from whichever tree holds the feature; the bare slug when nothing names it.
192
+ function labelOf(trees, feature) {
193
+ for (const tree of trees.filter(Boolean)) {
194
+ for (const bucket of ['features', 'archive']) {
195
+ const dir = join(tree, '.morph', bucket, feature);
196
+ if (!existsSync(dir)) continue;
197
+ try {
198
+ return featureRef(feature, readFeatureJson(tree, feature, bucket), prSourcesFor(dir)?.summary);
199
+ } catch {
200
+ return feature;
201
+ }
202
+ }
203
+ }
204
+ return feature;
205
+ }
206
+
99
207
  const MEMORY_NOTE = 'o fechamento desta feature já está registrado no repositório (commit de archive, `plan.md` com as decisões, índice de ADRs, `git log`) — memória de sessão só para o que NENHUM deles guarda: decisão do usuário, pendência a observar em produção, custo medido.';
100
208
 
101
209
  // Every refusal is fail-CLOSED and happens BEFORE the archive, the first mutation. Resumable: a
@@ -139,7 +247,7 @@ export async function finishCommand(feature, options = {}) {
139
247
  const wantPr = !!options.pr;
140
248
  const wantMerge = !!options.merge;
141
249
  if (wantPr === wantMerge) {
142
- emit({ finished: false, error: 'mode-required', hint: 'informe exatamente um de --pr ou --merge', feature });
250
+ emit({ finished: false, error: 'mode-required', hint: say(`Não sei como entregar ${labelOf([root], feature)}: falta escolher entre abrir um PR ou juntar direto na branch principal. Nada foi mexido.`, `\`morph-spec finish ${feature} --pr\` ou \`morph-spec finish ${feature} --merge\``), feature });
143
251
  process.exit(1);
144
252
  }
145
253
  const mode = wantPr ? 'pr' : 'merge';
@@ -150,7 +258,10 @@ export async function finishCommand(feature, options = {}) {
150
258
  emit({
151
259
  finished: false,
152
260
  error: 'push-with-pr',
153
- hint: `--push não se combina com --pr: o --pr já publica ${buildBranchName(feature)} e abre o PR, enquanto o --push publica a branch default depois de um merge LOCAL — e no fluxo --pr não há merge local. Para publicar a branch e abrir o PR: \`morph-spec finish ${feature} --pr\`. Para integrar na default localmente e publicá-la: \`morph-spec finish ${feature} --merge --push\`.`,
261
+ hint: say(
262
+ `Pedido contraditório para ${labelOf([root], feature)}: o PR já publica a branch da entrega, e o envio extra só vale depois de juntar direto na branch principal. Nada foi mexido.`,
263
+ `para abrir o PR, \`morph-spec finish ${feature} --pr\`; para juntar neste computador e publicar a principal, \`morph-spec finish ${feature} --merge --push\``,
264
+ ),
154
265
  feature,
155
266
  });
156
267
  process.exit(1);
@@ -162,6 +273,7 @@ export async function finishCommand(feature, options = {}) {
162
273
  // out there: a match at the root is the common flow.
163
274
  const found = findWorktreeForFeature(feature, root);
164
275
  const isWorktreeFlow = !!found && found.path.replace(/\\/g, '/') !== rootNorm;
276
+ const who = () => labelOf([found?.path, root], feature);
165
277
 
166
278
  let worktreePath = null;
167
279
  let featureCwd = root; // where the feature's own tree (and its review) lives
@@ -192,7 +304,7 @@ export async function finishCommand(feature, options = {}) {
192
304
  expectedBranch,
193
305
  actualBranch: found.branch,
194
306
  path: found.path,
195
- hint: `o worktree em ${found.path} está em ${found.branch || 'HEAD destacado'}, não em ${expectedBranch}`,
307
+ hint: say(`A pasta de trabalho de ${who()} está em outra branch (${found.branch || 'nenhuma'}), não em ${expectedBranch}. Nada foi mexido.`, `volte ${found.path} para ${expectedBranch} e rode o finish de novo`),
196
308
  });
197
309
  process.exit(1);
198
310
  }
@@ -208,7 +320,7 @@ export async function finishCommand(feature, options = {}) {
208
320
  feature,
209
321
  path: worktreePath,
210
322
  root,
211
- hint: `saia do worktree antes do finish — a remoção não consegue apagar o diretório de trabalho do próprio processo. Rode de novo a partir de "${root}"`,
323
+ hint: say(`O finish de ${who()} foi chamado de dentro da pasta de trabalho da entrega, que ele precisa apagar no fim. Nada foi mexido.`, `saia do worktree e rode o finish de novo a partir de "${root}"`),
212
324
  });
213
325
  process.exit(1);
214
326
  }
@@ -220,7 +332,7 @@ export async function finishCommand(feature, options = {}) {
220
332
  feature,
221
333
  path: worktreePath,
222
334
  root,
223
- hint: `outro processo tem "${worktreePath}" como pasta de trabalho (um terminal, o editor, um servidor de dev): feche-o ou saia da pasta e rode o finish de novo. Nada foi mexido.`,
335
+ hint: say(`Outro programa está usando a pasta de trabalho de ${who()} (um terminal, o editor ou um servidor de dev). Nada foi mexido.`, `feche o que usa "${worktreePath}" e rode o finish de novo`),
224
336
  });
225
337
  process.exit(1);
226
338
  }
@@ -236,7 +348,7 @@ export async function finishCommand(feature, options = {}) {
236
348
  finished: false,
237
349
  error: 'no-feature-branch',
238
350
  feature,
239
- hint: `feature sem branch ${expectedBranch} (criada antes deste fluxo) — feche com \`morph-spec archive ${feature}\` (arquivar sem integrar), ou continue o trabalho numa branch`,
351
+ hint: say(`${who()} foi criada antes deste fluxo e não tem branch própria (${expectedBranch}), então não há o que juntar. Nada foi mexido.`, `arquive sem juntar com \`morph-spec archive ${feature}\`, ou continue o trabalho numa branch`),
240
352
  });
241
353
  process.exit(1);
242
354
  }
@@ -248,7 +360,7 @@ export async function finishCommand(feature, options = {}) {
248
360
  feature,
249
361
  currentBranch: current,
250
362
  expectedBranch,
251
- hint: `faça checkout de ${expectedBranch} antes do finish (\`git checkout ${expectedBranch}\`)`,
363
+ hint: say(`O repositório está em ${current || 'nenhuma branch'}, não na branch de ${who()}. Nada foi mexido.`, `\`git checkout ${expectedBranch}\` e rode o finish de novo`),
252
364
  });
253
365
  process.exit(1);
254
366
  }
@@ -268,7 +380,7 @@ export async function finishCommand(feature, options = {}) {
268
380
  // already contained in the default COMPLETED: re-merging it is the hazard this check stops.
269
381
  const target = detectDefaultBranch(root);
270
382
  if (!target) {
271
- emit({ finished: false, error: 'no-default-branch', hint: 'não foi possível resolver a branch default (origin/HEAD, main ou master)', feature });
383
+ emit({ finished: false, error: 'no-default-branch', hint: say(`Não achei a branch principal do projeto (origin/HEAD, main ou master). Nada foi mexido.`, 'configure a branch principal do remoto e rode o finish de novo'), feature });
272
384
  process.exit(1);
273
385
  }
274
386
  const merged = branchMergedInto(expectedBranch, target, root);
@@ -281,7 +393,7 @@ export async function finishCommand(feature, options = {}) {
281
393
  branch: expectedBranch,
282
394
  base: target,
283
395
  archived: archivePath.replace(/\\/g, '/'),
284
- hint: `'${feature}' está arquivada, mas não foi possível comparar ${expectedBranch} com ${target} (ref ausente?) — sem saber se o merge já aconteceu, retomar arriscaria mergear duas vezes. Verifique o estado do git antes de integrar à mão`,
396
+ hint: say(`${who()} já foi arquivada, mas não consegui saber se a entrega já entrou em ${target}. Parei para não juntar duas vezes.`, `confira se ${expectedBranch} e ${target} existem no git antes de integrar à mão`),
285
397
  });
286
398
  process.exit(1);
287
399
  }
@@ -293,7 +405,7 @@ export async function finishCommand(feature, options = {}) {
293
405
  branch: expectedBranch,
294
406
  base: target,
295
407
  archived: archivePath.replace(/\\/g, '/'),
296
- hint: `'${feature}' já foi arquivada E ${expectedBranch} já está contida em ${target} — o finish anterior concluiu. Nada a integrar.`,
408
+ hint: say(`${who()} já foi entregue: está arquivada e já entrou em ${target}. Nada a fazer.`),
297
409
  });
298
410
  process.exit(1);
299
411
  }
@@ -309,7 +421,7 @@ export async function finishCommand(feature, options = {}) {
309
421
  feature,
310
422
  branch: expectedBranch,
311
423
  archived: archivePath.replace(/\\/g, '/'),
312
- hint: `'${feature}' está arquivada e ${expectedBranch} não foi mergeada, mas não foi possível consultar PRs abertos com \`gh\` — retomar às cegas abriria um PR duplicado. Verifique com \`gh pr list --head ${expectedBranch}\``,
424
+ hint: say(`${who()} já foi arquivada, mas não consegui consultar o GitHub para saber se o PR já existe. Parei para não abrir um PR repetido.`, `\`gh pr list --head ${expectedBranch}\``),
313
425
  });
314
426
  process.exit(1);
315
427
  }
@@ -323,7 +435,7 @@ export async function finishCommand(feature, options = {}) {
323
435
  base: target,
324
436
  archived: archivePath.replace(/\\/g, '/'),
325
437
  ...(typeof openPr === 'string' ? { pr: { number: prNumberFromUrl(openPr), url: openPr } } : {}),
326
- hint: `'${feature}' já foi arquivada e ${expectedBranch} já tem PR aberto — o finish anterior concluiu. Falta apenas mergear o PR.`,
438
+ hint: say(`${who()} já está com o PR aberto. Próximo: aprovar e juntar o PR no GitHub.`),
327
439
  });
328
440
  process.exit(1);
329
441
  }
@@ -335,8 +447,9 @@ export async function finishCommand(feature, options = {}) {
335
447
  // Not re-checked on a resume: the archive IS the gate's receipt (runArchive refuses without
336
448
  // the review gate), and an archive with no readable feature.json would only fail here wrongly.
337
449
  const fj = readFeatureJson(featureCwd, feature, resumed ? 'archive' : 'features');
450
+ const sources = prSourcesFor(join(featureCwd, '.morph', resumed ? 'archive' : 'features', feature));
338
451
  if (!resumed && !options.force && !(fj?.approvalGates?.review?.approved === true || fj?.approvals?.review?.approved === true)) {
339
- emit({ finished: false, error: 'review-not-approved', feature });
452
+ emit({ finished: false, error: 'review-not-approved', feature, hint: say(`A ${GATE_NAME.review.toLowerCase()} ainda não aprovou ${who()}. Nada foi mexido.`, `\`morph-spec gate-check ${feature} review\`; o finish só roda depois da aprovação`) });
340
453
  process.exit(1);
341
454
  }
342
455
  const pendingPr = fj?.verification?.pendingPr ?? null;
@@ -345,12 +458,15 @@ export async function finishCommand(feature, options = {}) {
345
458
  finished: false,
346
459
  error: 'pr-proof-pending',
347
460
  feature,
348
- hint: `${pendingPr.covers.join(', ')} só seriam provadas pelo CI da PR, e --merge não abre PR. Rode \`morph-spec verify ${feature}\` (sem --ci), \`gate-check ${feature} review\` e o finish de novo`,
461
+ hint: say(
462
+ `Parte da prova de ${who()} (os testes de ${pendingPr.covers.join(', ')}) só sai nos testes do PR no GitHub, e juntar direto não abre PR. Nada foi mexido.`,
463
+ `\`morph-spec verify ${feature}\` (sem --ci), \`gate-check ${feature} review\` e o finish de novo`,
464
+ ),
349
465
  });
350
466
  process.exit(1);
351
467
  }
352
- const prTitle = buildPrTitle(feature, fj);
353
- const prBody = prBodyFor(feature, fj);
468
+ const prTitle = buildPrTitle(feature, fj, sources?.summary);
469
+ const prBody = prBodyFor(feature, fj, { sources });
354
470
 
355
471
  // Clean, so the scoped archive commit contains only the move.
356
472
  const cleanCwd = isWorktreeFlow ? worktreePath : root;
@@ -363,18 +479,18 @@ export async function finishCommand(feature, options = {}) {
363
479
  const testArtifacts = untrackedTestArtifacts(dirtLines);
364
480
  const commitState = dirtLines.length > testArtifacts.length && onlyFeatureStateDirty(cleanCwd, feature);
365
481
  if (dirtLines.length > testArtifacts.length && !commitState) {
366
- emit({ finished: false, error: isWorktreeFlow ? 'worktree-dirty' : 'working-dir-dirty', hint: 'commit seu trabalho na branch antes do finish', feature });
482
+ emit({ finished: false, error: isWorktreeFlow ? 'worktree-dirty' : 'working-dir-dirty', hint: say(`Há mudanças de ${who()} ainda não salvas no git. Nada foi mexido.`, 'commite o trabalho na branch e rode o finish de novo'), feature });
367
483
  process.exit(1);
368
484
  }
369
485
 
370
486
  // Never assume "master".
371
487
  const defaultBranch = detectDefaultBranch(root);
372
488
  if (!defaultBranch) {
373
- emit({ finished: false, error: 'no-default-branch', hint: 'não foi possível resolver a branch default (origin/HEAD, main ou master)', feature });
489
+ emit({ finished: false, error: 'no-default-branch', hint: say(`Não achei a branch principal do projeto (origin/HEAD, main ou master). Nada foi mexido.`, 'configure a branch principal do remoto e rode o finish de novo'), feature });
374
490
  process.exit(1);
375
491
  }
376
492
  if (defaultBranch === expectedBranch) {
377
- emit({ finished: false, error: 'feature-is-default', hint: `a branch da feature (${expectedBranch}) é a própria default — nada a integrar`, feature });
493
+ emit({ finished: false, error: 'feature-is-default', hint: say(`A branch de ${who()} (${expectedBranch}) é a própria branch principal: não há o que juntar.`), feature });
378
494
  process.exit(1);
379
495
  }
380
496
 
@@ -390,7 +506,7 @@ export async function finishCommand(feature, options = {}) {
390
506
  emit({
391
507
  finished: false,
392
508
  error: 'primary-root-dirty',
393
- hint: 'a raiz primária tem trabalho não commitado — o merge acontece nela; commite ou faça stash antes do finish',
509
+ hint: say('A pasta principal do projeto tem mudanças não salvas no git, e é nela que a entrega seria juntada. Nada foi mexido.', 'commite ou faça stash na raiz e rode o finish de novo'),
394
510
  feature,
395
511
  });
396
512
  process.exit(1);
@@ -400,11 +516,11 @@ export async function finishCommand(feature, options = {}) {
400
516
  // BEFORE the archive, so a refused --pr has no side effect.
401
517
  if (mode === 'pr') {
402
518
  if (!hasOriginRemote(root)) {
403
- emit({ finished: false, error: 'no-origin-remote', hint: 'não há remoto `origin` para abrir PR — configure um ou use --merge', feature });
519
+ emit({ finished: false, error: 'no-origin-remote', hint: say('O projeto não tem um remoto `origin` no GitHub, então não há onde abrir o PR. Nada foi mexido.', `configure o remoto, ou junte direto com \`morph-spec finish ${feature} --merge\``), feature });
404
520
  process.exit(1);
405
521
  }
406
522
  if (!ghAuthOk()) {
407
- emit({ finished: false, error: 'gh-unavailable', hint: '`gh` não está instalado/autenticado — rode `gh auth login` ou use --merge', feature });
523
+ emit({ finished: false, error: 'gh-unavailable', hint: say('O programa do GitHub (`gh`) não está instalado ou não está logado, então não consigo abrir o PR. Nada foi mexido.', `\`gh auth login\`, ou junte direto com \`morph-spec finish ${feature} --merge\``), feature });
408
524
  process.exit(1);
409
525
  }
410
526
  }
@@ -412,7 +528,7 @@ export async function finishCommand(feature, options = {}) {
412
528
  // Every refusal is behind us: the leftover of a killed `graph refresh` goes now, never before.
413
529
  dropLeftoverIgnore(cleanCwd);
414
530
  if (commitState && !commitFeatureState(cleanCwd, feature)) {
415
- emit({ finished: false, error: 'state-commit-failed', hint: `não foi possível commitar .morph/features/${feature} (identidade git ausente?) — commite o estado na branch e rode o finish de novo`, feature });
531
+ emit({ finished: false, error: 'state-commit-failed', hint: say(`Não consegui salvar no git o estado de ${who()} (falta nome e e-mail no git?). Nada foi entregue.`, `commite .morph/features/${feature} na branch e rode o finish de novo`), feature });
416
532
  process.exit(1);
417
533
  }
418
534
  if (isWorktreeFlow) {
@@ -428,21 +544,21 @@ export async function finishCommand(feature, options = {}) {
428
544
  ...(joined.conflicts?.length ? { conflicts: joined.conflicts } : {}),
429
545
  ...(joined.output ? { output: joined.output } : {}),
430
546
  hint: joined.error === 'default-conflict'
431
- ? `origin/${defaultBranch} conflita com ${expectedBranch} em ${joined.conflicts.join(', ') || '(ver output)'}; o merge foi desfeito e nada foi arquivado nem enviado. Rode \`git merge origin/${defaultBranch}\` em ${cleanCwd}, resolva, commite e rode o finish de novo`
432
- : `não consegui buscar origin/${defaultBranch}; nada foi arquivado nem enviado. Confira a rede e o remoto e rode de novo`,
547
+ ? say(`A branch principal mudou nos mesmos arquivos que ${who()} (${joined.conflicts.join(', ') || 'ver output'}). Desfiz a tentativa; nada foi arquivado nem enviado.`, `\`git merge origin/${defaultBranch}\` em ${cleanCwd}, resolva, commite e rode o finish de novo`)
548
+ : say(`Não consegui baixar a branch principal (origin/${defaultBranch}) do GitHub. Nada foi arquivado nem enviado.`, 'confira a rede e o remoto e rode o finish de novo'),
433
549
  });
434
550
  process.exit(1);
435
551
  }
436
552
  }
437
553
  const arch = runArchive(feature, { cwd: featureCwd, force: options.force, git: true });
438
554
  if (!arch.ok) {
439
- emit({ finished: false, error: `archive-${arch.error}`, feature });
555
+ emit({ finished: false, error: `archive-${arch.error}`, feature, hint: say(`Não consegui arquivar ${who()} (${arch.error}). Nada foi entregue.`, `\`morph-spec archive ${feature}\` mostra o motivo`) });
440
556
  process.exit(1);
441
557
  }
442
558
  // A move that could not be committed (e.g. missing git identity) would leave
443
559
  // the tree dirty and break the checkout/merge below — refuse, recoverable.
444
560
  if (arch.archived && !arch.committed) {
445
- emit({ finished: false, error: 'archive-not-committed', hint: 'o move de archive não pôde ser commitado (identidade git ausente?)', feature });
561
+ emit({ finished: false, error: 'archive-not-committed', hint: say(`Arquivei ${who()}, mas não consegui salvar isso no git (falta nome e e-mail no git?). Nada foi entregue.`, 'configure a identidade do git, commite o archive e rode o finish de novo'), feature });
446
562
  process.exit(1);
447
563
  }
448
564
 
@@ -599,6 +715,8 @@ export function finishPreflight({ feature, root, worktreePath, cwd, mode, branch
599
715
  }
600
716
 
601
717
  async function integrateMerge({ emit, root, feature, expectedBranch, defaultBranch, isWorktreeFlow, worktreePath, options, arch, backupStamp }) {
718
+ const name = labelOf([worktreePath, root], feature);
719
+ const who = () => name;
602
720
  const mergeMsg = `chore(morph): merge ${expectedBranch}`;
603
721
  const adrNote = adrIndexNote(arch);
604
722
 
@@ -623,7 +741,7 @@ async function integrateMerge({ emit, root, feature, expectedBranch, defaultBran
623
741
  execFileSync('git', ['merge', '--no-ff', expectedBranch, '-m', mergeMsg], { cwd: root, stdio: 'pipe' });
624
742
  } catch (err) {
625
743
  tryGit(['merge', '--abort'], root);
626
- emit({ finished: false, error: 'merge-conflict', output: gitErr(err), hint: 'resolva manualmente ou re-execute sequencialmente', feature, ...backupNote });
744
+ emit({ finished: false, error: 'merge-conflict', output: gitErr(err), hint: say(`Juntar ${who()} na branch principal deu conflito. Desfiz a tentativa; a entrega continua na branch dela.`, 'resolva o conflito à mão ou rode os finish um de cada vez'), feature, ...backupNote });
627
745
  process.exit(1);
628
746
  }
629
747
 
@@ -656,7 +774,7 @@ async function integrateMerge({ emit, root, feature, expectedBranch, defaultBran
656
774
  try {
657
775
  execFileSync('git', ['checkout', defaultBranch], { cwd: root, stdio: 'pipe' });
658
776
  } catch (err) {
659
- emit({ finished: false, error: 'checkout-default-failed', output: gitErr(err), hint: `não foi possível trocar para ${defaultBranch}`, feature });
777
+ emit({ finished: false, error: 'checkout-default-failed', output: gitErr(err), hint: say(`Não consegui trocar para a branch principal (${defaultBranch}) para juntar ${who()}. A entrega está arquivada na branch dela.`, `\`git checkout ${defaultBranch}\` mostra o motivo`), feature });
660
778
  process.exit(1);
661
779
  }
662
780
  try {
@@ -667,7 +785,7 @@ async function integrateMerge({ emit, root, feature, expectedBranch, defaultBran
667
785
  finished: false,
668
786
  error: 'merge-conflict',
669
787
  output: gitErr(err),
670
- hint: `conflito ao mergear ${expectedBranch} em ${defaultBranch}. Seu trabalho está intacto em ${expectedBranch} — rode \`git checkout ${expectedBranch}\` para voltar a ele`,
788
+ hint: say(`Juntar ${who()} em ${defaultBranch} deu conflito. Desfiz a tentativa; o trabalho está intacto na branch dela.`, `\`git checkout ${expectedBranch}\` para voltar a ele`),
671
789
  feature,
672
790
  });
673
791
  process.exit(1);
@@ -695,8 +813,8 @@ function reopenFeature({ tree, feature, check, ciRun, sha }) {
695
813
  const fj = JSON.parse(readFileSync(path, 'utf8'));
696
814
  const now = new Date().toISOString();
697
815
  const reason = check.state === 'fail'
698
- ? `CI da PR vermelho: ${check.failed.map((c) => c.workflowName).join(', ')}`
699
- : `CI da PR sem veredito: ${check.reason}`;
816
+ ? `Os testes do PR no GitHub falharam (${check.failed.map((c) => c.workflowName).join(', ')}). A entrega voltou para correção.`
817
+ : `Os testes do PR no GitHub não deram resultado (${check.reason}). A entrega voltou para rodar os testes aqui.`;
700
818
  fj.approvalGates = { ...fj.approvalGates, review: { approved: false, timestamp: now, approvedBy: null, revokedBy: 'finish', revokedAt: now, reason } };
701
819
  if (check.state === 'fail') {
702
820
  const { pendingPr: _, ...stamp } = fj.verification;
@@ -722,10 +840,12 @@ function setPrDraft(root, prUrl, draft) {
722
840
  }
723
841
 
724
842
  async function integratePr({ emit, root, feature, expectedBranch, defaultBranch, isWorktreeFlow, worktreePath, options, prTitle, prBody, arch, backupStamp, pendingPr, featureTree }) {
843
+ const name = labelOf([featureTree, worktreePath, root], feature);
844
+ const who = () => name;
725
845
  try {
726
846
  execFileSync('git', ['push', '-u', 'origin', expectedBranch], { cwd: root, stdio: 'pipe' });
727
847
  } catch (err) {
728
- emit({ finished: false, error: 'push-failed', output: gitErr(err), hint: 'o archive está commitado localmente — resolva o push e re-execute', feature });
848
+ emit({ finished: false, error: 'push-failed', output: gitErr(err), hint: say(`Não consegui enviar ${who()} para o GitHub. O archive está salvo neste computador.`, 'resolva o push e rode o finish de novo'), feature });
729
849
  process.exit(1);
730
850
  }
731
851
 
@@ -738,7 +858,7 @@ async function integratePr({ emit, root, feature, expectedBranch, defaultBranch,
738
858
  const { bin, prefix } = resolveGh();
739
859
  prUrl = execFileSync(bin, [...prefix, 'pr', 'create', '--base', defaultBranch, '--head', expectedBranch, '--title', prTitle, '--body', prBody], { cwd: root, stdio: 'pipe' }).toString().trim();
740
860
  } catch (err) {
741
- emit({ finished: false, error: 'pr-create-failed', output: gitErr(err), hint: 'a branch foi enviada (push OK); abra o PR manualmente com `gh pr create`', feature, pushed: expectedBranch });
861
+ emit({ finished: false, error: 'pr-create-failed', output: gitErr(err), hint: say(`Enviei ${who()} para o GitHub, mas não consegui abrir o PR.`, 'abra o PR à mão com `gh pr create`'), feature, pushed: expectedBranch });
742
862
  process.exit(1);
743
863
  }
744
864
  }
@@ -752,7 +872,7 @@ async function integratePr({ emit, root, feature, expectedBranch, defaultBranch,
752
872
  try {
753
873
  reason = reopenFeature({ tree: featureTree, feature, check, ciRun: check.failed?.[0]?.detailsUrl ?? prUrl, sha });
754
874
  } catch (err) {
755
- emit({ finished: false, error: 'reopen-failed', output: gitErr(err), hint: `CI da PR sem verde (${check.state}) e o archive não foi desfeito: não mergeie ${prUrl}; rode \`git revert\` do commit de archive em ${featureTree}`, feature });
875
+ emit({ finished: false, error: 'reopen-failed', output: gitErr(err), hint: say(`Os testes do PR no GitHub não passaram, e não consegui reabrir ${who()}. Não junte ${prUrl}.`, `\`git revert\` do commit de archive em ${featureTree}`), feature });
756
876
  process.exit(1);
757
877
  }
758
878
  const red = check.state === 'fail';
@@ -765,8 +885,8 @@ async function integratePr({ emit, root, feature, expectedBranch, defaultBranch,
765
885
  reason,
766
886
  ...(red ? { failed: check.failed.map((c) => ({ workflow: c.workflowName, url: c.detailsUrl })) } : {}),
767
887
  hint: red
768
- ? 'archive desfeito e Gate 3 reaberto: corrija (`gh run view <id> --log-failed`), commite e siga review.md §5; o finish reaproveita esta PR'
769
- : `archive desfeito e Gate 3 reaberto: rode \`morph-spec verify ${feature} --json --detach\` (sem --ci, a completa local), \`gate-check ${feature} review\`, approve e o finish de novo; o finish reaproveita esta PR`,
888
+ ? say(`Os testes do PR no GitHub falharam. Desfiz a entrega de ${who()} e reabri a ${GATE_NAME.review.toLowerCase()}. Próximo: corrigir o que falhou; o mesmo PR será reaproveitado.`, 'corrija (`gh run view <id> --log-failed`), commite e siga review.md §5')
889
+ : say(`Os testes do PR no GitHub não deram resultado. Desfiz a entrega de ${who()} e reabri a ${GATE_NAME.review.toLowerCase()}. Próximo: rodar ${TESTS} aqui; o mesmo PR será reaproveitado.`, `\`morph-spec verify ${feature} --json --detach\` (sem --ci), \`gate-check ${feature} review\`, approve e o finish de novo`),
770
890
  });
771
891
  process.exit(1);
772
892
  }
@@ -812,8 +932,8 @@ async function integratePr({ emit, root, feature, expectedBranch, defaultBranch,
812
932
  pr: { number: prNumber, url: prUrl },
813
933
  ...(checks ? { checks } : {}),
814
934
  nextStep: checks?.status === 'pending'
815
- ? `confira \`gh pr checks ${prNumber ?? expectedBranch}\` antes de mergear ${prLabel}: a suíte ainda não respondeu`
816
- : `mergeie ${prLabel} — a feature só estará encerrada quando ${defaultBranch} receber o archive pelo merge`,
935
+ ? say(`PR ${prLabel} aberto para ${who()}. Os testes do PR no GitHub ainda não responderam. Próximo: esperar o resultado antes de juntar.`, `\`gh pr checks ${prNumber ?? expectedBranch}\``)
936
+ : say(`PR ${prLabel} aberto para ${who()}. Próximo: aprovar e juntar o PR no GitHub; a entrega só termina quando ${defaultBranch} receber o PR.`),
817
937
  ...adrIndexNote(arch),
818
938
  ...(shedBackup ? { shedBackup } : {}),
819
939
  ...(e2e ? { e2e } : {}),
@@ -825,7 +945,7 @@ async function integratePr({ emit, root, feature, expectedBranch, defaultBranch,
825
945
  ...(isWorktreeFlow && options.keep
826
946
  ? {
827
947
  worktree: { path: worktreePath, branch: expectedBranch },
828
- hint: `worktree preservado em ${worktreePath} — feche depois com \`morph-spec worktree remove ${feature}\`.`,
948
+ hint: say(`A pasta de trabalho ficou guardada em ${worktreePath}, como pedido.`, `\`morph-spec worktree remove ${feature}\` quando não precisar mais dela`),
829
949
  }
830
950
  : teardownDeferred
831
951
  ? {
@@ -884,20 +1004,21 @@ function mergeNextStep(publish) {
884
1004
  const pushCmd = `\`git push ${remote} ${branch}\``;
885
1005
 
886
1006
  if (pushed) {
887
- const n = typeof published === 'number' ? `${published} commit(s)` : 'a integração';
888
- return `PUBLICADO — ${n} de ${branch} enviado(s) para ${remote}/${branch} pelo --push.`;
1007
+ const n = typeof published === 'number' ? `${published} commit(s)` : 'a entrega';
1008
+ return `Entregue e publicado: ${n} de ${branch} enviado(s) para ${remote}/${branch}.`;
889
1009
  }
1010
+ const local = `Entregue em ${branch}, só neste computador.`;
890
1011
  if (pushError === 'no-origin-remote') {
891
- return `integração LOCAL — nada foi publicado: --push foi pedido mas não há remoto \`${remote}\` configurado.`;
1012
+ return `${local} Nada foi publicado: não há remoto \`${remote}\` configurado.`;
892
1013
  }
893
1014
  if (pushError) {
894
- return `integração LOCAL — o push pedido por --push FALHOU e nada foi publicado. Rode ${pushCmd} manualmente.`;
1015
+ return say(`${local} O envio para o GitHub falhou; nada foi publicado.`, pushCmd);
895
1016
  }
896
1017
  // Sem contraparte remota não se inventa contagem: fica a frase estática.
897
1018
  if (ahead === null) {
898
- return 'integração LOCAL — nada foi publicado. Rode `git push` para levar ao remoto.';
1019
+ return say(`${local} Nada foi publicado ainda.`, '`git push`');
899
1020
  }
900
- return `integração LOCAL — nada foi publicado: ${branch} está ${ahead} commit(s) à frente de ${remote}/${branch}. Rode ${pushCmd} para levar ao remoto (ou re-execute o finish com --push).`;
1021
+ return say(`${local} Nada foi publicado: ${branch} tem ${ahead} commit(s) que ${remote}/${branch} ainda não tem.`, `${pushCmd} (ou o finish de novo com --push)`);
901
1022
  }
902
1023
 
903
1024
  // CONSTRUTOR ÚNICO das três saídas de sucesso do `--merge`. `teardown === null` cobre o `--keep`
@@ -920,7 +1041,7 @@ function mergeOutput({ feature, branch, defaultBranch, publish, worktreePath = n
920
1041
  ? {
921
1042
  // The root registration stays VALID (it names a live directory): nothing to clean up.
922
1043
  worktree: { path: worktreePath, branch },
923
- hint: `worktree preservado em ${worktreePath} — feche depois com \`morph-spec worktree remove ${feature}\`.`,
1044
+ hint: say(`A pasta de trabalho ficou guardada em ${worktreePath}, como pedido.`, `\`morph-spec worktree remove ${feature}\` quando não precisar mais dela`),
924
1045
  }
925
1046
  : {}),
926
1047
  ...(teardown ? teardownExtras(teardown, worktreePath, branch, true) : {}),
@@ -1043,7 +1164,7 @@ function featureElsewhereHint(featureCwd, root, feature) {
1043
1164
  if (existsSync(archived)) {
1044
1165
  return {
1045
1166
  archived: archived.replace(/\\/g, '/'),
1046
- hint: `'${feature}' já foi arquivada por um finish anterior — o que faltou foi a integração. Verifique se o merge/PR já aconteceu antes de refazer o trabalho à mão.`,
1167
+ hint: say(`${feature} já foi arquivada por um finish anterior; o que faltou foi juntar a entrega.`, 'confira se o merge ou o PR já aconteceu antes de refazer à mão'),
1047
1168
  };
1048
1169
  }
1049
1170
  } catch { /* fail-open */ }
@@ -1054,12 +1175,12 @@ function featureElsewhereHint(featureCwd, root, feature) {
1054
1175
  if (listed) {
1055
1176
  return {
1056
1177
  onBranch: branch,
1057
- hint: `'${feature}' não está nesta árvore, mas a branch ${branch} existe — rode o finish de lá (\`git checkout ${branch}\`) ou do worktree da feature.`,
1178
+ hint: say(`${feature} não está nesta pasta, mas a branch dela (${branch}) existe.`, `rode o finish de lá (\`git checkout ${branch}\`) ou da pasta de trabalho da feature`),
1058
1179
  };
1059
1180
  }
1060
1181
  } catch { /* fail-open — sem git, sem hint */ }
1061
1182
 
1062
- return { hint: `'${feature}' não existe em .morph/features/ nesta árvore. Confira o nome com \`morph-spec list --all\`.` };
1183
+ return { hint: say(`Não achei a feature ${feature} nesta pasta.`, 'confira o nome com `morph-spec list --all`') };
1063
1184
  }
1064
1185
 
1065
1186
  function readFeatureJson(cwd, feature, bucket = 'features') {