wogiflow 1.8.8 → 1.9.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.
@@ -813,177 +813,65 @@ Then present 4 options:
813
813
  - Triage will handle fix/task/skip/dismiss decisions per finding
814
814
  - Proceed to step 5.4 after triage completes
815
815
 
816
- **5.3b. If user chooses fix (Option 1 or 2) — SEVERITY-ROUTED FIX LOOP**:
817
-
818
- **BEFORE applying any fixes, create a tracked fix task in `ready.json` inProgress:**
819
-
820
- 1. Generate a fix task ID: `wf-cr-XXXXXX` (first 6 chars of a hash based on review date + finding count)
821
- 2. Count findings to fix (all for Option 1, critical/high only for Option 2)
822
- 3. Read `ready.json`, add fix task to `inProgress` array:
823
- ```json
824
- {
825
- "id": "wf-cr-XXXXXX",
826
- "title": "Fix N review findings from [review-id or task-id]",
827
- "type": "fix",
828
- "feature": "review",
829
- "status": "in_progress",
830
- "priority": "P0",
831
- "startedAt": "[ISO timestamp]"
832
- }
833
- ```
834
- 4. Write updated `ready.json` — the task-gate (PreToolUse) will now allow Edit/Write operations
835
- 5. Display: `Created fix task: wf-cr-XXXXXX Fix N review findings`
836
-
837
- **ONLY AFTER the task exists in inProgress**, proceed with the severity-routed fix loop.
838
-
839
- **Severity Routing Table** (read `config.reviewFix.severityRouting`):
840
-
841
- | Severity | autoFixable | Security? | Route |
842
- |----------|------------|-----------|-------|
843
- | critical | any | any | Full `/wogi-start` loop |
844
- | high | false | any | Full `/wogi-start` loop |
845
- | high | true | yes | Full loop (security always gets full review) |
846
- | high | true | no | Light fix loop |
847
- | medium/low | any | yes | Light fix + security flag (display to user even when auto-fixable) |
848
- | medium/low | any | no | Light fix loop |
849
-
850
- **Full loop** (for critical/high findings): Convert to TodoWrite items as individual todos. For each:
851
- - Mark in_progress
852
- - Apply fix
853
- - Run targeted verification (node --check, lint, typecheck)
854
- - Mark completed
855
-
856
- **Light fix loop** (for medium/low auto-fixable findings):
857
- 1. Apply fix (Edit tool)
858
- 2. Verify: `node --check <file>` + lint + typecheck
859
- 3. If PASS → mark fixed
860
- 4. If FAIL → retry once, then escalate to manual/task
861
-
862
- Light fix loop does NOT include: spec generation, explore phase, approval gate, or criteria check.
863
-
864
- - After all fixes: Re-run verification gates (lint, typecheck, tests)
865
- - **Fix loop iteration cap**: Maximum 3 re-verify cycles. If new issues keep appearing after 3 iterations, stop and present remaining issues to the user rather than continuing automatically.
866
-
867
- **AFTER the fix loop completes**, move the fix task to recentlyCompleted:
868
- 1. Read `ready.json`
869
- 2. Remove the fix task from `inProgress`
870
- 3. Add it to `recentlyCompleted` with `completedAt` timestamp
871
- 4. Write updated `ready.json`
872
- 5. Display: `Fix task wf-cr-XXXXXX completed and moved to recentlyCompleted`
873
-
874
- This ensures:
875
- - The PreToolUse task-gate allows edits during the fix loop (active task exists)
876
- - After completion, no active task exists → task-gate blocks subsequent untracked edits
877
- - All fix work is tracked and visible in the workflow
878
-
879
- **5.3c. Same-session detection + persistent task creation for unfixed findings (ALL options)**:
880
-
881
- After the fix loop completes (Options 1/2), or immediately (Option 4), handle unfixed findings with **origin-aware persistence**. This ensures nothing gets silently lost AND creates traceability.
882
-
883
- **Step 1: Same-session detection** (read `config.originTaskTracing`):
884
-
885
- When `config.originTaskTracing.annotateCompletedTasks` is true:
886
-
887
- 1. Read `ready.json` → `recentlyCompleted` array
888
- 2. For each completed task, check if `completedAt` is within the `sameSessionWindow` (default: 2 hours from now)
889
- 3. For each unfixed finding, check if `finding.file` was changed by a recent completed task:
890
- - Run `git log --format="%H" -1 -- [finding.file]` to get the last commit that touched the file
891
- - Check if that commit message contains a task ID from `recentlyCompleted` (e.g., `wf-XXXXXXXX` in the commit message)
892
- - Alternatively, check if the finding's file path appears in the completed task's known changed files
893
- 4. If a match is found → this is a **same-session finding** for that origin task
894
-
895
- **Step 2: Annotate completed tasks with same-session findings**:
896
-
897
- For findings that match a same-session completed task:
898
-
899
- 1. Add a `reviewFindings` array to the completed task in `recentlyCompleted`:
900
- ```json
901
- {
902
- "id": "wf-existing-task",
903
- "title": "...",
904
- "status": "completed",
905
- "reviewFindings": [
906
- {
907
- "id": "[finding.id]",
908
- "severity": "[finding.severity]",
909
- "category": "[finding.category]",
910
- "file": "[finding.file]",
911
- "line": "[finding.line]",
912
- "issue": "[finding.issue]",
913
- "recommendation": "[finding.recommendation]",
914
- "reviewDate": "[ISO]",
915
- "status": "unfixed"
916
- }
917
- ]
918
- }
919
- ```
920
- 2. Do NOT create a separate `wf-rv-` task for these findings — they live on the completed task
921
- 3. Display: `Annotated task [id] with N review findings (same-session)`
922
-
923
- **Step 3: Create persistent tasks for remaining (non-same-session) findings**:
924
-
925
- For findings that do NOT match a same-session task, create `wf-rv-` tasks with origin tracing:
926
-
927
- 1. **Duplicate check**: Search `ready.json` for existing task with matching `finding.id` in the `finding` field. If a task already exists for this finding, skip creation.
928
- 2. **Generate ID**: `wf-rv-XXXXXXXX` (8-char hash of `finding.id` + reviewDate)
929
- 3. **Resolve origin task** (when `config.originTaskTracing.traceOrigin` is true):
930
- - Run `git log --format="%H %s" -1 -- [finding.file]` to find the last commit
931
- - Extract task ID from commit message (pattern: `wf-XXXXXXXX`)
932
- - Look up the task in `recentlyCompleted` to get `{ id, title, type, feature }`
933
- - If no task ID found in commit → set `originTask: null`
934
- 4. **Map severity → priority**: critical→P0, high→P1, medium→P2, low→P3
935
- 5. **Create task** in `ready.json` `ready` array:
936
- ```json
937
- {
938
- "id": "wf-rv-XXXXXXXX",
939
- "title": "Review fix: [issue truncated to 80 chars]",
940
- "type": "fix",
941
- "feature": "review",
942
- "source": "review",
943
- "reviewDate": "[ISO]",
944
- "originTask": {
945
- "id": "[origin task ID or null]",
946
- "title": "[origin task title]",
947
- "type": "[origin task type]",
948
- "feature": "[origin task feature]"
949
- },
950
- "finding": {
951
- "id": "[finding.id]",
952
- "severity": "[finding.severity]",
953
- "category": "[finding.category]",
954
- "file": "[finding.file]",
955
- "line": "[finding.line]",
956
- "issue": "[finding.issue]",
957
- "recommendation": "[finding.recommendation]",
958
- "autoFixable": "[finding.autoFixable]"
959
- },
960
- "status": "ready",
961
- "priority": "P0-P3",
962
- "batchable": true,
963
- "batchKey": "[file]|[category]",
964
- "createdAt": "[ISO]"
965
- }
966
- ```
816
+ **5.3b. If user chooses fix (Option 1 or 2) — ROUTED FIX VIA /wogi-start**:
817
+
818
+ **CRITICAL: Do NOT manually edit `ready.json` to create fix tasks. This is a routing bypass.**
819
+
820
+ All fix work MUST be routed through `/wogi-start`, which creates properly tracked tasks through the routing system. This ensures fixes go through the full pipeline: explore spec implementation verification quality gates map updates → request log.
821
+
822
+ **Procedure:**
823
+
824
+ 1. Compose a fix request summarizing findings to fix (all for Option 1, critical/high only for Option 2)
825
+ 2. Invoke `/wogi-start "Fix N review findings: [brief summary of top issues]"`
826
+ 3. `/wogi-start` will:
827
+ - Create a properly tracked task via `generateTaskId()`
828
+ - Route it through the standard pipeline (L2 or L3 based on scope)
829
+ - Each finding becomes an acceptance criterion
830
+ - All quality gates, maps, and logs are updated through the normal flow
831
+ 4. The fix task proceeds through the standard WogiFlow execution loop
832
+
833
+ **Finding-to-criteria mapping:**
834
+
835
+ | Finding severity | Acceptance criterion format |
836
+ |-----------------|---------------------------|
837
+ | critical/high | Individual criterion per finding with Given/When/Then |
838
+ | medium | Grouped by file: "Fix N medium issues in [file]" |
839
+ | low | Grouped by category: "Fix N [category] issues" |
840
+
841
+ **Why this matters:** Manual ready.json editing bypasses explore, spec, standards checks, wiring verification, map updates, and request logging. This is the #1 cause of incomplete fixes and state file drift.
967
842
 
