specweave 0.28.0 → 0.28.3

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 (67) hide show
  1. package/README.md +62 -74
  2. package/dist/plugins/specweave-github/lib/github-client-v2.d.ts +6 -2
  3. package/dist/plugins/specweave-github/lib/github-client-v2.d.ts.map +1 -1
  4. package/dist/plugins/specweave-github/lib/github-client-v2.js +28 -8
  5. package/dist/plugins/specweave-github/lib/github-client-v2.js.map +1 -1
  6. package/dist/plugins/specweave-github/lib/github-feature-sync-cli.d.ts +21 -0
  7. package/dist/plugins/specweave-github/lib/github-feature-sync-cli.d.ts.map +1 -0
  8. package/dist/plugins/specweave-github/lib/github-feature-sync-cli.js +166 -0
  9. package/dist/plugins/specweave-github/lib/github-feature-sync-cli.js.map +1 -0
  10. package/dist/src/core/repo-structure/platform-registry.d.ts.map +1 -1
  11. package/dist/src/core/repo-structure/platform-registry.js +3 -2
  12. package/dist/src/core/repo-structure/platform-registry.js.map +1 -1
  13. package/dist/src/core/repo-structure/prompt-consolidator.d.ts.map +1 -1
  14. package/dist/src/core/repo-structure/prompt-consolidator.js +4 -2
  15. package/dist/src/core/repo-structure/prompt-consolidator.js.map +1 -1
  16. package/dist/src/core/repo-structure/repo-structure-manager.d.ts +1 -1
  17. package/dist/src/core/repo-structure/repo-structure-manager.d.ts.map +1 -1
  18. package/dist/src/core/repo-structure/repo-structure-manager.js +23 -43
  19. package/dist/src/core/repo-structure/repo-structure-manager.js.map +1 -1
  20. package/dist/src/core/sync/label-detector.d.ts.map +1 -1
  21. package/dist/src/core/sync/label-detector.js +22 -9
  22. package/dist/src/core/sync/label-detector.js.map +1 -1
  23. package/dist/src/metrics/calculators/deployment-frequency.d.ts +12 -8
  24. package/dist/src/metrics/calculators/deployment-frequency.d.ts.map +1 -1
  25. package/dist/src/metrics/calculators/deployment-frequency.js +16 -12
  26. package/dist/src/metrics/calculators/deployment-frequency.js.map +1 -1
  27. package/dist/src/metrics/dora-calculator.d.ts +2 -1
  28. package/dist/src/metrics/dora-calculator.d.ts.map +1 -1
  29. package/dist/src/metrics/dora-calculator.js +9 -4
  30. package/dist/src/metrics/dora-calculator.js.map +1 -1
  31. package/dist/src/metrics/github-client.d.ts +12 -0
  32. package/dist/src/metrics/github-client.d.ts.map +1 -1
  33. package/dist/src/metrics/github-client.js +30 -0
  34. package/dist/src/metrics/github-client.js.map +1 -1
  35. package/dist/src/sync/sync-coordinator.d.ts +33 -0
  36. package/dist/src/sync/sync-coordinator.d.ts.map +1 -1
  37. package/dist/src/sync/sync-coordinator.js +203 -2
  38. package/dist/src/sync/sync-coordinator.js.map +1 -1
  39. package/dist/src/utils/auth-helpers.d.ts.map +1 -1
  40. package/dist/src/utils/auth-helpers.js +13 -1
  41. package/dist/src/utils/auth-helpers.js.map +1 -1
  42. package/dist/src/utils/env-file-generator.d.ts +8 -23
  43. package/dist/src/utils/env-file-generator.d.ts.map +1 -1
  44. package/dist/src/utils/env-file-generator.js +31 -71
  45. package/dist/src/utils/env-file-generator.js.map +1 -1
  46. package/package.json +7 -2
  47. package/plugins/specweave/agents/architect/AGENT.md +2 -2
  48. package/plugins/specweave/agents/docs-writer/AGENT.md +2 -2
  49. package/plugins/specweave/agents/pm/AGENT.md +2 -2
  50. package/plugins/specweave/agents/qa-lead/AGENT.md +2 -2
  51. package/plugins/specweave/agents/security/AGENT.md +2 -2
  52. package/plugins/specweave/agents/tdd-orchestrator/AGENT.md +2 -2
  53. package/plugins/specweave/agents/tech-lead/AGENT.md +2 -2
  54. package/plugins/specweave/agents/test-aware-planner/AGENT.md +2 -2
  55. package/plugins/specweave/hooks/hooks.json +10 -0
  56. package/plugins/specweave/hooks/post-increment-completion.sh +84 -0
  57. package/plugins/specweave/hooks/post-increment-planning.sh +114 -7
  58. package/plugins/specweave/hooks/post-metadata-change.sh +18 -0
  59. package/plugins/specweave/lib/hooks/sync-increment-closure.js +66 -0
  60. package/plugins/specweave/lib/hooks/sync-increment-closure.ts +111 -0
  61. package/plugins/specweave-github/lib/github-client-v2.js +32 -8
  62. package/plugins/specweave-github/lib/github-client-v2.ts +31 -9
  63. package/plugins/specweave-github/lib/github-feature-sync-cli.js +135 -0
  64. package/plugins/specweave-github/lib/github-feature-sync-cli.ts +194 -0
  65. package/plugins/specweave-github/skills/github-issue-standard/SKILL.md +43 -0
  66. package/plugins/specweave-infrastructure/agents/devops/AGENT.md +2 -2
  67. package/src/templates/.env.example +9 -26
