solvdex 1.0.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.
- package/LICENSE +21 -0
- package/README.md +274 -0
- package/dist/hooks/error-lookup.d.ts +4 -0
- package/dist/hooks/error-lookup.d.ts.map +1 -0
- package/dist/hooks/error-lookup.js +92 -0
- package/dist/hooks/error-lookup.js.map +1 -0
- package/dist/hooks/post-task.d.ts +15 -0
- package/dist/hooks/post-task.d.ts.map +1 -0
- package/dist/hooks/post-task.js +246 -0
- package/dist/hooks/post-task.js.map +1 -0
- package/dist/hooks/prompt-enrich.d.ts +16 -0
- package/dist/hooks/prompt-enrich.d.ts.map +1 -0
- package/dist/hooks/prompt-enrich.js +141 -0
- package/dist/hooks/prompt-enrich.js.map +1 -0
- package/dist/hooks/session-start-cli.d.ts +3 -0
- package/dist/hooks/session-start-cli.d.ts.map +1 -0
- package/dist/hooks/session-start-cli.js +81 -0
- package/dist/hooks/session-start-cli.js.map +1 -0
- package/dist/hooks/session-start.d.ts +4 -0
- package/dist/hooks/session-start.d.ts.map +1 -0
- package/dist/hooks/session-start.js +134 -0
- package/dist/hooks/session-start.js.map +1 -0
- package/dist/src/audit.d.ts +63 -0
- package/dist/src/audit.d.ts.map +1 -0
- package/dist/src/audit.js +229 -0
- package/dist/src/audit.js.map +1 -0
- package/dist/src/cache.d.ts +54 -0
- package/dist/src/cache.d.ts.map +1 -0
- package/dist/src/cache.js +167 -0
- package/dist/src/cache.js.map +1 -0
- package/dist/src/config.d.ts +52 -0
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/config.js +175 -0
- package/dist/src/config.js.map +1 -0
- package/dist/src/entry.d.ts +154 -0
- package/dist/src/entry.d.ts.map +1 -0
- package/dist/src/entry.js +469 -0
- package/dist/src/entry.js.map +1 -0
- package/dist/src/errors.d.ts +65 -0
- package/dist/src/errors.d.ts.map +1 -0
- package/dist/src/errors.js +121 -0
- package/dist/src/errors.js.map +1 -0
- package/dist/src/frontmatter.d.ts +28 -0
- package/dist/src/frontmatter.d.ts.map +1 -0
- package/dist/src/frontmatter.js +111 -0
- package/dist/src/frontmatter.js.map +1 -0
- package/dist/src/index.d.ts +35 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +188 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/maturity.d.ts +31 -0
- package/dist/src/maturity.d.ts.map +1 -0
- package/dist/src/maturity.js +96 -0
- package/dist/src/maturity.js.map +1 -0
- package/dist/src/quality.d.ts +23 -0
- package/dist/src/quality.d.ts.map +1 -0
- package/dist/src/quality.js +236 -0
- package/dist/src/quality.js.map +1 -0
- package/dist/src/search.d.ts +35 -0
- package/dist/src/search.d.ts.map +1 -0
- package/dist/src/search.js +263 -0
- package/dist/src/search.js.map +1 -0
- package/dist/src/similarity.d.ts +42 -0
- package/dist/src/similarity.d.ts.map +1 -0
- package/dist/src/similarity.js +111 -0
- package/dist/src/similarity.js.map +1 -0
- package/dist/src/stats.d.ts +56 -0
- package/dist/src/stats.d.ts.map +1 -0
- package/dist/src/stats.js +198 -0
- package/dist/src/stats.js.map +1 -0
- package/dist/src/templates.d.ts +63 -0
- package/dist/src/templates.d.ts.map +1 -0
- package/dist/src/templates.js +347 -0
- package/dist/src/templates.js.map +1 -0
- package/dist/src/transfer.d.ts +92 -0
- package/dist/src/transfer.d.ts.map +1 -0
- package/dist/src/transfer.js +215 -0
- package/dist/src/transfer.js.map +1 -0
- package/dist/src/types.d.ts +270 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +153 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/validate.d.ts +90 -0
- package/dist/src/validate.d.ts.map +1 -0
- package/dist/src/validate.js +295 -0
- package/dist/src/validate.js.map +1 -0
- package/hooks/error-lookup.ts +110 -0
- package/hooks/hooks.json +49 -0
- package/hooks/post-task.ts +309 -0
- package/hooks/prompt-enrich.ts +162 -0
- package/hooks/session-start-cli.ts +96 -0
- package/hooks/session-start.ts +159 -0
- package/package.json +40 -0
- package/scripts/error-lookup.py +64 -0
- package/scripts/post-task.py +60 -0
- package/scripts/prompt-enrich.py +64 -0
- package/scripts/session-start.py +64 -0
- package/skills/wiki/SKILL.md +61 -0
- package/skills/wiki-add/SKILL.md +90 -0
- package/skills/wiki-browse/SKILL.md +108 -0
- package/skills/wiki-capture/SKILL.md +265 -0
- package/skills/wiki-explorer/SKILL.md +223 -0
- package/skills/wiki-export/SKILL.md +101 -0
- package/skills/wiki-fix/SKILL.md +86 -0
- package/skills/wiki-flag/SKILL.md +47 -0
- package/skills/wiki-import/SKILL.md +128 -0
- package/skills/wiki-init/SKILL.md +72 -0
- package/skills/wiki-scan/SKILL.md +98 -0
- package/skills/wiki-search/SKILL.md +86 -0
- package/skills/wiki-stats/SKILL.md +129 -0
- package/skills/wiki-status/SKILL.md +78 -0
- package/skills/wiki-test-trigger/SKILL.md +173 -0
- package/skills/wiki-validate/SKILL.md +62 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: wiki-fix
|
|
3
|
+
description: Update a flagged Solvdex wiki entry. Reviews current content, updates with new solution, and resets status to active.
|
|
4
|
+
argument-hint: <entry-path>
|
|
5
|
+
user-invocable: true
|
|
6
|
+
disable-model-invocation: true
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Fix Solvdex Entry
|
|
10
|
+
|
|
11
|
+
Update a flagged entry and reset its status to active.
|
|
12
|
+
|
|
13
|
+
## Process
|
|
14
|
+
|
|
15
|
+
1. Read the flagged entry
|
|
16
|
+
2. Show current content and issues
|
|
17
|
+
3. Update content based on conversation
|
|
18
|
+
4. Reset status to 'active'
|
|
19
|
+
5. Increase confidence if solution verified
|
|
20
|
+
|
|
21
|
+
## Implementation
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import { readEntry, updateEntry, wikiExists, validateEntry, CONFIDENCE } from 'solvdex';
|
|
25
|
+
|
|
26
|
+
const projectRoot = process.cwd();
|
|
27
|
+
const entryPath = $ARGUMENTS.trim();
|
|
28
|
+
|
|
29
|
+
if (!wikiExists(projectRoot)) {
|
|
30
|
+
console.log('No wiki found.');
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const entry = readEntry(projectRoot, entryPath);
|
|
35
|
+
if (!entry) {
|
|
36
|
+
console.log(`Entry not found: ${entryPath}`);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const issues = validateEntry(projectRoot, entryPath);
|
|
41
|
+
|
|
42
|
+
console.log(`# Fixing: ${entry.frontmatter.title}`);
|
|
43
|
+
console.log(`Status: ${entry.frontmatter.status}`);
|
|
44
|
+
console.log(`Confidence: ${entry.frontmatter.confidence}`);
|
|
45
|
+
console.log('');
|
|
46
|
+
|
|
47
|
+
if (issues.length > 0) {
|
|
48
|
+
console.log('Issues to address:');
|
|
49
|
+
for (const issue of issues) {
|
|
50
|
+
console.log(` - [${issue.type}] ${issue.message}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
console.log('');
|
|
55
|
+
console.log('Current content:');
|
|
56
|
+
console.log(entry.content);
|
|
57
|
+
console.log('');
|
|
58
|
+
console.log('Please provide the updated content, then I will:');
|
|
59
|
+
console.log(' - Save the changes');
|
|
60
|
+
console.log(' - Reset status to active');
|
|
61
|
+
console.log(' - Increase confidence to 50+ if verified');
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Output
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
# Fixing: Database Connection Timeout
|
|
68
|
+
|
|
69
|
+
Status: flagged
|
|
70
|
+
Confidence: 50
|
|
71
|
+
|
|
72
|
+
Issues to address:
|
|
73
|
+
- [outdated] Solution references deprecated API
|
|
74
|
+
|
|
75
|
+
Current content:
|
|
76
|
+
# Problem
|
|
77
|
+
Database connections time out after 30 seconds.
|
|
78
|
+
|
|
79
|
+
# Solution
|
|
80
|
+
Increase the pool timeout in config.
|
|
81
|
+
|
|
82
|
+
Please provide the updated content, then I will:
|
|
83
|
+
- Save the changes
|
|
84
|
+
- Reset status to active
|
|
85
|
+
- Increase confidence to 50+ if verified
|
|
86
|
+
```
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: wiki-flag
|
|
3
|
+
description: Mark a Solvdex wiki entry for review. Use when a solution is outdated or needs verification.
|
|
4
|
+
argument-hint: <entry-path> [reason]
|
|
5
|
+
user-invocable: true
|
|
6
|
+
disable-model-invocation: true
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Flag Solvdex Entry
|
|
10
|
+
|
|
11
|
+
Mark an entry as needing review.
|
|
12
|
+
|
|
13
|
+
## Implementation
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { flagEntry, readEntry, wikiExists } from 'solvdex';
|
|
17
|
+
|
|
18
|
+
const projectRoot = process.cwd();
|
|
19
|
+
const [entryPath, ...reasonParts] = $ARGUMENTS.split(' ');
|
|
20
|
+
const reason = reasonParts.join(' ') || 'Flagged for review';
|
|
21
|
+
|
|
22
|
+
if (!wikiExists(projectRoot)) {
|
|
23
|
+
console.log('No wiki found.');
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const entry = readEntry(projectRoot, entryPath);
|
|
28
|
+
if (!entry) {
|
|
29
|
+
console.log(`Entry not found: ${entryPath}`);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
flagEntry(projectRoot, entryPath, reason);
|
|
34
|
+
console.log(`Flagged: ${entry.frontmatter.title}`);
|
|
35
|
+
console.log(`Reason: ${reason}`);
|
|
36
|
+
console.log('');
|
|
37
|
+
console.log('Use `/wiki fix` to update this entry.');
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Output
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
Flagged: Database Connection Timeout
|
|
44
|
+
Reason: Solution no longer works with new DB version
|
|
45
|
+
|
|
46
|
+
Use `/wiki fix` to update this entry.
|
|
47
|
+
```
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: wiki-import
|
|
3
|
+
description: Import Solvdex wiki entries from an export file.
|
|
4
|
+
argument-hint: <input-file> [--overwrite] [--skip-duplicates] [--dry-run]
|
|
5
|
+
user-invocable: true
|
|
6
|
+
disable-model-invocation: true
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Solvdex Import
|
|
10
|
+
|
|
11
|
+
Import wiki entries from a previously exported JSON file.
|
|
12
|
+
|
|
13
|
+
## Arguments
|
|
14
|
+
|
|
15
|
+
- `input-file`: Path to the export JSON file (required)
|
|
16
|
+
|
|
17
|
+
## Options
|
|
18
|
+
|
|
19
|
+
- `--overwrite`: Overwrite existing entries with same path
|
|
20
|
+
- `--skip-duplicates`: Skip entries that already exist
|
|
21
|
+
- `--dry-run`: Show what would be imported without making changes
|
|
22
|
+
|
|
23
|
+
## Implementation
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { wikiExists, importWikiFromFile, initWiki } from 'solvdex';
|
|
27
|
+
import * as path from 'path';
|
|
28
|
+
import * as fs from 'fs';
|
|
29
|
+
|
|
30
|
+
const projectRoot = process.cwd();
|
|
31
|
+
const args = $ARGUMENTS.split(' ').filter(Boolean);
|
|
32
|
+
|
|
33
|
+
// Parse args
|
|
34
|
+
const inputFile = args.find(a => !a.startsWith('--'));
|
|
35
|
+
const overwrite = args.includes('--overwrite');
|
|
36
|
+
const skipDuplicates = args.includes('--skip-duplicates');
|
|
37
|
+
const dryRun = args.includes('--dry-run');
|
|
38
|
+
|
|
39
|
+
if (!inputFile) {
|
|
40
|
+
console.log('Usage: /wiki import <input-file> [options]');
|
|
41
|
+
console.log('');
|
|
42
|
+
console.log('Options:');
|
|
43
|
+
console.log(' --overwrite Overwrite existing entries');
|
|
44
|
+
console.log(' --skip-duplicates Skip entries that already exist');
|
|
45
|
+
console.log(' --dry-run Preview without making changes');
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const inputPath = path.isAbsolute(inputFile)
|
|
50
|
+
? inputFile
|
|
51
|
+
: path.join(projectRoot, inputFile);
|
|
52
|
+
|
|
53
|
+
if (!fs.existsSync(inputPath)) {
|
|
54
|
+
console.log(`File not found: ${inputPath}`);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
console.log('# Solvdex Import\n');
|
|
59
|
+
console.log(`Source: ${inputPath}`);
|
|
60
|
+
console.log(`Mode: ${dryRun ? 'DRY RUN' : 'LIVE'}`);
|
|
61
|
+
console.log('');
|
|
62
|
+
|
|
63
|
+
try {
|
|
64
|
+
const result = await importWikiFromFile(projectRoot, inputPath, {
|
|
65
|
+
overwrite,
|
|
66
|
+
skipDuplicates,
|
|
67
|
+
dryRun
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
console.log('## Results');
|
|
71
|
+
console.log(` Imported: ${result.imported}`);
|
|
72
|
+
console.log(` Skipped: ${result.skipped}`);
|
|
73
|
+
|
|
74
|
+
if (result.errors.length > 0) {
|
|
75
|
+
console.log(` Errors: ${result.errors.length}`);
|
|
76
|
+
console.log('');
|
|
77
|
+
console.log('### Errors');
|
|
78
|
+
for (const err of result.errors) {
|
|
79
|
+
console.log(` - ${err.path}: ${err.error}`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (dryRun) {
|
|
84
|
+
console.log('\nThis was a dry run. No changes were made.');
|
|
85
|
+
console.log('Remove --dry-run to perform the actual import.');
|
|
86
|
+
} else {
|
|
87
|
+
console.log('\nImport complete!');
|
|
88
|
+
}
|
|
89
|
+
} catch (error) {
|
|
90
|
+
console.error(`Import failed: ${error.message}`);
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Output
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
# Solvdex Import
|
|
98
|
+
|
|
99
|
+
Source: /path/to/wiki-export.json
|
|
100
|
+
Mode: LIVE
|
|
101
|
+
|
|
102
|
+
## Results
|
|
103
|
+
Imported: 15
|
|
104
|
+
Skipped: 2
|
|
105
|
+
Errors: 1
|
|
106
|
+
|
|
107
|
+
### Errors
|
|
108
|
+
- patterns/old-pattern.md: Entry already exists (use overwrite option)
|
|
109
|
+
|
|
110
|
+
Import complete!
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Dry Run Example
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
# Solvdex Import
|
|
117
|
+
|
|
118
|
+
Source: /path/to/wiki-export.json
|
|
119
|
+
Mode: DRY RUN
|
|
120
|
+
|
|
121
|
+
## Results
|
|
122
|
+
Imported: 15
|
|
123
|
+
Skipped: 2
|
|
124
|
+
Errors: 0
|
|
125
|
+
|
|
126
|
+
This was a dry run. No changes were made.
|
|
127
|
+
Remove --dry-run to perform the actual import.
|
|
128
|
+
```
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: wiki-init
|
|
3
|
+
description: Initialize Solvdex wiki in the current project. Creates .wiki/ directory with 7 categories for storing project knowledge.
|
|
4
|
+
user-invocable: true
|
|
5
|
+
disable-model-invocation: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Initialize Solvdex Wiki
|
|
9
|
+
|
|
10
|
+
Create a `.wiki/` directory structure in the current project with all 7 categories.
|
|
11
|
+
|
|
12
|
+
## Process
|
|
13
|
+
|
|
14
|
+
1. Check if `.wiki/` already exists
|
|
15
|
+
2. Detect project name from `package.json` or directory name
|
|
16
|
+
3. Create directory structure:
|
|
17
|
+
```
|
|
18
|
+
.wiki/
|
|
19
|
+
├── README.md
|
|
20
|
+
├── issues/
|
|
21
|
+
├── patterns/
|
|
22
|
+
├── gotchas/
|
|
23
|
+
├── testing/
|
|
24
|
+
├── docs/
|
|
25
|
+
├── security/
|
|
26
|
+
└── performance/
|
|
27
|
+
```
|
|
28
|
+
4. Show success message
|
|
29
|
+
|
|
30
|
+
## Implementation
|
|
31
|
+
|
|
32
|
+
Use the `initWiki()` function from the solvdex core library:
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
import { initWiki, wikiExists } from 'solvdex';
|
|
36
|
+
|
|
37
|
+
const projectRoot = process.cwd();
|
|
38
|
+
|
|
39
|
+
if (wikiExists(projectRoot)) {
|
|
40
|
+
console.log('Solvdex wiki already exists at .wiki/');
|
|
41
|
+
console.log('Run `/wiki status` to see current state.');
|
|
42
|
+
} else {
|
|
43
|
+
await initWiki(projectRoot);
|
|
44
|
+
console.log('Solvdex wiki initialized at .wiki/');
|
|
45
|
+
console.log('');
|
|
46
|
+
console.log('Next steps:');
|
|
47
|
+
console.log(' /wiki scan - Import knowledge from existing project');
|
|
48
|
+
console.log(' /wiki add - Manually add an entry');
|
|
49
|
+
console.log(' /wiki browse - View all entries');
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Output
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
Solvdex wiki initialized at .wiki/
|
|
57
|
+
|
|
58
|
+
Created:
|
|
59
|
+
- issues/ (bug fixes, error solutions)
|
|
60
|
+
- patterns/ (reusable code patterns)
|
|
61
|
+
- gotchas/ (pitfalls, traps)
|
|
62
|
+
- testing/ (test strategies, mocks)
|
|
63
|
+
- docs/ (documentation templates)
|
|
64
|
+
- security/ (auth, vulnerabilities)
|
|
65
|
+
- performance/ (optimizations, profiling)
|
|
66
|
+
- README.md
|
|
67
|
+
|
|
68
|
+
Next steps:
|
|
69
|
+
/wiki scan - Import knowledge from existing project
|
|
70
|
+
/wiki add - Manually add an entry
|
|
71
|
+
/wiki browse - View all entries
|
|
72
|
+
```
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: wiki-scan
|
|
3
|
+
description: Scan project and create Solvdex stub entries from existing knowledge sources like git history, comments, and documentation.
|
|
4
|
+
argument-hint: [--batch] [--auto]
|
|
5
|
+
user-invocable: true
|
|
6
|
+
disable-model-invocation: false
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Scan Project for Solvdex
|
|
10
|
+
|
|
11
|
+
Analyze project and generate wiki stub entries from existing knowledge sources.
|
|
12
|
+
|
|
13
|
+
## Sources Scanned
|
|
14
|
+
|
|
15
|
+
| Source | Extracts | Category |
|
|
16
|
+
|--------|----------|----------|
|
|
17
|
+
| CLAUDE.md | Instructions, rules | patterns, gotchas |
|
|
18
|
+
| docs/ | Documentation | docs, patterns |
|
|
19
|
+
| Git history | Fix/refactor commits | issues, patterns |
|
|
20
|
+
| Code comments | HACK, WORKAROUND, TODO | gotchas, issues |
|
|
21
|
+
| README.md | Setup instructions | patterns, docs |
|
|
22
|
+
| Config files | .env.example, docker-compose | gotchas, security |
|
|
23
|
+
| Test files | Test patterns, mocks | testing |
|
|
24
|
+
| Security configs | Auth, permissions | security |
|
|
25
|
+
| Performance code | Optimizations, caching | performance |
|
|
26
|
+
|
|
27
|
+
## Modes
|
|
28
|
+
|
|
29
|
+
- **Interactive (default):** Review each entry one by one
|
|
30
|
+
- **Batch (--batch):** Show all, approve/reject in bulk
|
|
31
|
+
- **Auto (--auto):** Accept all stubs automatically
|
|
32
|
+
|
|
33
|
+
## Implementation
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
import { wikiExists, createEntry, CONFIDENCE } from 'solvdex';
|
|
37
|
+
|
|
38
|
+
const projectRoot = process.cwd();
|
|
39
|
+
|
|
40
|
+
if (!wikiExists(projectRoot)) {
|
|
41
|
+
console.log('No wiki found. Run `/wiki init` first.');
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
console.log('Scanning project...');
|
|
46
|
+
|
|
47
|
+
// Scan sources and extract candidates
|
|
48
|
+
const candidates = scanProjectSources(projectRoot);
|
|
49
|
+
|
|
50
|
+
console.log(`Found ${candidates.length} potential entries.`);
|
|
51
|
+
console.log('');
|
|
52
|
+
|
|
53
|
+
if ($ARGUMENTS.includes('--auto')) {
|
|
54
|
+
// Auto-accept all
|
|
55
|
+
for (const candidate of candidates) {
|
|
56
|
+
const entry = createEntry(projectRoot, {
|
|
57
|
+
category: candidate.category,
|
|
58
|
+
title: candidate.title,
|
|
59
|
+
tags: candidate.tags,
|
|
60
|
+
content: { Problem: '<!-- TODO -->' },
|
|
61
|
+
stub: true,
|
|
62
|
+
confidence: CONFIDENCE.LOW,
|
|
63
|
+
source: candidate.source
|
|
64
|
+
});
|
|
65
|
+
console.log(`Created stub: ${entry.path}`);
|
|
66
|
+
}
|
|
67
|
+
} else {
|
|
68
|
+
// Interactive mode
|
|
69
|
+
for (const candidate of candidates) {
|
|
70
|
+
console.log(`[${candidate.category}] ${candidate.title}`);
|
|
71
|
+
console.log(` Source: ${candidate.source}`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
console.log('');
|
|
76
|
+
console.log('Scan complete. Run `/wiki browse` to see entries.');
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Output
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
Scanning project...
|
|
83
|
+
Found 8 potential entries.
|
|
84
|
+
|
|
85
|
+
[issues] Auth Token Expiration Fix
|
|
86
|
+
Source: git commit abc123
|
|
87
|
+
|
|
88
|
+
[gotchas] Environment Variable Gotcha
|
|
89
|
+
Source: code comment in src/config.ts
|
|
90
|
+
|
|
91
|
+
[patterns] API Retry Pattern
|
|
92
|
+
Source: CLAUDE.md
|
|
93
|
+
|
|
94
|
+
[testing] Mock Database Setup
|
|
95
|
+
Source: tests/setup.ts
|
|
96
|
+
|
|
97
|
+
Scan complete. Run `/wiki browse` to see entries.
|
|
98
|
+
```
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: wiki-search
|
|
3
|
+
description: Search the Solvdex wiki for solutions by keywords, tags, or error patterns. Use when looking for existing knowledge about a problem.
|
|
4
|
+
argument-hint: <query>
|
|
5
|
+
user-invocable: true
|
|
6
|
+
disable-model-invocation: false
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Search Solvdex
|
|
10
|
+
|
|
11
|
+
Find relevant wiki entries by keywords, tags, or error patterns.
|
|
12
|
+
|
|
13
|
+
## Process
|
|
14
|
+
|
|
15
|
+
1. Parse search query
|
|
16
|
+
2. Search by:
|
|
17
|
+
- Title match (highest weight)
|
|
18
|
+
- Tag match
|
|
19
|
+
- Content match
|
|
20
|
+
- Trigger pattern match (for error text)
|
|
21
|
+
3. Filter by confidence threshold
|
|
22
|
+
4. Return best matches sorted by relevance
|
|
23
|
+
|
|
24
|
+
## Implementation
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
import { searchWiki, matchTrigger, wikiExists, CONFIDENCE } from 'solvdex';
|
|
28
|
+
|
|
29
|
+
const projectRoot = process.cwd();
|
|
30
|
+
const query = $ARGUMENTS;
|
|
31
|
+
|
|
32
|
+
if (!wikiExists(projectRoot)) {
|
|
33
|
+
console.log('No wiki found. Run `/wiki init` first.');
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Check if query looks like an error message
|
|
38
|
+
const isErrorText = query.includes('error') || query.includes('Error') || query.includes('failed');
|
|
39
|
+
|
|
40
|
+
let results;
|
|
41
|
+
if (isErrorText) {
|
|
42
|
+
results = await matchTrigger(projectRoot, query);
|
|
43
|
+
if (results.length === 0) {
|
|
44
|
+
results = await searchWiki(projectRoot, { query });
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
47
|
+
results = await searchWiki(projectRoot, { query });
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (results.length === 0) {
|
|
51
|
+
console.log(`No entries found for: "${query}"`);
|
|
52
|
+
console.log('');
|
|
53
|
+
console.log('Try:');
|
|
54
|
+
console.log(' - Different keywords');
|
|
55
|
+
console.log(' - `/wiki browse` to see all entries');
|
|
56
|
+
console.log(' - `/wiki add` to create a new entry');
|
|
57
|
+
} else {
|
|
58
|
+
console.log(`Found ${results.length} entries:\n`);
|
|
59
|
+
|
|
60
|
+
for (const { entry, score, matchedOn } of results.slice(0, 5)) {
|
|
61
|
+
const status = entry.frontmatter.status === 'active' ? 'Active' : 'Flagged';
|
|
62
|
+
const conf = entry.frontmatter.confidence;
|
|
63
|
+
console.log(`[${status}] ${entry.frontmatter.title}`);
|
|
64
|
+
console.log(` Path: ${entry.path}`);
|
|
65
|
+
console.log(` Tags: ${entry.frontmatter.tags.join(', ')}`);
|
|
66
|
+
console.log(` Confidence: ${conf} | Matched: ${matchedOn.join(', ')}`);
|
|
67
|
+
console.log('');
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Output Example
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
Found 2 entries:
|
|
76
|
+
|
|
77
|
+
[Active] Drizzle Enum Migration Error
|
|
78
|
+
Path: issues/drizzle-enum-error.md
|
|
79
|
+
Tags: drizzle, database, enum, migration
|
|
80
|
+
Confidence: 80 | Matched: title, tags, trigger
|
|
81
|
+
|
|
82
|
+
[Active] PostgreSQL Type Casting Issues
|
|
83
|
+
Path: issues/postgres-type-casting.md
|
|
84
|
+
Tags: postgres, database, types
|
|
85
|
+
Confidence: 50 | Matched: tags
|
|
86
|
+
```
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: wiki-stats
|
|
3
|
+
description: Show detailed Solvdex wiki statistics with usage analytics, health score, stale entries, and confidence distribution.
|
|
4
|
+
argument-hint: [--decay]
|
|
5
|
+
user-invocable: true
|
|
6
|
+
disable-model-invocation: false
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Solvdex Stats
|
|
10
|
+
|
|
11
|
+
Display comprehensive wiki statistics including usage analytics, stale entries, and health score.
|
|
12
|
+
|
|
13
|
+
## Options
|
|
14
|
+
|
|
15
|
+
- `--decay`: Apply confidence decay to stale entries (90+ days old)
|
|
16
|
+
|
|
17
|
+
## Implementation
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { wikiExists, getExtendedStats, applyConfidenceDecay, DEFAULT_CATEGORIES } from 'solvdex';
|
|
21
|
+
|
|
22
|
+
const projectRoot = process.cwd();
|
|
23
|
+
const applyDecay = $ARGUMENTS.includes('--decay');
|
|
24
|
+
|
|
25
|
+
if (!wikiExists(projectRoot)) {
|
|
26
|
+
console.log('No wiki found. Run `/wiki init` first.');
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const stats = await getExtendedStats(projectRoot);
|
|
31
|
+
|
|
32
|
+
console.log('# Solvdex Statistics\n');
|
|
33
|
+
|
|
34
|
+
// Health Score
|
|
35
|
+
const healthEmoji = stats.healthScore >= 80 ? '🟢' : stats.healthScore >= 50 ? '🟡' : '🔴';
|
|
36
|
+
console.log(`## Health Score: ${healthEmoji} ${stats.healthScore}/100\n`);
|
|
37
|
+
|
|
38
|
+
// Entry counts
|
|
39
|
+
console.log('## Entries');
|
|
40
|
+
console.log(` Total: ${stats.total}`);
|
|
41
|
+
console.log(` Active: ${stats.active}`);
|
|
42
|
+
console.log(` Flagged: ${stats.flagged}`);
|
|
43
|
+
console.log(` Deprecated: ${stats.deprecated}`);
|
|
44
|
+
console.log(` Stubs: ${stats.stubs}`);
|
|
45
|
+
console.log('');
|
|
46
|
+
|
|
47
|
+
// By Category
|
|
48
|
+
console.log('## By Category');
|
|
49
|
+
for (const [category, count] of Object.entries(stats.byCategory)) {
|
|
50
|
+
console.log(` ${category}: ${count}`);
|
|
51
|
+
}
|
|
52
|
+
console.log('');
|
|
53
|
+
|
|
54
|
+
// Confidence Distribution
|
|
55
|
+
console.log('## Confidence Distribution');
|
|
56
|
+
console.log(` High (80-100): ${stats.highConfidence}`);
|
|
57
|
+
console.log(` Medium (50-79): ${stats.mediumConfidence}`);
|
|
58
|
+
console.log(` Low (0-49): ${stats.lowConfidence}`);
|
|
59
|
+
console.log('');
|
|
60
|
+
|
|
61
|
+
// Usage Stats
|
|
62
|
+
console.log('## Usage Analytics');
|
|
63
|
+
console.log(` Total uses: ${stats.totalUseCount}`);
|
|
64
|
+
console.log(` Average age: ${stats.averageAge} days`);
|
|
65
|
+
|
|
66
|
+
if (stats.mostUsed.length > 0) {
|
|
67
|
+
console.log('\n### Most Used Entries');
|
|
68
|
+
for (const entry of stats.mostUsed) {
|
|
69
|
+
console.log(` - ${entry.title} (${entry.useCount} uses)`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (stats.neverUsed.length > 0) {
|
|
74
|
+
console.log(`\n### Never Used: ${stats.neverUsed.length} entries`);
|
|
75
|
+
for (const entry of stats.neverUsed.slice(0, 5)) {
|
|
76
|
+
console.log(` - ${entry.title}`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Stale Entries
|
|
81
|
+
if (stats.staleEntries.length > 0) {
|
|
82
|
+
console.log('\n## Stale Entries (90+ days)');
|
|
83
|
+
for (const entry of stats.staleEntries.slice(0, 5)) {
|
|
84
|
+
console.log(` - ${entry.title} (${entry.daysSinceUpdate} days)`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Apply decay if requested
|
|
89
|
+
if (applyDecay) {
|
|
90
|
+
console.log('\n## Applying Confidence Decay...');
|
|
91
|
+
const decayed = await applyConfidenceDecay(projectRoot);
|
|
92
|
+
if (decayed.length > 0) {
|
|
93
|
+
console.log(` Decayed ${decayed.length} entries`);
|
|
94
|
+
} else {
|
|
95
|
+
console.log(' No entries needed decay');
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Output
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
# Solvdex Statistics
|
|
104
|
+
|
|
105
|
+
## Health Score: 🟢 85/100
|
|
106
|
+
|
|
107
|
+
## Entries
|
|
108
|
+
Total: 18
|
|
109
|
+
Active: 15
|
|
110
|
+
Flagged: 2
|
|
111
|
+
Deprecated: 1
|
|
112
|
+
Stubs: 4
|
|
113
|
+
|
|
114
|
+
## Confidence Distribution
|
|
115
|
+
High (80-100): 8
|
|
116
|
+
Medium (50-79): 7
|
|
117
|
+
Low (0-49): 3
|
|
118
|
+
|
|
119
|
+
## Usage Analytics
|
|
120
|
+
Total uses: 42
|
|
121
|
+
Average age: 30 days
|
|
122
|
+
|
|
123
|
+
### Most Used Entries
|
|
124
|
+
- Database Connection Timeout (15 uses)
|
|
125
|
+
- React State Management Pattern (12 uses)
|
|
126
|
+
|
|
127
|
+
## Stale Entries (90+ days)
|
|
128
|
+
- Old Authentication Flow (120 days)
|
|
129
|
+
```
|