968
- **Step 4: Learning signal detection** (when `config.originTaskTracing.learningSignal.enabled` is true):
843
+ **After `/wogi-start` completes the fix task**, the standard completion flow handles:
844
+ - Moving task to recentlyCompleted
845
+ - Updating request-log.md
846
+ - Updating maps if needed
847
+ - Running quality gates
848
+ - Committing changes
969
849
 
970
- After all tasks are created, check for patterns:
850
+ **5.3c. Handling unfixed findings (ALL options)**:
971
851
 
972
- 1. Collect all `originTask` references from newly created `wf-rv-` tasks AND existing `wf-rv-` tasks in `ready.json`
973
- 2. Group by `originTask.type` and `originTask.feature`
974
- 3. If any group has >= `config.originTaskTracing.learningSignal.threshold` (default: 3) fix tasks:
975
- - Add entry to `feedback-patterns.md`:
976
- ```
977
- | [date] | review-origin-pattern-[type/feature] | Tasks of type "[type]"/feature "[feature]" consistently generate review fixes (N instances) | N | Investigate |
978
- ```
979
- - Display warning:
980
- ```
981
- ⚠️ LEARNING SIGNAL: Tasks of type "[type]"/feature "[feature]" have generated N review fixes.
982
- This suggests a systematic issue with how these tasks are implemented.
983
- Consider: /wogi-decide "review checklist for [type] tasks"
984
- ```
852
+ After the fix loop completes (Options 1/2), or immediately (Option 4), handle unfixed findings.
985
853
 
