specweave 1.0.226 → 1.0.227
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.
- package/CLAUDE.md +24 -24
- package/bin/specweave.js +20 -0
- package/dist/src/cli/commands/analytics.d.ts +41 -0
- package/dist/src/cli/commands/analytics.d.ts.map +1 -0
- package/dist/src/cli/commands/analytics.js +131 -0
- package/dist/src/cli/commands/analytics.js.map +1 -0
- package/dist/src/core/lsp/cache/index.d.ts +7 -0
- package/dist/src/core/lsp/cache/index.d.ts.map +1 -0
- package/dist/src/core/lsp/cache/index.js +7 -0
- package/dist/src/core/lsp/cache/index.js.map +1 -0
- package/dist/src/core/lsp/config/index.d.ts +13 -0
- package/dist/src/core/lsp/config/index.d.ts.map +1 -0
- package/dist/src/core/lsp/config/index.js +20 -0
- package/dist/src/core/lsp/config/index.js.map +1 -0
- package/dist/src/core/lsp/config/lsp-prompt.d.ts +66 -0
- package/dist/src/core/lsp/config/lsp-prompt.d.ts.map +1 -0
- package/dist/src/core/lsp/config/lsp-prompt.js +57 -0
- package/dist/src/core/lsp/config/lsp-prompt.js.map +1 -0
- package/dist/src/core/lsp/diagnostics/index.d.ts +8 -0
- package/dist/src/core/lsp/diagnostics/index.d.ts.map +1 -0
- package/dist/src/core/lsp/diagnostics/index.js +8 -0
- package/dist/src/core/lsp/diagnostics/index.js.map +1 -0
- package/dist/src/core/lsp/index.d.ts +21 -0
- package/dist/src/core/lsp/index.d.ts.map +1 -0
- package/dist/src/core/lsp/index.js +25 -0
- package/dist/src/core/lsp/index.js.map +1 -0
- package/dist/src/core/lsp/lsp-client.d.ts +4 -0
- package/dist/src/core/lsp/lsp-client.d.ts.map +1 -1
- package/dist/src/core/lsp/lsp-client.js +7 -3
- package/dist/src/core/lsp/lsp-client.js.map +1 -1
- package/dist/src/core/lsp/lsp-manager.d.ts +5 -0
- package/dist/src/core/lsp/lsp-manager.d.ts.map +1 -1
- package/dist/src/core/lsp/lsp-manager.js +13 -5
- package/dist/src/core/lsp/lsp-manager.js.map +1 -1
- package/dist/src/core/lsp/servers/index.d.ts +9 -0
- package/dist/src/core/lsp/servers/index.d.ts.map +1 -0
- package/dist/src/core/lsp/servers/index.js +10 -0
- package/dist/src/core/lsp/servers/index.js.map +1 -0
- package/dist/src/core/lsp/tsserver-client.d.ts +8 -1
- package/dist/src/core/lsp/tsserver-client.d.ts.map +1 -1
- package/dist/src/core/lsp/tsserver-client.js +6 -3
- package/dist/src/core/lsp/tsserver-client.js.map +1 -1
- package/dist/src/core/lsp/warmup/index.d.ts +13 -0
- package/dist/src/core/lsp/warmup/index.d.ts.map +1 -0
- package/dist/src/core/lsp/warmup/index.js +13 -0
- package/dist/src/core/lsp/warmup/index.js.map +1 -0
- package/package.json +1 -1
- package/plugins/specweave/commands/analytics.md +72 -69
- package/plugins/specweave/hooks/stop-auto.sh +4 -1
package/CLAUDE.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!-- SW:META template="claude" version="1.0.
|
|
1
|
+
<!-- SW:META template="claude" version="1.0.226" sections="header,start,autodetect,metarule,rules,workflow,reflect,context,structure,taskformat,secrets,syncing,testing,tdd,api,limits,troubleshooting,lazyloading,principles,linking,mcp,auto,docs" -->
|
|
2
2
|
|
|
3
3
|
<!-- SW:SECTION:hook-priority version="1.0.171" -->
|
|
4
4
|
## ⛔ Hook Instructions Override Everything
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
**SKILL FIRST ≠ only one skill.** Chain: hook skill → `sw-frontend:*` / `sw-backend:*` / etc → implement.
|
|
14
14
|
<!-- SW:END:hook-priority -->
|
|
15
15
|
|
|
16
|
-
<!-- SW:SECTION:header version="1.0.
|
|
16
|
+
<!-- SW:SECTION:header version="1.0.226" -->
|
|
17
17
|
**Framework**: SpecWeave | **Truth**: `spec.md` + `tasks.md`
|
|
18
18
|
<!-- SW:END:header -->
|
|
19
19
|
|
|
@@ -123,7 +123,7 @@ claude plugin install sw@specweave --scope project # Team-shared
|
|
|
123
123
|
|
|
124
124
|
SpecWeave auto-installs: LSP → project scope, sw-* → user scope.
|
|
125
125
|
|
|
126
|
-
<!-- SW:SECTION:start version="1.0.
|
|
126
|
+
<!-- SW:SECTION:start version="1.0.226" -->
|
|
127
127
|
## Getting Started
|
|
128
128
|
|
|
129
129
|
**Initial increment**: `0001-project-setup` (auto-created by `specweave init`)
|
|
@@ -133,7 +133,7 @@ SpecWeave auto-installs: LSP → project scope, sw-* → user scope.
|
|
|
133
133
|
2. **Customize**: Edit spec.md and use for setup tasks
|
|
134
134
|
<!-- SW:END:start -->
|
|
135
135
|
|
|
136
|
-
<!-- SW:SECTION:autodetect version="1.0.
|
|
136
|
+
<!-- SW:SECTION:autodetect version="1.0.226" -->
|
|
137
137
|
## Auto-Detection
|
|
138
138
|
|
|
139
139
|
SpecWeave auto-detects product descriptions and routes to `/sw:increment`:
|
|
@@ -143,7 +143,7 @@ SpecWeave auto-detects product descriptions and routes to `/sw:increment`:
|
|
|
143
143
|
**Opt-out phrases**: "Just brainstorm first" | "Don't plan yet" | "Quick discussion" | "Let's explore ideas"
|
|
144
144
|
<!-- SW:END:autodetect -->
|
|
145
145
|
|
|
146
|
-
<!-- SW:SECTION:metarule version="1.0.
|
|
146
|
+
<!-- SW:SECTION:metarule version="1.0.226" -->
|
|
147
147
|
## Workflow Orchestration
|
|
148
148
|
|
|
149
149
|
### 1. Plan Mode Default
|
|
@@ -170,7 +170,7 @@ SpecWeave auto-detects product descriptions and routes to `/sw:increment`:
|
|
|
170
170
|
```
|
|
171
171
|
<!-- SW:END:metarule -->
|
|
172
172
|
|
|
173
|
-
<!-- SW:SECTION:rules version="1.0.
|
|
173
|
+
<!-- SW:SECTION:rules version="1.0.226" -->
|
|
174
174
|
## Rules
|
|
175
175
|
|
|
176
176
|
1. **Files** → `.specweave/increments/####-name/` (see Structure section for details)
|
|
@@ -189,7 +189,7 @@ SpecWeave auto-detects product descriptions and routes to `/sw:increment`:
|
|
|
189
189
|
Use next available number. **NEVER create duplicate prefixes.**
|
|
190
190
|
<!-- SW:END:rules -->
|
|
191
191
|
|
|
192
|
-
<!-- SW:SECTION:workflow version="1.0.
|
|
192
|
+
<!-- SW:SECTION:workflow version="1.0.226" -->
|
|
193
193
|
## Workflow
|
|
194
194
|
|
|
195
195
|
`/sw:increment "X"` → `/sw:do` → `/sw:progress` → `/sw:done 0001`
|
|
@@ -235,7 +235,7 @@ project/
|
|
|
235
235
|
**NEVER assume single-repo mode without scanning first!**
|
|
236
236
|
<!-- SW:END:save-nested-repos -->
|
|
237
237
|
|
|
238
|
-
<!-- SW:SECTION:reflect version="1.0.
|
|
238
|
+
<!-- SW:SECTION:reflect version="1.0.226" -->
|
|
239
239
|
## Skill Memories
|
|
240
240
|
|
|
241
241
|
SpecWeave learns from corrections. Learnings saved here automatically. Edit or delete as needed.
|
|
@@ -258,7 +258,7 @@ SpecWeave learns from corrections. Learnings saved here automatically. Edit or d
|
|
|
258
258
|
- **2026-02-04**: Prefer leaderboard-style reporting when analyzing usage patterns or identifying deletion candidates
|
|
259
259
|
- **2026-02-04**: Auto command must have explicit stop conditions (passing tests, increment completion, quality gates) and log/display output visibly to user in terminal
|
|
260
260
|
|
|
261
|
-
<!-- SW:SECTION:context version="1.0.
|
|
261
|
+
<!-- SW:SECTION:context version="1.0.226" -->
|
|
262
262
|
## Context
|
|
263
263
|
|
|
264
264
|
**Before implementing**: Check ADRs at `.specweave/docs/internal/architecture/adr/`
|
|
@@ -266,7 +266,7 @@ SpecWeave learns from corrections. Learnings saved here automatically. Edit or d
|
|
|
266
266
|
**Load context**: `/sw:context <topic>` loads relevant living docs into conversation
|
|
267
267
|
<!-- SW:END:context -->
|
|
268
268
|
|
|
269
|
-
<!-- SW:SECTION:structure version="1.0.
|
|
269
|
+
<!-- SW:SECTION:structure version="1.0.226" -->
|
|
270
270
|
## Structure
|
|
271
271
|
|
|
272
272
|
```
|
|
@@ -281,7 +281,7 @@ SpecWeave learns from corrections. Learnings saved here automatically. Edit or d
|
|
|
281
281
|
**Everything else → subfolders**: `reports/` | `logs/` | `scripts/` | `backups/`
|
|
282
282
|
<!-- SW:END:structure -->
|
|
283
283
|
|
|
284
|
-
<!-- SW:SECTION:taskformat version="1.0.
|
|
284
|
+
<!-- SW:SECTION:taskformat version="1.0.226" -->
|
|
285
285
|
## Task Format
|
|
286
286
|
|
|
287
287
|
```markdown
|
|
@@ -291,7 +291,7 @@ SpecWeave learns from corrections. Learnings saved here automatically. Edit or d
|
|
|
291
291
|
```
|
|
292
292
|
<!-- SW:END:taskformat -->
|
|
293
293
|
|
|
294
|
-
<!-- SW:SECTION:secrets version="1.0.
|
|
294
|
+
<!-- SW:SECTION:secrets version="1.0.226" -->
|
|
295
295
|
## Secrets Check
|
|
296
296
|
|
|
297
297
|
**BEFORE CLI tools**: Check existing config first!
|
|
@@ -305,7 +305,7 @@ gh auth status
|
|
|
305
305
|
**SECURITY**: NEVER use `grep TOKEN .env` without `-q` flag - it exposes credentials in terminal!
|
|
306
306
|
<!-- SW:END:secrets -->
|
|
307
307
|
|
|
308
|
-
<!-- SW:SECTION:syncing version="1.0.
|
|
308
|
+
<!-- SW:SECTION:syncing version="1.0.226" -->
|
|
309
309
|
## External Sync (GitHub/JIRA/ADO)
|
|
310
310
|
|
|
311
311
|
**Commands**: `/sw-github:sync {id}` (issues) | `/sw:sync-specs` (living docs only)
|
|
@@ -315,7 +315,7 @@ gh auth status
|
|
|
315
315
|
**Config**: Set `sync.github.enabled: true` + `canUpdateExternalItems: true` in config.json
|
|
316
316
|
<!-- SW:END:syncing -->
|
|
317
317
|
|
|
318
|
-
<!-- SW:SECTION:testing version="1.0.
|
|
318
|
+
<!-- SW:SECTION:testing version="1.0.226" -->
|
|
319
319
|
## Testing
|
|
320
320
|
|
|
321
321
|
BDD in tasks.md | Unit >80% | `.test.ts` (Vitest)
|
|
@@ -327,7 +327,7 @@ vi.mock('./module', () => ({ func: mockFn }));
|
|
|
327
327
|
```
|
|
328
328
|
<!-- SW:END:testing -->
|
|
329
329
|
|
|
330
|
-
<!-- SW:SECTION:tdd version="1.0.
|
|
330
|
+
<!-- SW:SECTION:tdd version="1.0.226" -->
|
|
331
331
|
## TDD Mode (Test-Driven Development)
|
|
332
332
|
|
|
333
333
|
**When `testing.defaultTestMode: "TDD"` is configured**, follow RED-GREEN-REFACTOR discipline:
|
|
@@ -388,7 +388,7 @@ When TDD is enabled, tasks include phase markers:
|
|
|
388
388
|
**Rule**: Complete dependencies BEFORE dependent tasks (RED before GREEN).
|
|
389
389
|
<!-- SW:END:tdd -->
|
|
390
390
|
|
|
391
|
-
<!-- SW:SECTION:api version="1.0.
|
|
391
|
+
<!-- SW:SECTION:api version="1.0.226" -->
|
|
392
392
|
## API Development (OpenAPI-First)
|
|
393
393
|
|
|
394
394
|
**For API projects only.** Commands: `/sw:api-docs --all` | `--openapi` | `--postman` | `--validate`
|
|
@@ -396,13 +396,13 @@ When TDD is enabled, tasks include phase markers:
|
|
|
396
396
|
Enable in config: `{"apiDocs":{"enabled":true,"openApiPath":"openapi.yaml"}}`
|
|
397
397
|
<!-- SW:END:api -->
|
|
398
398
|
|
|
399
|
-
<!-- SW:SECTION:limits version="1.0.
|
|
399
|
+
<!-- SW:SECTION:limits version="1.0.226" -->
|
|
400
400
|
## Limits
|
|
401
401
|
|
|
402
402
|
**Max 1500 lines/file** — extract before adding
|
|
403
403
|
<!-- SW:END:limits -->
|
|
404
404
|
|
|
405
|
-
<!-- SW:SECTION:troubleshooting version="1.0.
|
|
405
|
+
<!-- SW:SECTION:troubleshooting version="1.0.226" -->
|
|
406
406
|
## Troubleshooting
|
|
407
407
|
|
|
408
408
|
| Issue | Fix |
|
|
@@ -415,7 +415,7 @@ Enable in config: `{"apiDocs":{"enabled":true,"openApiPath":"openapi.yaml"}}`
|
|
|
415
415
|
| Session stuck | Kill + `rm -f .specweave/state/*.lock` + restart |
|
|
416
416
|
<!-- SW:END:troubleshooting -->
|
|
417
417
|
|
|
418
|
-
<!-- SW:SECTION:lazyloading version="1.0.
|
|
418
|
+
<!-- SW:SECTION:lazyloading version="1.0.226" -->
|
|
419
419
|
## Plugin Auto-Loading
|
|
420
420
|
|
|
421
421
|
Plugins load automatically based on project type and keywords. Manual install if needed:
|
|
@@ -429,7 +429,7 @@ export SPECWEAVE_DISABLE_AUTO_LOAD=1 # Disable auto-load
|
|
|
429
429
|
**Token savings**: Core ~3-5K tokens vs all plugins ~60K+
|
|
430
430
|
<!-- SW:END:lazyloading -->
|
|
431
431
|
|
|
432
|
-
<!-- SW:SECTION:principles version="1.0.
|
|
432
|
+
<!-- SW:SECTION:principles version="1.0.226" -->
|
|
433
433
|
## Principles
|
|
434
434
|
|
|
435
435
|
### SpecWeave Principles
|
|
@@ -445,7 +445,7 @@ export SPECWEAVE_DISABLE_AUTO_LOAD=1 # Disable auto-load
|
|
|
445
445
|
- **Demand Elegance**: For non-trivial changes, pause and ask "is there a more elegant way?" - but skip this for simple, obvious fixes (don't over-engineer).
|
|
446
446
|
<!-- SW:END:principles -->
|
|
447
447
|
|
|
448
|
-
<!-- SW:SECTION:linking version="1.0.
|
|
448
|
+
<!-- SW:SECTION:linking version="1.0.226" -->
|
|
449
449
|
## Bidirectional Linking
|
|
450
450
|
|
|
451
451
|
Tasks ↔ User Stories auto-linked via AC-IDs: `AC-US1-01` → `US-001`
|
|
@@ -453,7 +453,7 @@ Tasks ↔ User Stories auto-linked via AC-IDs: `AC-US1-01` → `US-001`
|
|
|
453
453
|
Task format: `**AC**: AC-US1-01, AC-US1-02` (CRITICAL for linking)
|
|
454
454
|
<!-- SW:END:linking -->
|
|
455
455
|
|
|
456
|
-
<!-- SW:SECTION:mcp version="1.0.
|
|
456
|
+
<!-- SW:SECTION:mcp version="1.0.226" -->
|
|
457
457
|
## External Services
|
|
458
458
|
|
|
459
459
|
**Priority**: CLI tools first (simpler) → MCP for complex integrations
|
|
@@ -475,7 +475,7 @@ claude mcp add --transport stdio postgres -- npx -y @modelcontextprotocol/server
|
|
|
475
475
|
MCP supports lazy-loading (auto mode) - tools load on-demand when >10% context.
|
|
476
476
|
<!-- SW:END:mcp -->
|
|
477
477
|
|
|
478
|
-
<!-- SW:SECTION:auto version="1.0.
|
|
478
|
+
<!-- SW:SECTION:auto version="1.0.226" -->
|
|
479
479
|
## Auto Mode
|
|
480
480
|
|
|
481
481
|
**Commands**: `/sw:auto` (start) | `/sw:auto-status` (check) | `/sw:cancel-auto` (emergency only)
|
|
@@ -492,7 +492,7 @@ MCP supports lazy-loading (auto mode) - tools load on-demand when >10% context.
|
|
|
492
492
|
**STOP & ASK** if: Spec conflicts | Task unnecessary | Requirement ambiguous
|
|
493
493
|
<!-- SW:END:auto -->
|
|
494
494
|
|
|
495
|
-
<!-- SW:SECTION:docs version="1.0.
|
|
495
|
+
<!-- SW:SECTION:docs version="1.0.226" -->
|
|
496
496
|
## Docs
|
|
497
497
|
|
|
498
498
|
[spec-weave.com](https://spec-weave.com)
|
package/bin/specweave.js
CHANGED
|
@@ -701,6 +701,26 @@ program
|
|
|
701
701
|
await cacheCommand(options);
|
|
702
702
|
});
|
|
703
703
|
|
|
704
|
+
// Analytics command - Usage analytics dashboard
|
|
705
|
+
program
|
|
706
|
+
.command('analytics')
|
|
707
|
+
.description('Show usage analytics dashboard (commands, skills, agents)')
|
|
708
|
+
.option('--export <format>', 'Export data (json, csv)')
|
|
709
|
+
.option('--since <time>', 'Filter by time range (24h, 7d, 30d)')
|
|
710
|
+
.option('--type <type>', 'Filter by event type (command, skill, agent)')
|
|
711
|
+
.option('--json', 'Output raw JSON for scripting')
|
|
712
|
+
.option('--limit <n>', 'Number of top items to show', '10')
|
|
713
|
+
.action(async (options) => {
|
|
714
|
+
const { analyticsCommand } = await import('../dist/src/cli/commands/analytics.js');
|
|
715
|
+
await analyticsCommand({
|
|
716
|
+
export: options.export,
|
|
717
|
+
since: options.since,
|
|
718
|
+
type: options.type,
|
|
719
|
+
json: options.json,
|
|
720
|
+
limit: options.limit ? parseInt(options.limit, 10) : undefined,
|
|
721
|
+
});
|
|
722
|
+
});
|
|
723
|
+
|
|
704
724
|
// LSP command - Code intelligence operations
|
|
705
725
|
const lspCmd = program
|
|
706
726
|
.command('lsp')
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Analytics CLI Command
|
|
3
|
+
*
|
|
4
|
+
* Shows usage analytics dashboard - command invocations, skill activations, agent spawns.
|
|
5
|
+
* Supports filtering by time range, type, and export to JSON/CSV.
|
|
6
|
+
*/
|
|
7
|
+
import { AnalyticsSummary, AnalyticsEventType } from '../../core/analytics/index.js';
|
|
8
|
+
export interface AnalyticsCommandOptions {
|
|
9
|
+
projectRoot?: string;
|
|
10
|
+
export?: 'json' | 'csv';
|
|
11
|
+
since?: string;
|
|
12
|
+
type?: AnalyticsEventType;
|
|
13
|
+
json?: boolean;
|
|
14
|
+
limit?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface AnalyticsCommandResult {
|
|
17
|
+
totalEvents: number;
|
|
18
|
+
topCommands: Array<{
|
|
19
|
+
name: string;
|
|
20
|
+
count: number;
|
|
21
|
+
}>;
|
|
22
|
+
topSkills: Array<{
|
|
23
|
+
name: string;
|
|
24
|
+
count: number;
|
|
25
|
+
}>;
|
|
26
|
+
topAgents: Array<{
|
|
27
|
+
name: string;
|
|
28
|
+
count: number;
|
|
29
|
+
}>;
|
|
30
|
+
successRate: number;
|
|
31
|
+
exported?: boolean;
|
|
32
|
+
format?: string;
|
|
33
|
+
filename?: string;
|
|
34
|
+
jsonOutput?: boolean;
|
|
35
|
+
data?: AnalyticsSummary;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Analytics CLI command handler
|
|
39
|
+
*/
|
|
40
|
+
export declare function analyticsCommand(options?: AnalyticsCommandOptions): Promise<AnalyticsCommandResult>;
|
|
41
|
+
//# sourceMappingURL=analytics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/analytics.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAGL,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,+BAA+B,CAAC;AAEvC,MAAM,WAAW,uBAAuB;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,kBAAkB,CAAC;IAC1B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACpD,SAAS,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAClD,SAAS,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAClD,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,gBAAgB,CAAC;CACzB;AA6ED;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,sBAAsB,CAAC,CAqEjC"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Analytics CLI Command
|
|
3
|
+
*
|
|
4
|
+
* Shows usage analytics dashboard - command invocations, skill activations, agent spawns.
|
|
5
|
+
* Supports filtering by time range, type, and export to JSON/CSV.
|
|
6
|
+
*/
|
|
7
|
+
import { AnalyticsCollector, AnalyticsAggregator, } from '../../core/analytics/index.js';
|
|
8
|
+
/**
|
|
9
|
+
* Parse time filter string (e.g., "24h", "7d", "30d") to ISO date
|
|
10
|
+
*/
|
|
11
|
+
function parseSinceFilter(since) {
|
|
12
|
+
const now = new Date();
|
|
13
|
+
const match = since.match(/^(\d+)([hdwm])$/);
|
|
14
|
+
if (!match) {
|
|
15
|
+
throw new Error(`Invalid time format: ${since}. Use formats like 24h, 7d, 30d`);
|
|
16
|
+
}
|
|
17
|
+
const [, amount, unit] = match;
|
|
18
|
+
const value = parseInt(amount, 10);
|
|
19
|
+
switch (unit) {
|
|
20
|
+
case 'h':
|
|
21
|
+
now.setHours(now.getHours() - value);
|
|
22
|
+
break;
|
|
23
|
+
case 'd':
|
|
24
|
+
now.setDate(now.getDate() - value);
|
|
25
|
+
break;
|
|
26
|
+
case 'w':
|
|
27
|
+
now.setDate(now.getDate() - value * 7);
|
|
28
|
+
break;
|
|
29
|
+
case 'm':
|
|
30
|
+
now.setMonth(now.getMonth() - value);
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
return now.toISOString();
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Format summary for console display
|
|
37
|
+
*/
|
|
38
|
+
function displaySummary(summary) {
|
|
39
|
+
console.log('\n📊 SpecWeave Analytics Dashboard\n');
|
|
40
|
+
console.log(`Period: ${summary.since.split('T')[0]} → ${summary.until.split('T')[0]}`);
|
|
41
|
+
console.log(`Total Events: ${summary.totalEvents}`);
|
|
42
|
+
console.log(`Success Rate: ${summary.successRate}%\n`);
|
|
43
|
+
if (summary.topCommands.length > 0) {
|
|
44
|
+
console.log('🔧 Top Commands:');
|
|
45
|
+
for (const cmd of summary.topCommands.slice(0, 5)) {
|
|
46
|
+
console.log(` ${cmd.count.toString().padStart(4)} │ ${cmd.name}`);
|
|
47
|
+
}
|
|
48
|
+
console.log('');
|
|
49
|
+
}
|
|
50
|
+
if (summary.topSkills.length > 0) {
|
|
51
|
+
console.log('⚡ Top Skills:');
|
|
52
|
+
for (const skill of summary.topSkills.slice(0, 5)) {
|
|
53
|
+
console.log(` ${skill.count.toString().padStart(4)} │ ${skill.name}`);
|
|
54
|
+
}
|
|
55
|
+
console.log('');
|
|
56
|
+
}
|
|
57
|
+
if (summary.topAgents.length > 0) {
|
|
58
|
+
console.log('🤖 Top Agents:');
|
|
59
|
+
for (const agent of summary.topAgents.slice(0, 5)) {
|
|
60
|
+
console.log(` ${agent.count.toString().padStart(4)} │ ${agent.name}`);
|
|
61
|
+
}
|
|
62
|
+
console.log('');
|
|
63
|
+
}
|
|
64
|
+
if (summary.dailySummaries.length > 0) {
|
|
65
|
+
console.log('📅 Daily Activity (last 7 days):');
|
|
66
|
+
for (const day of summary.dailySummaries.slice(-7)) {
|
|
67
|
+
const bar = '█'.repeat(Math.min(day.totalEvents, 20));
|
|
68
|
+
console.log(` ${day.date} │ ${bar} (${day.totalEvents})`);
|
|
69
|
+
}
|
|
70
|
+
console.log('');
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Analytics CLI command handler
|
|
75
|
+
*/
|
|
76
|
+
export async function analyticsCommand(options = {}) {
|
|
77
|
+
const projectRoot = options.projectRoot || process.cwd();
|
|
78
|
+
const limit = options.limit ?? 10;
|
|
79
|
+
// Initialize collector and aggregator
|
|
80
|
+
AnalyticsCollector.getInstance(projectRoot);
|
|
81
|
+
const aggregator = new AnalyticsAggregator(projectRoot);
|
|
82
|
+
// Build query options
|
|
83
|
+
const queryOptions = { limit };
|
|
84
|
+
if (options.since) {
|
|
85
|
+
queryOptions.since = parseSinceFilter(options.since);
|
|
86
|
+
}
|
|
87
|
+
if (options.type) {
|
|
88
|
+
queryOptions.type = options.type;
|
|
89
|
+
}
|
|
90
|
+
// Get summary
|
|
91
|
+
const summary = aggregator.getSummary(queryOptions);
|
|
92
|
+
// Handle export
|
|
93
|
+
if (options.export) {
|
|
94
|
+
const exported = aggregator.export(options.export, queryOptions);
|
|
95
|
+
console.log(`Exported to: ${exported.filename}`);
|
|
96
|
+
console.log(exported.content);
|
|
97
|
+
return {
|
|
98
|
+
totalEvents: summary.totalEvents,
|
|
99
|
+
topCommands: summary.topCommands,
|
|
100
|
+
topSkills: summary.topSkills,
|
|
101
|
+
topAgents: summary.topAgents,
|
|
102
|
+
successRate: summary.successRate,
|
|
103
|
+
exported: true,
|
|
104
|
+
format: options.export,
|
|
105
|
+
filename: exported.filename,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
// Handle JSON output
|
|
109
|
+
if (options.json) {
|
|
110
|
+
console.log(JSON.stringify(summary, null, 2));
|
|
111
|
+
return {
|
|
112
|
+
totalEvents: summary.totalEvents,
|
|
113
|
+
topCommands: summary.topCommands,
|
|
114
|
+
topSkills: summary.topSkills,
|
|
115
|
+
topAgents: summary.topAgents,
|
|
116
|
+
successRate: summary.successRate,
|
|
117
|
+
jsonOutput: true,
|
|
118
|
+
data: summary,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
// Display formatted summary
|
|
122
|
+
displaySummary(summary);
|
|
123
|
+
return {
|
|
124
|
+
totalEvents: summary.totalEvents,
|
|
125
|
+
topCommands: summary.topCommands,
|
|
126
|
+
topSkills: summary.topSkills,
|
|
127
|
+
topAgents: summary.topAgents,
|
|
128
|
+
successRate: summary.successRate,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=analytics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics.js","sourceRoot":"","sources":["../../../../src/cli/commands/analytics.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,kBAAkB,EAClB,mBAAmB,GAGpB,MAAM,+BAA+B,CAAC;AAwBvC;;GAEG;AACH,SAAS,gBAAgB,CAAC,KAAa;IACrC,MAAM,GAAG,GAAG,IAAI,IAAI,EAA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OAAO;QACL,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,WAAW,EAAE,OAAO,CAAC,WAAW;KACjC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core/lsp/cache/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,WAAW,EACX,KAAK,cAAc,EACnB,KAAK,iBAAiB,GACvB,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/core/lsp/cache/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,WAAW,GAGZ,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LSP Configuration Module
|
|
3
|
+
*
|
|
4
|
+
* Exports all configuration-related classes and interfaces.
|
|
5
|
+
*/
|
|
6
|
+
export { parseLspConfig, DEFAULT_TIMEOUT, DEFAULT_WARMUP_TIMEOUT, type LspConfig, } from './lsp-config.js';
|
|
7
|
+
export { TimeoutResolver } from './timeout-resolver.js';
|
|
8
|
+
export { LanguageAnalyzer, type LanguageScore } from './language-analyzer.js';
|
|
9
|
+
export { ProjectDetector, type ProjectInfo, type UnknownProjectResult, } from './project-detector.js';
|
|
10
|
+
export { ServerRegistry, type ServerConfig, type RegistryConfig, } from './server-registry.js';
|
|
11
|
+
export { ServerValidator, type TrustStore, type BinaryChecker, type ValidationResult, type WarnCallback, } from './server-validator.js';
|
|
12
|
+
export { LspPrompt, MAX_SERVERS, type LspSuggestion, type PromptResult, type PromptAdapter, } from './lsp-prompt.js';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core/lsp/config/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,cAAc,EACd,eAAe,EACf,sBAAsB,EACtB,KAAK,SAAS,GACf,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGxD,OAAO,EAAE,gBAAgB,EAAE,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAG9E,OAAO,EACL,eAAe,EACf,KAAK,WAAW,EAChB,KAAK,oBAAoB,GAC1B,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,cAAc,EACd,KAAK,YAAY,EACjB,KAAK,cAAc,GACpB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,eAAe,EACf,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,YAAY,GAClB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,SAAS,EACT,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,aAAa,GACnB,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LSP Configuration Module
|
|
3
|
+
*
|
|
4
|
+
* Exports all configuration-related classes and interfaces.
|
|
5
|
+
*/
|
|
6
|
+
// Config parsing
|
|
7
|
+
export { parseLspConfig, DEFAULT_TIMEOUT, DEFAULT_WARMUP_TIMEOUT, } from './lsp-config.js';
|
|
8
|
+
// Timeout resolution
|
|
9
|
+
export { TimeoutResolver } from './timeout-resolver.js';
|
|
10
|
+
// Language analysis
|
|
11
|
+
export { LanguageAnalyzer } from './language-analyzer.js';
|
|
12
|
+
// Project detection
|
|
13
|
+
export { ProjectDetector, } from './project-detector.js';
|
|
14
|
+
// Server registry
|
|
15
|
+
export { ServerRegistry, } from './server-registry.js';
|
|
16
|
+
// Server validation
|
|
17
|
+
export { ServerValidator, } from './server-validator.js';
|
|
18
|
+
// Interactive prompt
|
|
19
|
+
export { LspPrompt, MAX_SERVERS, } from './lsp-prompt.js';
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/core/lsp/config/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,iBAAiB;AACjB,OAAO,EACL,cAAc,EACd,eAAe,EACf,sBAAsB,GAEvB,MAAM,iBAAiB,CAAC;AAEzB,qBAAqB;AACrB,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,oBAAoB;AACpB,OAAO,EAAE,gBAAgB,EAAsB,MAAM,wBAAwB,CAAC;AAE9E,oBAAoB;AACpB,OAAO,EACL,eAAe,GAGhB,MAAM,uBAAuB,CAAC;AAE/B,kBAAkB;AAClB,OAAO,EACL,cAAc,GAGf,MAAM,sBAAsB,CAAC;AAE9B,oBAAoB;AACpB,OAAO,EACL,eAAe,GAKhB,MAAM,uBAAuB,CAAC;AAE/B,qBAAqB;AACrB,OAAO,EACL,SAAS,EACT,WAAW,GAIZ,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LspPrompt - Interactive LSP server suggestion prompt
|
|
3
|
+
*
|
|
4
|
+
* @see spec.md US-003: Language-Aware Warm-up Strategies
|
|
5
|
+
* @satisfies AC-US3-03, AC-US3-04, AC-US3-05
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Maximum number of LSP servers to enable
|
|
9
|
+
*/
|
|
10
|
+
export declare const MAX_SERVERS = 3;
|
|
11
|
+
/**
|
|
12
|
+
* LSP server suggestion from analyzer
|
|
13
|
+
*/
|
|
14
|
+
export interface LspSuggestion {
|
|
15
|
+
/** Language identifier */
|
|
16
|
+
language: string;
|
|
17
|
+
/** Server name */
|
|
18
|
+
server: string;
|
|
19
|
+
/** Score from analyzer (0-100) */
|
|
20
|
+
score: number;
|
|
21
|
+
/** Whether server is installed */
|
|
22
|
+
installed?: boolean;
|
|
23
|
+
/** Command to install the server */
|
|
24
|
+
installCommand?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Result of prompt interaction
|
|
28
|
+
*/
|
|
29
|
+
export interface PromptResult {
|
|
30
|
+
/** Selected/enabled languages */
|
|
31
|
+
enabled: string[];
|
|
32
|
+
/** Install commands for missing servers (keyed by language) */
|
|
33
|
+
installCommands?: Record<string, string>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Prompt adapter interface for testing
|
|
37
|
+
*/
|
|
38
|
+
export interface PromptAdapter {
|
|
39
|
+
prompt(config: {
|
|
40
|
+
message: string;
|
|
41
|
+
choices: Array<{
|
|
42
|
+
name: string;
|
|
43
|
+
value: string;
|
|
44
|
+
}>;
|
|
45
|
+
maxSelections?: number;
|
|
46
|
+
}): Promise<string[]>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Interactive prompt for LSP server suggestions
|
|
50
|
+
*/
|
|
51
|
+
export declare class LspPrompt {
|
|
52
|
+
private readonly promptAdapter;
|
|
53
|
+
constructor(promptAdapter: PromptAdapter);
|
|
54
|
+
/**
|
|
55
|
+
* Show suggestions and prompt user for selection
|
|
56
|
+
*
|
|
57
|
+
* @param suggestions - LSP suggestions from analyzer
|
|
58
|
+
* @returns Promise resolving to prompt result
|
|
59
|
+
*/
|
|
60
|
+
show(suggestions: LspSuggestion[]): Promise<PromptResult>;
|
|
61
|
+
/**
|
|
62
|
+
* Format a choice for display
|
|
63
|
+
*/
|
|
64
|
+
private formatChoice;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=lsp-prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lsp-prompt.d.ts","sourceRoot":"","sources":["../../../../../src/core/lsp/config/lsp-prompt.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,eAAO,MAAM,WAAW,IAAI,CAAC;AAE7B;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,0BAA0B;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,oCAAoC;IACpC,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,iCAAiC;IACjC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,+DAA+D;IAC/D,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1C;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,MAAM,EAAE;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QAChD,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CACvB;AAED;;GAEG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAgB;gBAElC,aAAa,EAAE,aAAa;IAIxC;;;;;OAKG;IACG,IAAI,CAAC,WAAW,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,YAAY,CAAC;IA8B/D;;OAEG;IACH,OAAO,CAAC,YAAY;CAIrB"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LspPrompt - Interactive LSP server suggestion prompt
|
|
3
|
+
*
|
|
4
|
+
* @see spec.md US-003: Language-Aware Warm-up Strategies
|
|
5
|
+
* @satisfies AC-US3-03, AC-US3-04, AC-US3-05
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Maximum number of LSP servers to enable
|
|
9
|
+
*/
|
|
10
|
+
export const MAX_SERVERS = 3;
|
|
11
|
+
/**
|
|
12
|
+
* Interactive prompt for LSP server suggestions
|
|
13
|
+
*/
|
|
14
|
+
export class LspPrompt {
|
|
15
|
+
constructor(promptAdapter) {
|
|
16
|
+
this.promptAdapter = promptAdapter;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Show suggestions and prompt user for selection
|
|
20
|
+
*
|
|
21
|
+
* @param suggestions - LSP suggestions from analyzer
|
|
22
|
+
* @returns Promise resolving to prompt result
|
|
23
|
+
*/
|
|
24
|
+
async show(suggestions) {
|
|
25
|
+
const choices = suggestions.map((s) => ({
|
|
26
|
+
name: this.formatChoice(s),
|
|
27
|
+
value: s.language,
|
|
28
|
+
}));
|
|
29
|
+
const selected = await this.promptAdapter.prompt({
|
|
30
|
+
message: 'Select LSP servers to enable (max 3):',
|
|
31
|
+
choices,
|
|
32
|
+
maxSelections: MAX_SERVERS,
|
|
33
|
+
});
|
|
34
|
+
// Limit to max servers
|
|
35
|
+
const enabled = selected.slice(0, MAX_SERVERS);
|
|
36
|
+
// Collect install commands for selected missing servers
|
|
37
|
+
const installCommands = {};
|
|
38
|
+
for (const lang of enabled) {
|
|
39
|
+
const suggestion = suggestions.find((s) => s.language === lang);
|
|
40
|
+
if (suggestion && !suggestion.installed && suggestion.installCommand) {
|
|
41
|
+
installCommands[lang] = suggestion.installCommand;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
enabled,
|
|
46
|
+
installCommands: Object.keys(installCommands).length > 0 ? installCommands : undefined,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Format a choice for display
|
|
51
|
+
*/
|
|
52
|
+
formatChoice(suggestion) {
|
|
53
|
+
const installedIndicator = suggestion.installed ? '✓' : '○';
|
|
54
|
+
return `${installedIndicator} ${suggestion.language} (${suggestion.server}) - score: ${suggestion.score}`;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=lsp-prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lsp-prompt.js","sourceRoot":"","sources":["../../../../../src/core/lsp/config/lsp-prompt.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC;AAuC7B;;GAEG;AACH,MAAM,OAAO,SAAS;IAGpB,YAAY,aAA4B;QACtC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,IAAI,CAAC,WAA4B;QACrC,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACtC,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;YAC1B,KAAK,EAAE,CAAC,CAAC,QAAQ;SAClB,CAAC,CAAC,CAAC;QAEJ,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;YAC/C,OAAO,EAAE,uCAAuC;YAChD,OAAO;YACP,aAAa,EAAE,WAAW;SAC3B,CAAC,CAAC;QAEH,uBAAuB;QACvB,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;QAE/C,wDAAwD;QACxD,MAAM,eAAe,GAA2B,EAAE,CAAC;QACnD,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;YAC3B,MAAM,UAAU,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC;YAChE,IAAI,UAAU,IAAI,CAAC,UAAU,CAAC,SAAS,IAAI,UAAU,CAAC,cAAc,EAAE,CAAC;gBACrE,eAAe,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,cAAc,CAAC;YACpD,CAAC;QACH,CAAC;QAED,OAAO;YACL,OAAO;YACP,eAAe,EAAE,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,SAAS;SACvF,CAAC;IACJ,CAAC;IAED;;OAEG;IACK,YAAY,CAAC,UAAyB;QAC5C,MAAM,kBAAkB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;QAC5D,OAAO,GAAG,kBAAkB,IAAI,UAAU,CAAC,QAAQ,KAAK,UAAU,CAAC,MAAM,cAAc,UAAU,CAAC,KAAK,EAAE,CAAC;IAC5G,CAAC;CACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LSP Diagnostics Module
|
|
3
|
+
*
|
|
4
|
+
* Exports diagnostic tools like progress tracking and the doctor command.
|
|
5
|
+
*/
|
|
6
|
+
export { LspProgress, type ProgressCallback } from './progress.js';
|
|
7
|
+
export { LspDoctor, type DoctorResult, type ServerChecker, } from './doctor.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core/lsp/diagnostics/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EACL,SAAS,EACT,KAAK,YAAY,EACjB,KAAK,aAAa,GACnB,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/core/lsp/diagnostics/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAyB,MAAM,eAAe,CAAC;AACnE,OAAO,EACL,SAAS,GAGV,MAAM,aAAa,CAAC"}
|