sedd 0.1.4 → 0.1.6

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.
@@ -232,19 +232,78 @@ function Find-FeatureDir {
232
232
  return $null
233
233
  }
234
234
 
235
+ function Get-ExpectationSummary {
236
+ param([object]$Expectation)
237
+
238
+ if (-not $Expectation) { return $null }
239
+ if ($Expectation -is [string]) { return $Expectation }
240
+ return $Expectation.summary
241
+ }
242
+
243
+ function Get-MustNotList {
244
+ param([object]$Expectation)
245
+
246
+ if (-not $Expectation -or $Expectation -is [string]) { return @() }
247
+ if ($Expectation.mustNot) { return $Expectation.mustNot } else { return @() }
248
+ }
249
+
235
250
  function Build-SeddContext {
236
251
  param(
237
252
  [string]$Branch,
238
253
  [string]$CurrentMigration,
239
254
  [int]$Completed,
240
- [array]$Pending
255
+ [array]$Pending,
256
+ [object]$FeatureExpectation,
257
+ [object]$MigrationExpectation
241
258
  )
242
259
 
243
- if ($Pending.Count -eq 0) { return $null }
260
+ $featureSummary = Get-ExpectationSummary -Expectation $FeatureExpectation
261
+ $migrationSummary = Get-ExpectationSummary -Expectation $MigrationExpectation
262
+ $mustNotList = Get-MustNotList -Expectation $MigrationExpectation
263
+ if ($mustNotList.Count -eq 0) {
264
+ $mustNotList = Get-MustNotList -Expectation $FeatureExpectation
265
+ }
266
+
267
+ if ($Pending.Count -eq 0 -and -not $featureSummary -and -not $migrationSummary) { return $null }
244
268
 
245
269
  $total = $Completed + $Pending.Count
246
270
  $migrationInfo = if ($CurrentMigration) { " | Migration: $CurrentMigration" } else { '' }
247
271
 
272
+ # Build expectation block
273
+ $expectationBlock = ''
274
+ $activeExpectation = if ($migrationSummary) { $migrationSummary } else { $featureSummary }
275
+
276
+ if ($featureSummary -and $migrationSummary -and $featureSummary -ne $migrationSummary) {
277
+ $expectationBlock = @"
278
+
279
+ 🎯 **FEATURE:** $featureSummary
280
+ 📍 **MIGRATION ${CurrentMigration}:** $migrationSummary
281
+ "@
282
+ }
283
+ elseif ($activeExpectation) {
284
+ $prefix = if ($migrationSummary) { "📍 M$CurrentMigration" } else { '🎯' }
285
+ $expectationBlock = "`n$prefix **EXPECTATIVA:** $activeExpectation`n"
286
+ }
287
+
288
+ # Build mustNot block
289
+ $mustNotBlock = ''
290
+ if ($mustNotList.Count -gt 0) {
291
+ $restrictions = ($mustNotList | ForEach-Object { "- ❌ $_" }) -join "`n"
292
+ $mustNotBlock = @"
293
+
294
+ ⛔ **NÃO DEVE:**
295
+ $restrictions
296
+ "@
297
+ }
298
+
299
+ if ($Pending.Count -eq 0) {
300
+ return @"
301
+ <sedd-context>
302
+ **Branch: $Branch**$migrationInfo$expectationBlock$mustNotBlock
303
+ </sedd-context>
304
+ "@
305
+ }
306
+
248
307
  $tasksList = ($Pending | Select-Object -First 5 | ForEach-Object {
249
308
  $text = if ($_.text.Length -gt 60) { $_.text.Substring(0, 60) + '...' } else { $_.text }
250
309
  "- $($_.id): $text"
@@ -255,11 +314,9 @@ function Build-SeddContext {
255
314
  return @"
256
315
  <sedd-context>
257
316
  **Branch: $Branch**$migrationInfo | Progress: $Completed/$total tasks
258
-
317
+ $expectationBlock$mustNotBlock
259
318
  Pending tasks:
260
319
  $tasksList$moreText
261
-
262
- Use ``/sedd.implement`` to execute tasks.
263
320
  </sedd-context>
264
321
  "@
265
322
  }
@@ -302,10 +359,18 @@ function Main {
302
359
  $pending = @()
303
360
  $completed = 0
304
361
  $currentMigration = $null
362
+ $featureExpectation = $null
363
+ $migrationExpectation = $null
305
364
 
306
365
  if (Test-Path $metaFile) {
307
366
  $metaData = Get-Content $metaFile -Raw | ConvertFrom-Json
308
367
  $currentMigration = $metaData.currentMigration
368
+ $featureExpectation = $metaData.expectation
369
+
370
+ if ($currentMigration -and $metaData.migrations.$currentMigration.expectation) {
371
+ $migrationExpectation = $metaData.migrations.$currentMigration.expectation
372
+ }
373
+
309
374
  $result = Get-TasksFromMigrations -FeatureDir $featureDir -MetaData $metaData
310
375
  $pending = $result.pending
311
376
  $completed = $result.completed
@@ -316,7 +381,7 @@ function Main {
316
381
  $completed = $result.completed
317
382
  }
318
383
 
319
- $context = Build-SeddContext -Branch $branch -CurrentMigration $currentMigration -Completed $completed -Pending $pending
384
+ $context = Build-SeddContext -Branch $branch -CurrentMigration $currentMigration -Completed $completed -Pending $pending -FeatureExpectation $featureExpectation -MigrationExpectation $migrationExpectation
320
385
  if ($context) { $parts += $context }
321
386
  }
322
387
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sedd",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "SEDD - Spec & Expectation Driven Development. A phase-based specification workflow for AI-assisted development.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -6,13 +6,23 @@
6
6
 
7
7
  ## Expectativa
8
8
 
9
- > {{EXPECTATION}}
9
+ > {{EXPECTATION_SUMMARY}}
10
+
11
+ ### DEVE fazer:
12
+ {{#each MUST}}
13
+ - {{this}}
14
+ {{/each}}
15
+
16
+ ### NÃO DEVE fazer:
17
+ {{#each MUST_NOT}}
18
+ - ❌ {{this}}
19
+ {{/each}}
10
20
 
11
21
  ---
12
22
 
13
23
  ## Checklist de Aceite
14
24
 
15
- ### Critérios Funcionais
25
+ ### Critérios Funcionais (DEVE)
16
26
 
17
27
  - [ ] **AC-001:** {{criterion_1}}
18
28
  - Verificar: {{verification_steps}}
@@ -32,6 +42,33 @@
32
42
 
33
43
  ---
34
44
 
45
+ ## Critérios Negativos (NÃO DEVE)
46
+
47
+ > Estes critérios verificam que restrições foram respeitadas.
48
+ > Falha em qualquer um indica violação da expectativa.
49
+
50
+ {{#each MUST_NOT}}
51
+ - [ ] **AC-N{{@index}}:** Verificar que NÃO: {{this}}
52
+ - Buscar: arquivos/código que violem esta restrição
53
+ - Se encontrado: ❌ VIOLAÇÃO
54
+ {{/each}}
55
+
56
+ ### Validação Automática Sugerida
57
+
58
+ ```bash
59
+ # Comandos para verificar restrições (ajustar conforme mustNot)
60
+ # Exemplo: Verificar se criou arquivos em services/x/
61
+ find services/x -type f -newer .sedd/timestamp_marker
62
+
63
+ # Exemplo: Verificar uso de localStorage
64
+ grep -r "localStorage" src/
65
+
66
+ # Exemplo: Verificar chamadas a API externa
67
+ grep -rE "(axios|fetch)\s*\(" src/
68
+ ```
69
+
70
+ ---
71
+
35
72
  ## Comandos de Verificação
36
73
 
37
74
  ```bash