986
- **Step 5: Update `last-review.json`**: For each finding that got a task, add `"taskCreated": "wf-rv-XXXXXXXX"`. For same-session annotations, add `"annotatedOn": "[origin task ID]"`. Set `"triaged": true` on the review.
854
+ **CRITICAL: Do NOT manually edit `ready.json` to create tasks for unfixed findings.** All task creation MUST go through `/wogi-start`.
855
+
856
+ **For unfixed findings that need separate tasks:**
857
+
858
+ 1. Compose a summary of remaining unfixed findings grouped by severity
859
+ 2. Invoke `/wogi-start "Fix N remaining review findings: [summary]"` for each batch
860
+ 3. `/wogi-start` handles task creation, routing, and execution through the standard pipeline
861
+
862
+ **For findings the user chose to defer (Option 4):**
863
+
864
+ 1. Update `last-review.json` — set `"status": "deferred"` on each finding
865
+ 2. Display: `N findings deferred. Run /wogi-review-fix --pending to process later.`
866
+ 3. Do NOT create tasks in ready.json directly — when the user runs `/wogi-review-fix --pending`, it reads `last-review.json` and routes each finding through `/wogi-start`
867
+
868
+ **Learning signal detection:**
869
+
870
+ After completing fixes, check for recurring patterns:
871
+ 1. If 3+ findings share the same `category` or `file` → log to `feedback-patterns.md`
872
+ 2. Display warning suggesting `/wogi-decide` to create a preventive rule
873
+
874
+ **Update `last-review.json`**: Set `"triaged": true` on the review after all findings are addressed (fixed, deferred, or dismissed).
987
875
 
988
876
  **Config toggles** (all in `config.originTaskTracing`):