@@ -1,21 +1,18 @@
1
1
  /**
2
2
  * Environment File Generator
3
3
  *
4
- * Generates .env files with GitHub configuration for sync.
5
- * Handles security (gitignore, permissions) and multi-provider support.
4
+ * Generates minimal .env files containing ONLY secrets (tokens).
5
+ * All configuration is stored in config.json.
6
6
  *
7
- * Features:
8
- * - Auto-generate .env with GitHub config
9
- * - Add .env to .gitignore automatically
10
- * - Create .env.example for team sharing
11
- * - Multi-provider support (GitHub, JIRA, ADO)
7
+ * gh CLI is the recommended authentication method.
8
+ * GITHUB_TOKEN in .env is only needed when gh CLI is not available.
12
9
  *
13
10
  * @module env-file-generator
14
11
  */
15
12
  import * as fs from '../utils/fs-native.js';
16
13
  import path from 'path';
17
14
  /**
18
- * Generate .env file with GitHub configuration
15
+ * Generate .env file with GitHub token (only when gh CLI not available)
19
16
  *
20
17
  * @param projectRoot - Project root directory
21
18
  * @param config - Environment configuration
@@ -38,45 +35,29 @@ export async function generateEnvFile(projectRoot, config) {
38
35
  await updateGitignore(projectRoot);
39
36
  }
40
37
  /**
41
- * Build .env file content
38
+ * Build .env file content (secrets only)
42
39
  *
43
40
  * @param config - Environment configuration
44
41
  * @returns .env content
45
42
  */
46
43
  function buildEnvContent(config) {
47
44
  const lines = [];
48
- lines.push('# GitHub Configuration (Auto-generated by SpecWeave)');
45
+ lines.push('# GitHub Token (Auto-generated by SpecWeave)');
49
46
  lines.push(`# Created: ${new Date().toISOString()}`);
47
+ lines.push('#');
48
+ lines.push('# NOTE: gh CLI authentication is recommended over tokens.');
49
+ lines.push('# Run: gh auth login');
50
+ lines.push('# This file is only needed if gh CLI is not available.');
50
51
  lines.push('');
51
- // GitHub token
52
+ // GitHub token - the ONLY secret
52
53
  if (config.githubToken) {
53
54
  lines.push(`GITHUB_TOKEN=${config.githubToken}`);
54
55
  }
55
56
  else {
56
57
  lines.push('GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxx');
57
58
  }
58
- // GitHub owner
59
- if (config.githubOwner) {
60
- lines.push(`GITHUB_OWNER=${config.githubOwner}`);
61
- }
62
- else {
63
- lines.push('GITHUB_OWNER=myorg');
64
- }
65
- lines.push('');
66
- lines.push('# Repository Mapping (id:repo-name)');
67
- // Repos
68
- if (config.repos && config.repos.length > 0) {
69
- const repoMappings = config.repos.map(r => `${r.id}:${r.repo}`).join(',');
70
- lines.push(`GITHUB_REPOS=${repoMappings}`);
71
- }
72
- else {
73
- lines.push('GITHUB_REPOS=parent:my-project-parent,frontend:my-project-frontend,backend:my-project-backend');
74
- }
75
59
  lines.push('');
76
- lines.push('# Sync Configuration');
77
- lines.push(`GITHUB_SYNC_ENABLED=${config.syncEnabled !== false ? 'true' : 'false'}`);
78
- lines.push(`GITHUB_AUTO_CREATE_ISSUE=${config.autoCreateIssue !== false ? 'true' : 'false'}`);
79
- lines.push(`GITHUB_SYNC_DIRECTION=${config.syncDirection || 'bidirectional'}`);
60
+ lines.push('# All other configuration is in .specweave/config.json');
80
61
  return lines.join('\n') + '\n';
81
62
  }
