specweave 0.8.18 → 0.8.19

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.
@@ -0,0 +1,256 @@
1
+ /**
2
+ * Smart Jira Setup Wizard
3
+ *
4
+ * Intelligent credential detection and setup flow:
5
+ * 1. Check .env for credentials (uses credentialsManager)
6
+ * 2. Interactive prompt only if missing
7
+ * 3. Never ask twice for same credentials
8
+ */
9
+
10
+ import inquirer from 'inquirer';
11
+ import { credentialsManager, JiraCredentials } from '../../../src/core/credentials-manager.js';
12
+
13
+ // ============================================================================
14
+ // Types
15
+ // ============================================================================
16
+
17
+ export { JiraCredentials } from '../../../src/core/credentials-manager.js';
18
+
19
+ export interface CredentialDetectionResult {
20
+ found: boolean;
21
+ credentials?: JiraCredentials;
22
+ source?: 'env' | 'interactive';
23
+ }
24
+
25
+ // ============================================================================
26
+ // Credential Detection
27
+ // ============================================================================
28
+
29
+ /**
30
+ * Smart credential detection - uses existing credentialsManager
31
+ */
32
+ export async function detectJiraCredentials(): Promise<CredentialDetectionResult> {
33
+ if (credentialsManager.hasJiraCredentials()) {
34
+ try {
35
+ const credentials = credentialsManager.getJiraCredentials();
36
+ console.log('āœ… Found Jira credentials in .env');
37
+ return {
38
+ found: true,
39
+ credentials,
40
+ source: 'env',
41
+ };
42
+ } catch (error) {
43
+ // Credentials exist but invalid format
44
+ return { found: false };
45
+ }
46
+ }
47
+
48
+ return { found: false };
49
+ }
50
+
51
+ // ============================================================================
52
+ // Interactive Setup
53
+ // ============================================================================
54
+
55
+ /**
56
+ * Interactive Jira credential setup
57
+ * Only runs if credentials not found
58
+ */
59
+ export async function setupJiraCredentials(): Promise<JiraCredentials> {
60
+ console.log('\nšŸ”§ Jira Setup Wizard\n');
61
+
62
+ // Check for existing credentials first
63
+ const detected = await detectJiraCredentials();
64
+
65
+ if (detected.found) {
66
+ // Ask user if they want to use existing or re-enter
67
+ const { useExisting } = await inquirer.prompt([
68
+ {
69
+ type: 'confirm',
70
+ name: 'useExisting',
71
+ message: `Found credentials in ${detected.source}. Use these credentials?`,
72
+ default: true,
73
+ },
74
+ ]);
75
+
76
+ if (useExisting) {
77
+ return detected.credentials!;
78
+ }
79
+
80
+ console.log('\nšŸ“ Enter new credentials:\n');
81
+ } else {
82
+ console.log('āš ļø No Jira credentials found\n');
83
+ console.log('šŸ“ Let\'s set up your Jira connection:\n');
84
+ }
85
+
86
+ // Interactive credential entry
87
+ const answers = await inquirer.prompt([
88
+ {
89
+ type: 'list',
90
+ name: 'setupType',
91
+ message: 'How would you like to connect to Jira?',
92
+ choices: [
93
+ {
94
+ name: 'Cloud (*.atlassian.net)',
95
+ value: 'cloud',
96
+ },
97
+ {
98
+ name: 'Server/Data Center (self-hosted)',
99
+ value: 'server',
100
+ },
101
+ ],
102
+ },
103
+ {
104
+ type: 'input',
105
+ name: 'domain',
106
+ message: (answers: any) =>
107
+ answers.setupType === 'cloud'
108
+ ? 'Jira domain (e.g., mycompany.atlassian.net):'
109
+ : 'Jira server URL (e.g., jira.mycompany.com):',
110
+ validate: (value: string) => {
111
+ if (!value) return 'Domain is required';
112
+ if (answers.setupType === 'cloud' && !value.includes('.atlassian.net')) {
113
+ return 'Cloud domain must end with .atlassian.net';
114
+ }
115
+ return true;
116
+ },
117
+ },
118
+ {
119
+ type: 'input',
120
+ name: 'email',
121
+ message: 'Email address:',
122
+ validate: (value: string) => {
123
+ if (!value) return 'Email is required';
124
+ if (!value.includes('@')) return 'Must be a valid email';
125
+ return true;
126
+ },
127
+ },
128
+ {
129
+ type: 'password',
130
+ name: 'apiToken',
131
+ message: 'API token:',
132
+ mask: '*',
133
+ validate: (value: string) => {
134
+ if (!value) return 'API token is required';
135
+ if (value.length < 10) return 'API token seems too short';
136
+ return true;
137
+ },
138
+ },
139
+ ]);
140
+
141
+ const credentials: JiraCredentials = {
142
+ domain: answers.domain,
143
+ email: answers.email,
144
+ apiToken: answers.apiToken,
145
+ };
146
+
147
+ // Test connection
148
+ console.log('\nšŸ” Testing connection...');
149
+ const isValid = await testJiraConnection(credentials);
150
+
151
+ if (!isValid) {
152
+ console.log('āŒ Failed to connect to Jira');
153
+ console.log('šŸ’” Please check your credentials and try again\n');
154
+
155
+ const { retry } = await inquirer.prompt([
156
+ {
157
+ type: 'confirm',
158
+ name: 'retry',
159
+ message: 'Would you like to try again?',
160
+ default: true,
161
+ },
162
+ ]);
163
+
164
+ if (retry) {
165
+ return setupJiraCredentials();
166
+ }
167
+
168
+ throw new Error('Jira connection failed');
169
+ }
170
+
171
+ console.log('āœ… Connection successful!\n');
172
+
173
+ // Save to .env using credentialsManager
174
+ await saveCredentialsToEnv(credentials);
175
+
176
+ return credentials;
177
+ }
178
+
179
+ /**
180
+ * Test Jira connection with credentials
181
+ */
182
+ async function testJiraConnection(credentials: JiraCredentials): Promise<boolean> {
183
+ try {
184
+ const https = await import('https');
185
+
186
+ const auth = Buffer.from(`${credentials.email}:${credentials.apiToken}`).toString('base64');
187
+
188
+ return new Promise((resolve) => {
189
+ const req = https.request(
190
+ {
191
+ hostname: credentials.domain,
192
+ path: '/rest/api/3/myself',
193
+ method: 'GET',
194
+ headers: {
195
+ Authorization: `Basic ${auth}`,
196
+ 'Content-Type': 'application/json',
197
+ },
198
+ },
199
+ (res) => {
200
+ resolve(res.statusCode === 200);
201
+ }
202
+ );
203
+
204
+ req.on('error', () => resolve(false));
205
+ req.setTimeout(5000, () => {
206
+ req.destroy();
207
+ resolve(false);
208
+ });
209
+ req.end();
210
+ });
211
+ } catch (error) {
212
+ return false;
213
+ }
214
+ }
215
+
216
+ /**
217
+ * Save credentials to .env using credentialsManager
218
+ */
219
+ async function saveCredentialsToEnv(credentials: JiraCredentials): Promise<void> {
220
+ console.log('šŸ’” Save credentials to .env for future use\n');
221
+
222
+ const { saveToEnv } = await inquirer.prompt([
223
+ {
224
+ type: 'confirm',
225
+ name: 'saveToEnv',
226
+ message: 'Save credentials to .env file?',
227
+ default: true,
228
+ },
229
+ ]);
230
+
231
+ if (saveToEnv) {
232
+ credentialsManager.saveToEnvFile({ jira: credentials });
233
+ console.log('āœ… Credentials saved to .env');
234
+ console.log('āœ… .env added to .gitignore');
235
+ } else {
236
+ console.log('āš ļø Credentials not saved. You\'ll need to enter them again next time.');
237
+ }
238
+ }
239
+
240
+ // ============================================================================
241
+ // Export Helpers
242
+ // ============================================================================
243
+
244
+ /**
245
+ * Get Jira credentials - smart detection with fallback to interactive setup
246
+ */
247
+ export async function getJiraCredentials(): Promise<JiraCredentials> {
248
+ const detected = await detectJiraCredentials();
249
+
250
+ if (detected.found) {
251
+ return detected.credentials!;
252
+ }
253
+
254
+ // Not found - run interactive setup
255
+ return setupJiraCredentials();
256
+ }
package/README.md.bak DELETED
@@ -1,304 +0,0 @@
1
- # SpecWeave
2
-
3
- > **AI made us fast. SpecWeave makes us sustainable.**
4
-
5
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
- [![Build](https://img.shields.io/github/actions/workflow/status/anton-abyzov/specweave/test.yml?branch=develop&label=Tests)](https://github.com/anton-abyzov/specweave/actions/workflows/test.yml)
7
- [![E2E](https://img.shields.io/github/actions/workflow/status/anton-abyzov/specweave/e2e-smoke-test.yml?branch=develop&label=E2E)](https://github.com/anton-abyzov/specweave/actions/workflows/e2e-smoke-test.yml)
8
- [![Discord](https://img.shields.io/badge/Discord-Join_Server-5865F2?logo=discord&logoColor=white)](https://discord.gg/UYg4BGJ65V)
9
- [![YouTube](https://img.shields.io/badge/YouTube-Subscribe-red?logo=youtube&logoColor=white)](https://www.youtube.com/@antonabyzov)
10
-
11
- ---
12
-
13
- ## The Problem Everyone Feels But Nobody Talks About
14
-
15
- Your AI coding assistant writes features in 30 minutes.
16
-
17
- You spend 3 days updating documentation.
18
-
19
- By day 4, the code has changed again.
20
-
21
- **The docs? Already wrong.**
22
-
23
- ---
24
-
25
- ## The Dirty Secret of AI Coding
26
-
27
- AI coding assistants made us:
28
- - āœ… **10x faster at shipping**
29
- - āŒ **100x worse at maintaining**
30
-
31
- We're all "vibe coding" now. Fast. Fun. Chaotic.
32
-
33
- No structure. No boundaries. No memory of why we built it this way.
34
-
35
- New developers? Lost in 1 hour.
36
-
37
- **This is not sustainable.**
38
-
39
- ---
40
-
41
- ## The Fortune 500 Gap
42
-
43
- Big companies don't have this problem.
44
-
45
- They have systems:
46
- - **PRDs** (Product Requirements) - What and why
47
- - **HLDs** (High-Level Design) - Architecture decisions
48
- - **ADRs** (Architecture Decision Records) - Why we chose X over Y
49
- - **Runbooks** (Operations) - How to actually run this
50
- - **Glossaries** (Terms) - What these acronyms mean
51
-
52
- Their docs stay updated because there's a team, a process, a **discipline**.
53
-
54
- But for solo developers and small teams?
55
-
56
- **Impossible to maintain manually.**
57
-
58
- ---
59
-
60
- ## What is SpecWeave?
61
-
62
- **Fortune 500 discipline. Zero overhead. AI-native.**
63
-
64
- SpecWeave is a spec-driven development framework that brings enterprise-grade processes to developers of any size—without the bureaucracy.
65
-
66
- It's not just a tool. **It's a movement.**
67
-
68
- > *"Dad, AI writes your code but you update docs MANUALLY?"*
69
- > — My 14-year-old daughter (who was absolutely right)
70
-
71
- **The new way:**
72
- - Living docs that ACTUALLY stay synced (automatically)
73
- - Complete knowledge system (PRDs, HLDs, ADRs, glossaries, runbooks)
74
- - Tests embedded in tasks (BDD format, full traceability)
75
- - Enterprise structure without enterprise overhead
76
- - **Vibe coding... but with boundaries**
77
-
78
- ---
79
-
80
- ## What Changes
81
-
82
- **BEFORE (Vibe Coding):**
83
- - "I think we used JWT tokens?"
84
- - "Why did we choose PostgreSQL again?"
85
- - "What does this acronym mean?"
86
- - New developer: **Lost in 1 hour**
87
-
88
- **AFTER (SpecWeave):**
89
- - Check ADR-003: JWT vs Session Tokens (we chose JWT, here's why)
90
- - Check HLD: Database section (Postgres for ACID compliance)
91
- - Check Glossary: All technical terms defined
92
- - New developer: **Productive in 1 hour**
93
-
94
- ---
95
-
96
- ## šŸ“Š Engineering Metrics (DORA)
97
-
98
- [![Deploy Frequency](https://img.shields.io/badge/dynamic/json?url=https://raw.githubusercontent.com/anton-abyzov/specweave/develop/metrics/dora-latest.json&query=$.metrics.deploymentFrequency.value&label=Deploy%20Frequency&suffix=/month&color=brightgreen)](https://spec-weave.com/docs/metrics)
99
- [![Lead Time](https://img.shields.io/badge/dynamic/json?url=https://raw.githubusercontent.com/anton-abyzov/specweave/develop/metrics/dora-latest.json&query=$.metrics.leadTime.value&label=Lead%20Time&suffix=h&color=brightgreen)](https://spec-weave.com/docs/metrics)
100
- [![Change Failure Rate](https://img.shields.io/badge/dynamic/json?url=https://raw.githubusercontent.com/anton-abyzov/specweave/develop/metrics/dora-latest.json&query=$.metrics.changeFailureRate.value&label=Change%20Failure%20Rate&suffix=%25&color=brightgreen)](https://spec-weave.com/docs/metrics)
101
- [![MTTR](https://img.shields.io/badge/dynamic/json?url=https://raw.githubusercontent.com/anton-abyzov/specweave/develop/metrics/dora-latest.json&query=$.metrics.mttr.value&label=MTTR&suffix=min&color=brightgreen)](https://spec-weave.com/docs/metrics)
102
-
103
- [View detailed metrics dashboard →](https://spec-weave.com/docs/metrics)
104
-
105
- ---
106
-
107
- ## šŸ“– Full Documentation
108
-
109
- **For complete guides, tutorials, and API reference:**
110
-
111
- ### **[spec-weave.com](https://spec-weave.com)**
112
-
113
- ---
114
-
115
- ## Quick Start
116
-
117
- ```bash
118
- # Install SpecWeave CLI
119
- npm install -g specweave
120
-
121
- # Initialize your project
122
- specweave init my-project
123
- cd my-project
124
-
125
- # Start building - SpecWeave guides you through the entire workflow
126
- /specweave:increment "User authentication" # Plan increment
127
- /specweave:do # Implement tasks (auto-pauses if blocked, auto-resumes when ready)
128
- /specweave:done 0001 # Complete increment
129
- ```
130
-
131
- **New to SpecWeave?** → **[Getting Started Guide](https://spec-weave.com/docs/guides/getting-started/quickstart)**
132
-
133
- ---
134
-
135
- ## Key Features
136
-
137
- ### 🧪 Test-Aware Planning
138
- Embedded test plans in every task with BDD format (Given/When/Then) for clarity
139
-
140
- ### šŸŽÆ Disciplined Progress
141
- Cannot start increment N+1 until N is DONE - enforces completion before moving forward
142
-
143
- ### āøļø Intelligent Status Management
144
- Automatically detects when you're blocked (missing API keys, waiting for approval), pauses work with clear context, and resumes when ready - no manual intervention needed
145
-
146
- ### šŸ“š Living Documentation
147
- Auto-updates after every task via Claude Code hooks - never outdated
148
-
149
- ### šŸ¤– Intelligent Agents
150
- PM Agent, Architect, test-aware-planner, Quality Judge - specialized AI agents guide you
151
-
152
- ### šŸŒ Multilingual Support
153
- Work in 9 languages (Russian, Spanish, Chinese, German, French, Japanese, Korean, Portuguese) with zero-cost LLM-native translation
154
-
155
- **[→ Explore All Features](https://spec-weave.com/docs/overview/features)**
156
-
157
- ---
158
-
159
- ## Enterprise Features
160
-
161
- ### šŸ¢ Multi-Project Support (v0.8.0+)
162
-
163
- Organize documentation by team, repo, or microservice:
164
-
165
- - **Team-Based Organization**: Frontend, Backend, Mobile, Platform teams with separate documentation
166
- - **Microservices Architecture**: Each service gets its own specs, modules, and team playbooks
167
- - **Per-Project Sync**: Link projects to different GitHub repos, JIRA projects, or ADO boards
168
- - **Unified Architecture**: Single project = multi-project with 1 project (NO special cases!)
169
-
170
- **Five Documentation Types Per Project**:
171
- 1. **specs/** - Living documentation specs (user stories, AC)
172
- 2. **modules/** - Module/component documentation (architecture, APIs)
173
- 3. **team/** - Team playbooks (onboarding, conventions, workflows)
174
- 4. **architecture/** - Project-specific ADRs (optional)
175
- 5. **legacy/** - Brownfield imports (temporary)
176
-
177
- **[→ Multi-Project Setup Guide](https://spec-weave.com/docs/guides/multi-project-setup)**
178
-
179
- ### šŸ“¦ Brownfield Import
180
-
181
- Import existing documentation from external sources:
182
-
183
- - **Automatic Classification**: AI-powered keyword detection (85%+ accuracy)
184
- - **Supported Sources**: Notion, Confluence, GitHub Wiki, custom markdown folders
185
- - **Smart Organization**: Classifies into specs, modules, team docs, or legacy
186
- - **Migration Reports**: Complete audit trail with confidence scores and manual review checklist
187
-
188
- **Example**:
189
- ```bash
190
- # Import Notion export to web-app project
191
- /specweave:import-docs ~/Downloads/notion-export --source=notion --project=web-app
192
-
193
- # Result:
194
- # āœ… Classified 127 files
195
- # - 37 specs → projects/web-app/specs/
196
- # - 18 modules → projects/web-app/modules/
197
- # - 12 team docs → projects/web-app/team/
198
- # - 60 legacy → projects/web-app/legacy/notion/
199
- ```
200
-
201
- **[→ Brownfield Integration Guide](https://spec-weave.com/docs/workflows/brownfield)**
202
-
203
- ---
204
-
205
- ## Documentation Hub
206
-
207
- **Learn SpecWeave:**
208
- - šŸ“˜ [What is SpecWeave?](https://spec-weave.com/docs/overview/introduction)
209
- - šŸš€ [Quickstart Guide](https://spec-weave.com/docs/guides/getting-started/quickstart)
210
- - šŸ—ļø [Complete Workflow Journey](https://spec-weave.com/docs/workflows/overview)
211
- - ā“ [FAQ - Common Questions](https://spec-weave.com/docs/faq)
212
-
213
- **Commands & API:**
214
- - šŸ“‹ [Commands Reference](https://spec-weave.com/docs/commands/status-management)
215
- - šŸ”§ [API Documentation](https://spec-weave.com/docs/api)
216
-
217
- **Advanced Topics:**
218
- - šŸ“Š [DORA Metrics Dashboard](https://spec-weave.com/docs/metrics)
219
- - šŸ¢ [Brownfield Integration](https://spec-weave.com/docs/workflows/brownfield)
220
- - šŸŒ [Multilingual Support](https://spec-weave.com/docs/tutorial-extras/multilingual-support)
221
- - šŸ”— [GitHub Actions Setup](https://spec-weave.com/docs/guides/github-action-setup)
222
-
223
- ---
224
-
225
- ## Community & Support
226
-
227
- **Join the Community:**
228
-
229
- - šŸ’¬ **[Discord Server](https://discord.gg/UYg4BGJ65V)** - Get help, share tips, discuss features
230
- - šŸŽ„ **[YouTube Channel](https://www.youtube.com/@antonabyzov)** - Tutorials, demos, deep dives
231
- - šŸ“– **[Documentation](https://spec-weave.com)** - Complete guides and API reference
232
- - šŸ› **[GitHub Issues](https://github.com/anton-abyzov/specweave/issues)** - Bug reports and feature requests
233
- - šŸ’” **[GitHub Discussions](https://github.com/anton-abyzov/specweave/discussions)** - Q&A and community discussions
234
-
235
- **Need Help?**
236
- 1. Check the **[FAQ](https://spec-weave.com/docs/faq)** first
237
- 2. Ask in **[Discord](https://discord.gg/UYg4BGJ65V)** for quick answers
238
- 3. Create a **[GitHub Discussion](https://github.com/anton-abyzov/specweave/discussions)** for detailed questions
239
-
240
- ---
241
-
242
- ## Contributing
243
-
244
- **Development Setup:**
245
-
246
- ```bash
247
- # Clone and setup
248
- git clone https://github.com/anton-abyzov/specweave.git
249
- cd specweave
250
- npm install
251
- npm run build
252
-
253
- # Run tests
254
- npm test
255
- ```
256
-
257
- **To Contribute:**
258
- 1. Fork repository
259
- 2. Create feature branch: `git checkout -b features/002-new-feature`
260
- 3. Follow SpecWeave conventions (see CLAUDE.md)
261
- 4. Add tests (minimum 3 test cases)
262
- 5. Create PR to `develop` branch
263
-
264
- **[→ Contributor Guide](https://spec-weave.com/docs/guides/contributing)**
265
-
266
- ---
267
-
268
- ## Best Results with Claude Code
269
-
270
- SpecWeave gives **best results with Claude Code** due to unique capabilities:
271
-
272
- - āœ… **Native Plugin Marketplace** - Skills and agents auto-activate (no manual setup)
273
- - āœ… **Auto-Activating Skills** - Context-aware activation (no @ mentions)
274
- - āœ… **Isolated Agent Contexts** - True multi-agent role separation
275
- - āœ… **Pre/Post Lifecycle Hooks** - Automated living docs sync after every task
276
- - āœ… **MCP Protocol** - Industry standard for context management
277
-
278
- **Also works with**: Cursor, GitHub Copilot, ChatGPT (with manual workflow, reduced automation)
279
-
280
- **[→ Tool Comparison](https://spec-weave.com/docs/overview/features#claude-code-native)**
281
-
282
- ---
283
-
284
- ## Status & License
285
-
286
- **Status**: Beta - Ready for testing and contributions
287
- **License**: MIT
288
- **Repository**: [github.com/anton-abyzov/specweave](https://github.com/anton-abyzov/specweave)
289
-
290
- ---
291
-
292
- ## Acknowledgments
293
-
294
- SpecWeave is inspired by:
295
- - [spec-kit](https://github.com/github/spec-kit) - GitHub's specification toolkit
296
- - [BMAD-METHOD](https://github.com/bmad-code-org/BMAD-METHOD) - Agentic agile framework
297
- - [Claude Code](https://claude.com/claude-code) - Anthropic's native plugin system
298
- - [C4 Model](https://c4model.com/) - Software architecture diagrams
299
-
300
- ---
301
-
302
- **SpecWeave** - AI made us fast. SpecWeave makes us sustainable.
303
-
304
- **Get started**: `npm install -g specweave` → `specweave init my-project` → **[Read the Docs](https://spec-weave.com)**