989
877
  - `annotateCompletedTasks: false` → Skip same-session detection, all findings create standalone tasks
@@ -1398,45 +1286,29 @@ After ALL review phases complete (1 through 4), execute the fix-and-verify loop:
1398
1286
  ┌─────────────────────────────────────────────────────────────┐
1399
1287
  │ POST-REVIEW WORKFLOW │
1400
1288
  ├─────────────────────────────────────────────────────────────┤
1401
- │ 0. CREATE FIX TASK: Add wf-cr-XXXXXX to ready.json
1402
- │ → MUST exist before any edits (task-gate enforces)
1403
- 1. TRACK: Convert issues to TodoWrite items
1404
- Critical/High: Individual todos
1405
- │ → Medium/Low: Grouped by category
1406
- 2. FIX LOOP: For each issue:
1407
- │ → Mark todo in_progress
1408
- Apply fix
1409
- Run targeted verification (lint/typecheck on file)
1410
- │ → Mark todo completed │
1411
- │ 3. RE-VERIFY: Run full verification gates again │
1412
- │ → All gates must pass │
1413
- │ → If new issues found, add to todo list │
1414
- │ 4. COMPLETE TASK: Move wf-cr-XXXXXX to recentlyCompleted │
1415
- │ 5. ARCHIVE: Save review report to .workflow/reviews/ │
1416
- │ 6. SIGN-OFF: User approves review complete │
1289
+ │ 0. ROUTE FIX: Invoke /wogi-start with fix request
1290
+ │ → Do NOT manually edit ready.json
1291
+ /wogi-start creates task through routing system
1292
+ 1. /wogi-start PIPELINE handles:
1293
+ │ → Explore, spec, implementation, verification
1294
+ Each finding = acceptance criterion
1295
+ │ → Quality gates, maps, logs all updated
1296
+ 2. ARCHIVE: Save review report to .workflow/reviews/
1297
+ 3. SIGN-OFF: User approves review complete
1417
1298
  └─────────────────────────────────────────────────────────────┘