82
63
  /**
@@ -87,21 +68,19 @@ function buildEnvContent(config) {
87
68
  function buildEnvExampleContent() {
88
69
  const lines = [];
89
70
  lines.push('# GitHub Configuration');
90
- lines.push('# Copy this file to .env and fill in your values');
71
+ lines.push('#');
72
+ lines.push('# RECOMMENDED: Use gh CLI instead of tokens');
73
+ lines.push('# gh auth login');
74
+ lines.push('#');
75
+ lines.push('# Only use this file if gh CLI is not available.');
76
+ lines.push('# Copy to .env and fill in your token.');
91
77
  lines.push('');
92
- lines.push('# GitHub Personal Access Token (get from https://github.com/settings/tokens)');
78
+ lines.push('# GitHub Personal Access Token');
79
+ lines.push('# Get from: https://github.com/settings/tokens');
80
+ lines.push('# Scopes: repo, read:org');
93
81
  lines.push('GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxx');
94
82
  lines.push('');
95
- lines.push('# GitHub owner (user or organization)');
96
- lines.push('GITHUB_OWNER=your-username-or-org');
97
- lines.push('');
98
- lines.push('# Repository Mapping (id:repo-name,id:repo-name,...)');
99
- lines.push('GITHUB_REPOS=parent:my-project-parent,frontend:my-project-frontend,backend:my-project-backend');
100
- lines.push('');
101
- lines.push('# Sync Configuration');
102
- lines.push('GITHUB_SYNC_ENABLED=true');
103
- lines.push('GITHUB_AUTO_CREATE_ISSUE=true');
104
- lines.push('GITHUB_SYNC_DIRECTION=bidirectional');
83
+ lines.push('# All other configuration is in .specweave/config.json');
105
84
  return lines.join('\n') + '\n';
106
85
  }
107
86
  /**
@@ -145,10 +124,10 @@ export async function envFileExists(projectRoot) {
145
124
  return fs.pathExists(envPath);
146
125
  }
147
126
  /**
148
- * Load configuration from .env file
127
+ * Load GitHub token from .env file
149
128
  *
150
129
  * @param projectRoot - Project root directory
151
- * @returns Environment configuration
130
+ * @returns GitHub token or null
152
131
  */
153
132
  export async function loadEnvConfig(projectRoot) {
154
133
  const envPath = path.join(projectRoot, '.env');
@@ -163,32 +142,13 @@ export async function loadEnvConfig(projectRoot) {
163
142
  if (trimmed.startsWith('#') || !trimmed) {
164
143
  continue;
165
144
  }
166
- const [key, value] = trimmed.split('=');
167
- if (!key || !value) {
145
+ const eqIndex = trimmed.indexOf('=');
146
+ if (eqIndex === -1)
168
147
  continue;
169
- }
170
- switch (key.trim()) {
171
- case 'GITHUB_TOKEN':
172
- config.githubToken = value.trim();
173
- break;
174
- case 'GITHUB_OWNER':
175
- config.githubOwner = value.trim();
176
- break;
177
- case 'GITHUB_REPOS':
178
- config.repos = value.trim().split(',').map(mapping => {
179
- const [id, repo] = mapping.split(':');
180
- return { id: id.trim(), repo: repo.trim() };
181
- });
182
- break;
183
- case 'GITHUB_SYNC_ENABLED':
184
- config.syncEnabled = value.trim() === 'true';
185
- break;
186
- case 'GITHUB_AUTO_CREATE_ISSUE':
187
- config.autoCreateIssue = value.trim() === 'true';
188
- break;
189
- case 'GITHUB_SYNC_DIRECTION':
190
- config.syncDirection = value.trim();
191
- break;
148
+ const key = trimmed.slice(0, eqIndex).trim();
149
+ const value = trimmed.slice(eqIndex + 1).trim();
150
+ if (key === 'GITHUB_TOKEN') {
151
+ config.githubToken = value;
192
152
  }
193
153
  }
194
154
  return config;
@@ -1 +1 @@
1
- {"version":3,"file":"env-file-generator.js","sourceRoot":"","sources":["../../../src/utils/env-file-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,IAAI,MAAM,MAAM,CAAC;AAsBxB;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,WAAmB,EACnB,MAAiB;IAEjB,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IAC/C,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;IAE9D,qBAAqB;IACrB,MAAM,OAAO,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IACxC,MAAM,cAAc,GAAG,sBAAsB,EAAE,CAAC;IAEhD,kBAAkB;IAClB,MAAM,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAE9C,iDAAiD;IACjD,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACjC,MAAM,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACjC,CAAC;IAED,qBAAqB;IACrB,MAAM,EAAE,CAAC,SAAS,CAAC,cAAc,EAAE,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": "specweave",
3
- "version": "0.28.0",
3
+ "version": "0.28.3",
4
4
  "description": "Spec-driven development framework for Claude Code. AI-native workflow with living documentation, intelligent agents, and multilingual support (9 languages). Enterprise-grade traceability with permanent specs and temporary increments.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -34,7 +34,12 @@
34
34
  "docs:build": "cd docs-site && npm run build",
35
35
  "docs:install": "cd docs-site && npm install --legacy-peer-deps",
36
36
  "docs:internal": "mkdocs serve -f docs-site/mkdocs-internal.yml",
37
- "docs:internal:build": "mkdocs build -f docs-site/mkdocs-internal.yml"
37
+ "docs:internal:build": "mkdocs build -f docs-site/mkdocs-internal.yml",
38
+ "release:patch": "bash scripts/bump-version.sh patch",
39
+ "release:minor": "bash scripts/bump-version.sh minor",
40
+ "release:major": "bash scripts/bump-version.sh major",
41
+ "release": "bash scripts/bump-version.sh",
42
+ "setup:hooks": "bash scripts/install-git-hooks.sh"
38
43
  },
39
44
  "keywords": [
40
45
  "specweave",
@@ -2,8 +2,8 @@
2
2
  name: architect
3
3
  description: System Architect and technical design expert. Creates system architecture, technical specifications, Architecture Decision Records (ADRs), component designs, API contracts, data models, and deployment architectures. Handles design patterns, scalability planning, technology stack decisions, microservices architecture, event-driven systems, CQRS, domain-driven design. Activates for: architecture, system design, technical design, ADR, architecture decision record, design patterns, microservices, API design, data model, database schema, scalability, performance architecture, technology stack, tech stack selection, distributed systems, event-driven, CQRS, DDD, domain model, component architecture, integration patterns, CAP theorem, consistency, availability, partition tolerance.
4
4
  tools: Read, Write, Edit
5
- model: claude-sonnet-4-5-20250929
6
- model_preference: sonnet
5
+ model: claude-opus-4-5-20251101
6
+ model_preference: opus
7
7
  cost_profile: planning
8
8
  fallback_behavior: strict
9
9
  max_response_tokens: 2000
@@ -2,8 +2,8 @@
2
2
  name: docs-writer
3
3
  description: Technical documentation writer that generates docs ONE SECTION AT A TIME (Installation → Usage → API → Examples) to prevent crashes. Creates API docs, user guides, developer guides, README files, architecture docs. **CRITICAL CHUNKING RULE - Prevents 3000+ line doc crashes.** Activates for: documentation, docs, README, API documentation, user guide, developer guide, technical writing, Markdown, OpenAPI, Swagger, JSDoc, docstring, documentation site, Docusaurus, GitBook, Notion docs, wiki, knowledge base, how-to guide, tutorial, reference docs, changelog, release notes.
4
4
  tools: Read, Write, Edit
5
- model: claude-haiku-4-5-20251001
6
- model_preference: auto
5
+ model: claude-opus-4-5-20251101
6
+ model_preference: opus
7
7
  cost_profile: hybrid
8
8
  fallback_behavior: auto
9
9
  max_response_tokens: 2000
@@ -2,8 +2,8 @@
2
2
  name: pm
3
3
  description: Product Manager AI agent that works in PHASES (Research → Spec → Architect → Plan → Validate) to prevent crashes. Creates product strategy, requirements, user stories, prioritization. **CRITICAL CHUNKING RULE - Large specs (6+ US) generated in chunks.** Activates for product planning, roadmap creation, requirement analysis, user research, business case development. Keywords: product strategy, chunked planning, user stories, requirements, roadmap, prioritization, MVP, feature planning, stakeholders, business case, product vision, RICE, MoSCoW, Kano, product-market fit.
4
4
  tools: Read, Write, Grep, Glob
5
- model: claude-sonnet-4-5-20250929
6
- model_preference: sonnet
5
+ model: claude-opus-4-5-20251101
6
+ model_preference: opus
7
7
  cost_profile: planning
8
8
  fallback_behavior: strict
9
9
  max_response_tokens: 2000
@@ -2,8 +2,8 @@
2
2
  name: qa-lead
3
3
  description: QA Lead that creates test suites ONE FILE AT A TIME to prevent crashes. Handles test plans, test cases, testing strategies, quality gates. **CRITICAL CHUNKING RULE - Large test suites (15 files) done incrementally.** Activates for: QA, quality assurance, testing, test strategy, test plan, test cases, unit tests, integration tests, E2E tests, end-to-end testing, Playwright, Jest, Mocha, Cypress, test automation, test coverage, regression, test-driven development, TDD, BDD, behavior-driven development, quality gates, acceptance criteria, test data, test scenarios, smoke tests, sanity tests, exploratory testing.
4
4
  tools: Read, Write, Edit, Bash
5
- model: claude-sonnet-4-5-20250929
6
- model_preference: haiku
5
+ model: claude-opus-4-5-20251101
6
+ model_preference: opus
7
7
  cost_profile: execution
8
8
  fallback_behavior: flexible
9
9
  max_response_tokens: 2000
@@ -2,8 +2,8 @@
2
2
  name: security
3
3
  description: Security Engineer and application security expert. Performs threat modeling, security architecture review, penetration testing, vulnerability assessment, and security compliance. Handles OWASP Top 10, authentication security, authorization, encryption, secrets management, HTTPS/TLS, CORS, CSRF, XSS, SQL injection prevention, secure coding practices, security audits, and compliance (GDPR, HIPAA, PCI-DSS, SOC 2). Activates for: security, security review, threat model, vulnerability, penetration testing, pen test, OWASP, authentication security, authorization, encryption, secrets, HTTPS, TLS, SSL, CORS, CSRF, XSS, SQL injection, secure coding, security audit, compliance, GDPR, HIPAA, PCI-DSS, SOC 2, security architecture, secrets management, rate limiting, brute force protection, session security, token security, JWT security.
4
4
  tools: Read, Bash, Grep
5
- model: claude-sonnet-4-5-20250929
6
- model_preference: sonnet
5
+ model: claude-opus-4-5-20251101
6
+ model_preference: opus
7
7
  cost_profile: planning
8
8
  fallback_behavior: strict
9
9
  max_response_tokens: 2000
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  name: tdd-orchestrator
3
3
  description: Master TDD orchestrator specializing in red-green-refactor discipline, multi-agent workflow coordination, and comprehensive test-driven development practices. Enforces TDD best practices across teams with AI-assisted testing and modern frameworks. Use PROACTIVELY for TDD implementation and governance.
4
- model: claude-sonnet-4-5-20250929
5
- model_preference: haiku
4
+ model: claude-opus-4-5-20251101
5
+ model_preference: opus
6
6
  cost_profile: execution
7
7
  fallback_behavior: flexible
8
8
  max_response_tokens: 2000
@@ -2,8 +2,8 @@
2
2
  name: tech-lead
3
3
  description: Technical Lead that implements code ONE FILE AT A TIME to prevent crashes. Handles code review, best practices, mentorship, implementation planning. **CRITICAL CHUNKING RULE - Large implementations (auth system = auth.ts + tests + middleware) done incrementally.** Activates for: tech lead, code review, best practices, refactoring, technical debt, code quality, design patterns, SOLID principles, clean code, code standards, implementation plan, technical guidance, mentorship, code optimization, complexity analysis, technical planning, estimation, implementation strategy, code architecture.
4
4
  tools: Read, Write, Edit, Bash
5
- model: claude-sonnet-4-5-20250929
6
- model_preference: haiku
5
+ model: claude-opus-4-5-20251101
6
+ model_preference: opus
7
7
  cost_profile: execution
8
8
  fallback_behavior: flexible
9
9
  max_response_tokens: 2000
@@ -2,8 +2,8 @@
2
2
  name: test-aware-planner
3
3
  description: Test-Aware Planning agent that generates tasks.md **ONE USER STORY AT A TIME** with embedded test plans. **CRITICAL CHUNKING RULE - Prevents crashes.** Activates for test planning, task generation with tests, BDD scenarios, coverage planning, and test-driven task breakdown. Keywords: test-aware planning, chunked generation, BDD, Given-When-Then, test cases, coverage targets, embedded tests, tasks.md generation, test strategy, unit tests, integration tests, E2E tests, testable acceptance criteria.
4
4
  tools: Read, Write, Grep, Glob, Edit
5
- model: claude-sonnet-4-5-20250929
6
- model_preference: sonnet
5
+ model: claude-opus-4-5-20251101
6
+ model_preference: opus
7
7
  cost_profile: planning
8
8
  fallback_behavior: strict
9
9
  max_response_tokens: 2000
@@ -34,6 +34,16 @@
34
34
  "command": "${CLAUDE_PLUGIN_ROOT}/hooks/post-task-edit.sh"
35
35
  }
36
36
  ]
37
+ },
38
+ {
39
+ "matcher": "Edit|Write",
40
+ "matcher_content": "\\.specweave/increments/[0-9]{4}-.+/metadata\\.json",
41
+ "hooks": [
42
+ {
43
+ "type": "command",
44
+ "command": "${CLAUDE_PLUGIN_ROOT}/hooks/post-metadata-change.sh"
45
+ }
46
+ ]
37
47
  }
38
48
  ]