1418
1299
  ```
1419
1300
 
1420
- ### Step 0: Create Fix Task (MANDATORY before any edits)
1301
+ ### Step 0: Route Fix Work Through /wogi-start (MANDATORY)
1421
1302
 
1422
- **Before converting findings to todos or applying any fixes**, create a tracked task:
1303
+ **Do NOT manually edit `ready.json` to create fix tasks.** This bypasses the routing system and results in incomplete fixes (no explore, no spec, no standards check, no map updates).
1423
1304
 
1424
- 1. Generate task ID: `wf-cr-XXXXXX` (6-char hash of review date + finding count)
1425
- 2. Read `ready.json`, add to `inProgress`:
1426
- ```json
1427
- {
1428
- "id": "wf-cr-XXXXXX",
1429
- "title": "Fix N review findings from [review-id or task-id]",
1430
- "type": "fix",
1431
- "feature": "review",
1432
- "status": "in_progress",
1433
- "priority": "P0",
1434
- "startedAt": "[ISO timestamp]"
1435
- }
1436
- ```
1437
- 3. Write `ready.json` — the PreToolUse task-gate will now allow Edit/Write operations
1305
+ Instead, invoke `/wogi-start "Fix N review findings: [summary]"` which:
1306
+ 1. Creates a properly tracked task via `generateTaskId()`
1307
+ 2. Routes through the standard pipeline (explore → spec → implementation → verification → quality gates)
1308
+ 3. Each finding becomes an acceptance criterion in the spec
1309
+ 4. All state files, maps, and logs are updated through the normal flow
1438
1310
 
1439
- **Why this is required**: The PreToolUse task-gate hard-blocks Edit/Write when no active task exists in `ready.json` inProgress. Without this step, the fix loop's edits would be blocked.
1311
+ **Why routing matters**: The PreToolUse task-gate requires an active task for Edit/Write operations. `/wogi-start` creates this task through the proper routing system, ensuring all pipeline stages execute. Manual ready.json editing creates a "fake" task that bypasses the pipeline.
1440
1312
 
1441
1313
  ### Step 1: Issue Tracking
1442
1314
 
@@ -1501,16 +1373,15 @@ If new issues are discovered during re-verification:
1501
1373
  2. Continue the fix loop
1502
1374
  3. Re-verify again
1503
1375
 
1504
- ### Step 4: Complete Fix Task
1505
-
1506
- **After all fixes pass verification**, move the fix task to recentlyCompleted:
1376
+ ### Step 4: Task Completion (Handled by /wogi-start)
1507
1377
 
1508
- 1. Read `ready.json`
1509
- 2. Remove `wf-cr-XXXXXX` from `inProgress`
1510
- 3. Add it to `recentlyCompleted` with `completedAt` timestamp
1511
- 4. Write `ready.json`
1378
+ Fix task completion is handled automatically by the `/wogi-start` execution loop (Step 5: Finalize). This includes:
1379
+ - Moving the task to recentlyCompleted in ready.json
1380
+ - Updating request-log.md
1381
+ - Running quality gates
1382
+ - Committing changes
1512
1383
 
1513
- **After this step, no active task exists** the PreToolUse task-gate will block any subsequent Edit/Write operations until the user starts a new task via `/wogi-start`.
1384
+ **Do NOT manually edit ready.json** to move tasks between arrays. The `/wogi-start` pipeline handles this through its standard completion flow.
1514
1385
 
1515
1386
  ### Step 5: Archive Review Report
1516
1387
 
@@ -162,6 +162,15 @@ Launch all in parallel. When `config.hybrid.enabled`, route via `model` paramete
162
162
 
163
163
  **After agents complete**: Display consolidated research summary covering codebase analysis, best practices, version info, risks, standards, and consumer impact.
164
164
 
165
+ **REUSE GATE (MANDATORY)**: After consolidating agent results, check for reuse candidates:
166
+ 1. Collect all reuse candidates reported by Agent 1 (domain-keyword search) and Agent 5 (registry scan)
167
+ 2. If ANY reuse candidate has purpose overlap with planned new code → **STOP and present to user**:
168
+ - Show each candidate: name, path, purpose, similarity
169
+ - Ask: "Use existing / Extend existing / Create new (explain why)"
170
+ - Implementation BLOCKED until user decides on each candidate
171
+ 3. If no reuse candidates found → proceed normally
172
+ 4. This gate runs BEFORE spec generation — catching reuse early prevents wasted implementation
173
+
165
174
  **For L1/L0 tasks**: Offer to deepen research (exhaustive search, load all skills, full dependency tree).
166
175
 
167
176
  **Fallback**: If agents fail, log warning and proceed with remaining. Consumer Impact failure on refactor tasks = HARD BLOCK (require user confirmation). See `.claude/docs/explore-agents.md` for details.
@@ -232,11 +241,17 @@ After implementing all scenarios, BEFORE quality gates:
232
241
 
233
242
  Run `node scripts/flow-wiring-verifier.js wf-XXXXXXXX`
234
243
 
235
- For each created file, verify it's imported/used somewhere:
244
+ **Forward wiring** — For each created file, verify it's imported/used somewhere:
236
245
  - Entry points (index.ts, App.tsx, *.config.ts, tests) don't need imports
237
246
  - Components MUST be imported in a parent. Hooks MUST be called. Utilities MUST be imported.
238
247
  - If NOT wired: identify where to import, wire it up, re-verify.
239
248
 
249
+ **Removal impact** (v1.9.3) — For each removed export, type member, or identifier, verify no consumers still reference it:
250
+ - Runs automatically as part of the `integrationWiring` quality gate
251
+ - Detects orphaned references: removed type union members, exported names, component references, string literal IDs (e.g., tab IDs, route keys)
252
+ - If orphaned references found: update consumers to remove stale references, re-verify.
253
+ - CLI: `node scripts/flow-wiring-verifier.js removal-check [files...]`
254
+
240
255
  ### Step 3.7: Standards Compliance Check (MANDATORY)
241
256
 
242
257
  Run `node scripts/flow-standards-gate.js wf-XXXXXXXX [changed-files...]`
@@ -253,7 +268,23 @@ If violations found: fix, re-run, only proceed when all pass. Violations auto-re
253
268
 
254
269
  **First**: Run `node scripts/flow-spec-verifier.js verify wf-XXXXXXXX` — verify all spec deliverables exist. If missing → STOP, create them.
255
270
 
256
- **Then**: Check `config.qualityGates` for task type: tests, requestLogEntry, appMapUpdate, noNewFeatures (refactors).
271
+ **Then**: Check `config.qualityGates` for task type. Gates are type-specific:
272
+ - **feature**: loopComplete, tests, appMapUpdate, requestLogEntry, integrationWiring, standardsCompliance
273
+ - **bugfix**: loopComplete, tests, requestLogEntry, standardsCompliance, learningEnforcement
274
+ - **refactor**: loopComplete, tests, noNewFeatures, smokeTest, standardsCompliance
275
+ - **chore**: requestLogEntry, outstandingFindings
276
+ - **release**: requestLogEntry, outstandingFindings, preRelease
277
+ - **fix**: loopComplete, requestLogEntry, standardsCompliance
278
+
279
+ **Fallback behavior**: Task types not listed above (docs, style, test, perf, etc.) inherit the **feature** gates. This is intentional — feature gates are the most comprehensive and serve as a safe default.
280
+
281
+ **Key automated gates** (v1.9.2):
282
+ - `integrationWiring` → calls `verifyWiring()` — checks created files are imported/used
283
+ - `standardsCompliance` → calls `runTaskStandardsCheck()` — checks naming, security, decisions.md rules
284
+ - `outstandingFindings` → reads `last-review.json` — blocks if unresolved critical/high findings exist
285
+ - `preRelease` → verifies codebase is releasable (no outstanding findings + lint + typecheck)
286
+
287
+ **CRITICAL**: No task type defaults to zero gates. Every task type MUST have at least `requestLogEntry` + `outstandingFindings`.
257
288
 
258
289
  **WebMCP** (optional): If `config.webmcp.enabled` and UI files changed, check tool coverage. Non-blocking.
259
290
 
@@ -9,23 +9,43 @@ Launch as `Agent(subagent_type=Explore)`:
9
9
  ```