39
49
  }
@@ -366,4 +366,88 @@ else
366
366
  echo ""
367
367
  fi
368
368
 
369
+ # ============================================================================
370
+ # GITHUB ISSUE CLOSURE (v0.28.1 - CRITICAL FIX)
371
+ # ============================================================================
372
+ # After creating/syncing GitHub issues, close User Story issues for this increment.
373
+ # This was the MISSING feature causing issues to stay open indefinitely.
374
+ #
375
+ # WHY THIS IS SEPARATE FROM consolidated-sync.js:
376
+ # - consolidated-sync.js handles task-level sync (called by post-task-completion too)
377
+ # - sync-increment-closure.js ONLY runs on increment completion
378
+ # - Closing issues is a DESTRUCTIVE operation that should only happen once
379
+ #
380
+ # GATE CHECK: All gates are checked inside sync-increment-closure.js
381
+ # - canUpdateExternalItems must be true
382
+ # - autoSyncOnCompletion must be true
383
+ # - sync.github.enabled must be true
384
+ #
385
+ # See: Root cause analysis - User Story issues created but never closed
386
+
387
+ if command -v node &> /dev/null; then
388
+ echo ""
389
+ echo "🔒 Closing GitHub issues for completed user stories..."
390
+
391
+ # ========================================================================
392
+ # LOCATE CLOSURE SYNC SCRIPT
393
+ # ========================================================================
394
+ # Find sync-increment-closure.js in order of preference:
395
+ # 1. In-place compiled (development, esbuild output)
396
+ # 2. Local dist (development, tsc output)
397
+ # 3. node_modules (installed as dependency) ← USER PROJECTS
398
+ # 4. Plugin marketplace (Claude Code global installation)
399
+
400
+ CLOSURE_SCRIPT=""
401
+ if [ -f "$PROJECT_ROOT/plugins/specweave/lib/hooks/sync-increment-closure.js" ]; then
402
+ # Development: Use in-place compiled hooks (esbuild, not tsc)
403
+ CLOSURE_SCRIPT="$PROJECT_ROOT/plugins/specweave/lib/hooks/sync-increment-closure.js"
404
+ echo " 🔧 Using in-place compiled hook (development mode)"
405
+ elif [ -f "$PROJECT_ROOT/dist/plugins/specweave/lib/hooks/sync-increment-closure.js" ]; then
406
+ # Development: Use project's compiled files (has node_modules)
407
+ CLOSURE_SCRIPT="$PROJECT_ROOT/dist/plugins/specweave/lib/hooks/sync-increment-closure.js"
408
+ echo " 🔧 Using local dist (development mode)"
409
+ elif [ -f "$PROJECT_ROOT/node_modules/specweave/dist/plugins/specweave/lib/hooks/sync-increment-closure.js" ]; then
410
+ # Installed as dependency: Use node_modules version (MOST USER PROJECTS)
411
+ CLOSURE_SCRIPT="$PROJECT_ROOT/node_modules/specweave/dist/plugins/specweave/lib/hooks/sync-increment-closure.js"
412
+ echo " đŸ“Ļ Using node_modules version"
413
+ elif [ -n "${CLAUDE_PLUGIN_ROOT}" ] && [ -f "${CLAUDE_PLUGIN_ROOT}/lib/hooks/sync-increment-closure.js" ]; then
414
+ # Fallback: Plugin marketplace (may fail if deps missing)
415
+ CLOSURE_SCRIPT="${CLAUDE_PLUGIN_ROOT}/lib/hooks/sync-increment-closure.js"
416
+ echo " 🌐 Using plugin marketplace version"
417
+ fi
418
+
419
+ # ========================================================================
420
+ # EXECUTE CLOSURE SYNC
421
+ # ========================================================================
422
+ # Run closure sync to close all User Story GitHub issues.
423
+ # Non-blocking: Errors logged but don't crash hook (increment already closed)
424
+
425
+ if [ -n "$CLOSURE_SCRIPT" ]; then
426
+ # Ensure GITHUB_TOKEN is available (may have been set earlier)
427
+ if [ -z "$GITHUB_TOKEN" ] && [ -f "$PROJECT_ROOT/.env" ]; then
428
+ GITHUB_TOKEN_FROM_ENV=$(grep -E '^GITHUB_TOKEN=' "$PROJECT_ROOT/.env" 2>/dev/null | head -1 | cut -d'=' -f2- | sed 's/^["'\'']//' | sed 's/["'\'']$//')
429
+ if [ -n "$GITHUB_TOKEN_FROM_ENV" ]; then
430
+ export GITHUB_TOKEN="$GITHUB_TOKEN_FROM_ENV"
431
+ fi
432
+ fi
433
+
434
+ # Run closure sync (synchronous - user sees immediate feedback)
435
+ if (cd "$PROJECT_ROOT" && node "$CLOSURE_SCRIPT" "$INCREMENT_ID") 2>&1; then
436
+ echo " ✅ GitHub issue closure complete"
437
+ echo ""
438
+ else
439
+ echo " âš ī¸ Failed to close GitHub issues (non-blocking - you can close manually)" >&2
440
+ echo ""
441
+ fi
442
+ else
443
+ echo " âš ī¸ sync-increment-closure.js not found in any location - skipping issue closure" >&2
444
+ echo " 💡 User Story GitHub issues may remain open until manually closed" >&2
445
+ echo ""
446
+ fi
447
+ else
448
+ echo ""
449
+ echo " âš ī¸ Node.js not found - skipping GitHub issue closure" >&2
450
+ echo ""
451
+ fi
452
+
369
453
  exit 0