10
10
  Analyze the codebase for task: "[TASK_TITLE]"
11
11
 
12
- 1. Use Glob to find files related to: [TASK_KEYWORDS]
13
- 2. Use Grep to search for patterns, function names, component references
14
- 3. Read app-map.md for existing components that could be reused
15
- 4. Read function-map.md for existing utility functions that could be reused
16
- 5. Read api-map.md for existing API endpoints that could be reused
17
- 6. Read decisions.md for patterns that must be followed
18
- 7. Map dependencies:
19
- - Files that REFERENCE the target code
20
- - Files REFERENCED BY the target code
21
- 8. Surface assumptions that need verification
12
+ STEP 1 Domain-keyword search (MANDATORY, do this FIRST):
13
+ a. Extract 3-5 domain keywords from the task title
14
+ Example: "AI Policies tab" ["policy", "policies", "automation", "AI"]
15
+ Example: "Payment service refactor" ["payment", "checkout", "billing", "transaction"]
16
+ b. For EACH keyword, run:
17
+ - Glob **/*[keyword]* to find files with that keyword in the name
18
+ - Grep for the keyword in src/ (or project root) to find references in code
19
+ c. Read EVERY file that matches these are potential reuse candidates
20
+ d. Pay special attention to files in shared/, utils/, lib/, common/ directories
21
+
22
+ STEP 2 — Registry check (read ALL registry maps):
23
+ a. Read app-map.md for existing components that could be reused
24
+ b. Read function-map.md for existing utility functions
25
+ c. Read api-map.md for existing API endpoints
26
+ d. Read any other *-map.md files in .workflow/state/
27
+ e. For each planned NEW item, check if something similar already exists
28
+
29
+ STEP 3 — Pattern & dependency analysis:
30
+ a. Read decisions.md for patterns that must be followed
31
+ b. Map dependencies:
32
+ - Files that REFERENCE the target code
33
+ - Files REFERENCED BY the target code
34
+ c. Surface assumptions that need verification
22
35
 
23
36
  Return a structured summary:
37
+ - **REUSE CANDIDATES** (MUST be first section):
38
+ List every existing file/component/function/service that overlaps
39
+ with what this task plans to create. For each: path, purpose, and
40
+ whether the task should USE it, EXTEND it, or CREATE new.
24
41
  - Related files (path + why it's relevant)
25
- - Existing components to reuse
26
- - Patterns to follow
42
+ - Patterns to follow (from decisions.md)
27
43
  - Dependency map
28
44
  - Assumptions to verify
45
+
46
+ CRITICAL: If domain-keyword search finds existing implementations that
47
+ overlap with the task's goals, this MUST be prominently flagged.
48
+ Do NOT skip Step 1 even if you think you already know the codebase.
29
49
  ```
30
50
 
31
51
  ## Agent 2: Best Practices Researcher
@@ -13,9 +13,23 @@ globs: package.json
13
13
 
14
14
  Running `git push` followed immediately by `gh release create` causes a race condition. The release tag gets created on the remote's HEAD before the push fully propagates, pointing to an old commit.
15
15
 
16
+ ## Pre-Release Quality Gate (MANDATORY)
17
+
18
+ Before ANY release, verify the codebase is in a releasable state:
19
+
20
+ 1. **Check outstanding findings**: Read `.workflow/state/last-review.json` — if unresolved critical/high findings exist, STOP and fix them first
21
+ 2. **Run lint** (if configured): `npm run lint`
22
+ 3. **Run typecheck** (if configured): `npm run typecheck`
23
+ 4. **Verify no uncommitted changes**: `git status` should be clean
24
+
25
+ The `preRelease` and `outstandingFindings` quality gates in `flow-done.js` enforce this automatically for `release` type tasks. For manual releases, check these yourself.
26
+
16
27
  ## Correct Procedure
17
28
 
18
29
  ```bash
30
+ # 0. Verify codebase is releasable (pre-release gate)
31
+ # (automated by flow-done.js for release-type tasks)
32
+
19
33
  # 1. Push commits first
20
34
  git push origin master
21
35
 
package/lib/installer.js CHANGED
@@ -1115,8 +1115,12 @@ function createWorkflowStructure(projectRoot, config) {
1115
1115
  // (which use require/module.exports) crash with "require is not defined".
1116
1116
  // Same pattern as scripts/package.json.
1117
1117
  const workflowPkgPath = path.join(workflowDir, 'package.json');
1118
- if (!fs.existsSync(workflowPkgPath)) {
1119
- fs.writeFileSync(workflowPkgPath, JSON.stringify({ type: 'commonjs' }, null, 2) + '\n');
1118
+ try {
1119
+ fs.writeFileSync(workflowPkgPath, JSON.stringify({ type: 'commonjs' }, null, 2) + '\n', { flag: 'wx' });
1120
+ } catch (err) {
1121
+ if (err.code !== 'EEXIST') {
1122
+ throw err;
1123
+ }
1120
1124
  }
1121
1125
 
1122
1126
  // Create config.json using shared defaults with project-specific overrides
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wogiflow",
3
- "version": "1.8.8",
3
+ "version": "1.9.0",
4
4
  "description": "AI-powered development workflow management system with multi-model support",
5
5
  "main": "lib/index.js",
6
6
  "bin": {
@@ -257,18 +257,30 @@ function collectShareableData(config) {
257
257
 
258
258
  /**
259
259
  * Get WogiFlow version from package.json.
260
+ * Uses require.resolve to find the actual wogiflow package, not the host project.
260
261
  * @returns {string}
261
262
  */
262
263
  let _cachedVersion = null;
263
264
  function getWogiFlowVersion() {
264
265
  if (_cachedVersion) return _cachedVersion;
265
266
  try {
266
- const pkgPath = path.join(__dirname, '..', 'package.json');
267
+ const pkgPath = require.resolve('wogiflow/package.json');
267
268
  const pkg = safeJsonParse(pkgPath, {});
268
269
  _cachedVersion = pkg.version || 'unknown';
269
270
  return _cachedVersion;
270
271
  } catch {
271
- _cachedVersion = 'unknown';
272
+ // Fallback: resolve relative to this file (works when running from source repo)
273
+ try {
274
+ const fallbackPath = path.join(__dirname, '..', 'package.json');
275
+ const pkg = safeJsonParse(fallbackPath, {});
276
+ if (pkg.name === 'wogiflow') {
277
+ _cachedVersion = pkg.version || 'unknown';
278
+ } else {
279
+ _cachedVersion = 'unknown';
280
+ }
281
+ } catch {
282
+ _cachedVersion = 'unknown';
283
+ }
272
284
  return _cachedVersion;
273
285
  }
274
286
  }