@@ -896,8 +896,12 @@ EOF_MINIMAL
896
896
  local spec_md_path="$increment_dir/spec.md"
897
897
 
898
898
  if [ -f "$spec_md_path" ]; then
899
+ # Extract feature ID from multiple possible frontmatter fields:
900
+ # - epic: (preferred)
901
+ # - feature_id:
902
+ # - feature:
899
903
  FEATURE_ID=$(awk '
900
- BEGIN { in_frontmatter=0 }
904
+ BEGIN { in_frontmatter=0; feature_id="" }
901
905
  /^---$/ {
902
906
  if (in_frontmatter == 0) {
903
907
  in_frontmatter=1; next
@@ -908,15 +912,32 @@ EOF_MINIMAL
908
912
  in_frontmatter == 1 && /^epic:/ {
909
913
  gsub(/^epic:[ \t]*/, "");
910
914
  gsub(/["'\'']/, "");
911
- print;
912
- exit
915
+ feature_id = $0;
913
916
  }
917
+ in_frontmatter == 1 && /^feature_id:/ {
918
+ gsub(/^feature_id:[ \t]*/, "");
919
+ gsub(/["'\'']/, "");
920
+ if (feature_id == "") feature_id = $0;
921
+ }
922
+ in_frontmatter == 1 && /^feature:/ {
923
+ gsub(/^feature:[ \t]*/, "");
924
+ gsub(/["'\'']/, "");
925
+ if (feature_id == "") feature_id = $0;
926
+ }
927
+ END { print feature_id }
914
928
  ' "$spec_md_path" | tr -d '\r\n')
915
929
 
916
930
  if [ -n "$FEATURE_ID" ]; then
917
931
  log_debug " 📎 Extracted feature ID: $FEATURE_ID"
918
932
  else
919
- log_debug " âš ī¸ No epic field in spec.md, sync will auto-generate ID"
933
+ # AUTO-GENERATE feature ID from increment number (NEW - ADR-0139)
934
+ local increment_num=$(echo "$increment_id" | grep -oE '^[0-9]+')
935
+ if [ -n "$increment_num" ]; then
936
+ FEATURE_ID="FS-${increment_num}"
937
+ log_info " 📝 Auto-generated feature ID: $FEATURE_ID (no epic/feature_id in spec.md)"
938
+ else
939
+ log_debug " âš ī¸ No feature ID found and could not auto-generate"
940
+ fi
920
941
  fi
921
942
  fi
922
943
 
@@ -979,10 +1000,96 @@ EOF_MINIMAL
979
1000
  fi
980
1001
  fi
981
1002
 
982
- # Note: Spec-level sync (SPECS → GitHub Projects/JIRA Epics) is handled separately
983
- # See: /specweave-github:sync-spec, /specweave-jira:sync-spec, /specweave-ado:sync-spec
1003
+ # ============================================================================
1004
+ # STEP 8: EXPLICIT GITHUB ISSUE CREATION (NEW - ADR-0139)
1005
+ # ============================================================================
1006
+ # After living docs are created, explicitly create GitHub issues for User Stories.
1007
+ # This ensures GitHub issues are created even if sync-living-docs.js gates fail.
1008
+ #
1009
+ # Why this is needed:
1010
+ # - sync-living-docs.js has 5 config gates that can silently skip GitHub sync
1011
+ # - Living docs exist but GitHub issues might not be created
1012
+ # - User expects GitHub issues after /specweave:increment
1013
+ #
1014
+ # Retry mechanism: 2 attempts with 3 second delay
1015
+ # ============================================================================
1016
+
1017
+ log_info ""
1018
+ log_info "🐙 Creating GitHub issues for User Stories..."
1019
+
1020
+ # Check if GitHub is enabled
1021
+ local github_enabled=$(cat "$CONFIG_FILE" 2>/dev/null | grep -A 5 '"github"' | grep -o '"enabled"[[:space:]]*:[[:space:]]*\(true\|false\)' | head -1 | grep -o '\(true\|false\)' || echo "false")
1022
+
1023
+ if [ "$github_enabled" = "true" ] && [ -n "$FEATURE_ID" ]; then
1024
+ # Find the GitHub feature sync script
1025
+ # Priority: dist/ first (compiled with correct imports), then marketplace
1026
+ local GITHUB_SYNC_SCRIPT=""
1027
+ if [ -f "$PROJECT_ROOT/dist/plugins/specweave-github/lib/github-feature-sync-cli.js" ]; then
1028
+ # Prefer dist/ (compiled with correct imports)
1029
+ GITHUB_SYNC_SCRIPT="$PROJECT_ROOT/dist/plugins/specweave-github/lib/github-feature-sync-cli.js"
1030
+ elif [ -n "${CLAUDE_PLUGIN_ROOT}" ]; then
1031
+ # Try specweave-github plugin path (marketplace)
1032
+ local github_plugin_root="${CLAUDE_PLUGIN_ROOT/specweave/specweave-github}"
1033
+ if [ -f "$github_plugin_root/lib/github-feature-sync-cli.js" ]; then
1034
+ GITHUB_SYNC_SCRIPT="$github_plugin_root/lib/github-feature-sync-cli.js"
1035
+ fi
1036
+ elif [ -f "$PROJECT_ROOT/node_modules/specweave/dist/plugins/specweave-github/lib/github-feature-sync-cli.js" ]; then
1037
+ # Try node_modules (npm install)
1038
+ GITHUB_SYNC_SCRIPT="$PROJECT_ROOT/node_modules/specweave/dist/plugins/specweave-github/lib/github-feature-sync-cli.js"
1039
+ fi
1040
+
1041
+ if [ -n "$GITHUB_SYNC_SCRIPT" ]; then
1042
+ log_info " 🔄 Syncing $FEATURE_ID to GitHub..."
1043
+
1044
+ # Load GitHub token
1045
+ local GITHUB_TOKEN=""
1046
+ if [ -f "$PROJECT_ROOT/.env" ]; then
1047
+ GITHUB_TOKEN=$(grep -E '^GITHUB_TOKEN=' "$PROJECT_ROOT/.env" 2>/dev/null | head -1 | cut -d'=' -f2- | sed 's/^["'\'']//' | sed 's/["'\'']$//')
1048
+ fi
1049
+
1050
+ if [ -z "$GITHUB_TOKEN" ]; then
1051
+ log_info " âš ī¸ GITHUB_TOKEN not found in .env - skipping GitHub sync"
1052
+ log_info " 💡 To enable: Add GITHUB_TOKEN=ghp_xxx to .env"
1053
+ else
1054
+ # Retry mechanism: 2 attempts
1055
+ local github_sync_success=false
1056
+ local max_attempts=2
1057
+
1058
+ for attempt in $(seq 1 $max_attempts); do
1059
+ log_debug " GitHub sync attempt $attempt of $max_attempts..."
1060
+
1061
+ if GITHUB_TOKEN="$GITHUB_TOKEN" node "$GITHUB_SYNC_SCRIPT" "$FEATURE_ID" 2>&1 | \
1062
+ grep -E "✅|❌|âš ī¸|📝|đŸŽ¯|Issue|Milestone" | while read -r line; do echo " $line"; done; then
1063
+ github_sync_success=true
1064
+ break
1065
+ else
1066
+ if [ "$attempt" -lt "$max_attempts" ]; then
1067
+ log_info " âš ī¸ Attempt $attempt failed, retrying in 3 seconds..."
1068
+ sleep 3
1069
+ fi
1070
+ fi
1071
+ done
1072
+
1073
+ if [ "$github_sync_success" = "true" ]; then
1074
+ log_info " ✅ GitHub issues created successfully!"
1075
+ else
1076
+ log_info " âš ī¸ GitHub sync failed after $max_attempts attempts (non-blocking)"
1077
+ log_info " 💡 Run /specweave-github:sync $FEATURE_ID manually to retry"
1078
+ fi
1079
+ fi
1080
+ else
1081
+ log_debug " GitHub sync script not found"
1082
+ log_info " â„šī¸ GitHub sync will be handled by living docs sync"
1083
+ fi
1084
+ elif [ "$github_enabled" != "true" ]; then
1085
+ log_info " â„šī¸ GitHub sync disabled (sync.github.enabled = false)"
1086
+ log_info " 💡 To enable: Set sync.github.enabled = true in config.json"
1087
+ elif [ -z "$FEATURE_ID" ]; then
1088
+ log_info " âš ī¸ No feature ID - GitHub issues cannot be created"
1089
+ log_info " 💡 Add epic: FS-XXX or feature_id: FS-XXX to spec.md frontmatter"
1090
+ fi
984
1091
 
985
- # 8. Sync spec content to external tools (if configured)
1092
+ # 9. Sync spec content to external tools (if configured)
986
1093
  log_info ""
987
1094
  log_info "🔗 Checking spec content sync..."
988
1095
 
@@ -61,6 +61,24 @@ fi
61
61
  # Ensure logs directory exists
62
62
  mkdir -p "$LOGS_DIR" 2>/dev/null || true
63
63
 
64
+ # ============================================================================
65
+ # CREATE RECURSION GUARD (v0.28.2 - CRITICAL FIX)
66
+ # ============================================================================
67
+ # PROBLEM FIXED: Guard was only created in post-increment-completion.sh, but
68
+ # post-increment-status-change.sh had NO guard protection.
69
+ #
70
+ # SOLUTION: Create guard here in the dispatcher so ALL dispatches are protected.
71
+ # The sub-hooks (post-increment-completion.sh, post-increment-status-change.sh)
72
+ # will see this guard and exit early if they're called recursively.
73
+ #
74
+ # This prevents infinite loops if any sync operation modifies metadata.json.
75
+
76
+ mkdir -p "$PROJECT_ROOT/.specweave/state" 2>/dev/null || true
77
+ touch "$RECURSION_GUARD_FILE"
78
+
79
+ # Ensure guard file is ALWAYS removed when script exits (even on error)
80
+ trap 'rm -f "$RECURSION_GUARD_FILE" 2>/dev/null || true' EXIT SIGINT SIGTERM
81
+
64
82
  # ============================================================================
65
83
  # READ STDIN (v0.26.1 - CRITICAL FIX)
66
84
  # ============================================================================