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,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stringSimilarity = stringSimilarity;
|
|
4
|
+
exports.tagSimilarity = tagSimilarity;
|
|
5
|
+
exports.checkForDuplicate = checkForDuplicate;
|
|
6
|
+
exports.findRelatedEntries = findRelatedEntries;
|
|
7
|
+
/**
|
|
8
|
+
* Calculates similarity between two strings using Levenshtein distance.
|
|
9
|
+
* Returns a score between 0 (completely different) and 1 (identical).
|
|
10
|
+
*/
|
|
11
|
+
function stringSimilarity(a, b) {
|
|
12
|
+
const aLower = a.toLowerCase().trim();
|
|
13
|
+
const bLower = b.toLowerCase().trim();
|
|
14
|
+
if (aLower === bLower)
|
|
15
|
+
return 1;
|
|
16
|
+
if (aLower.length === 0 || bLower.length === 0)
|
|
17
|
+
return 0;
|
|
18
|
+
// Simple word overlap for longer strings (more efficient)
|
|
19
|
+
const aWords = new Set(aLower.split(/\s+/));
|
|
20
|
+
const bWords = new Set(bLower.split(/\s+/));
|
|
21
|
+
const intersection = [...aWords].filter(w => bWords.has(w)).length;
|
|
22
|
+
const union = new Set([...aWords, ...bWords]).size;
|
|
23
|
+
return intersection / union; // Jaccard similarity
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Calculates tag overlap between two tag arrays.
|
|
27
|
+
* Returns a score between 0 (no overlap) and 1 (identical).
|
|
28
|
+
*/
|
|
29
|
+
function tagSimilarity(tagsA, tagsB) {
|
|
30
|
+
if (tagsA.length === 0 && tagsB.length === 0)
|
|
31
|
+
return 0;
|
|
32
|
+
if (tagsA.length === 0 || tagsB.length === 0)
|
|
33
|
+
return 0;
|
|
34
|
+
const setA = new Set(tagsA.map(t => t.toLowerCase()));
|
|
35
|
+
const setB = new Set(tagsB.map(t => t.toLowerCase()));
|
|
36
|
+
const intersection = [...setA].filter(t => setB.has(t)).length;
|
|
37
|
+
const union = new Set([...setA, ...setB]).size;
|
|
38
|
+
return intersection / union;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Checks if a new entry might be a duplicate of existing entries.
|
|
42
|
+
*
|
|
43
|
+
* @param title - The title of the new entry
|
|
44
|
+
* @param tags - The tags of the new entry
|
|
45
|
+
* @param category - The category of the new entry
|
|
46
|
+
* @param existingEntries - List of existing entries to check against
|
|
47
|
+
* @param threshold - Similarity threshold (default 0.7)
|
|
48
|
+
* @returns DuplicateCheckResult with matched entry if found
|
|
49
|
+
*/
|
|
50
|
+
function checkForDuplicate(title, tags, category, existingEntries, threshold = 0.7) {
|
|
51
|
+
// Only check entries in the same category
|
|
52
|
+
const sameCategory = existingEntries.filter(e => e.category === category);
|
|
53
|
+
for (const entry of sameCategory) {
|
|
54
|
+
const titleSim = stringSimilarity(title, entry.frontmatter.title);
|
|
55
|
+
const tagSim = tagSimilarity(tags, entry.frontmatter.tags);
|
|
56
|
+
// Weighted score: title is more important
|
|
57
|
+
const combinedScore = titleSim * 0.7 + tagSim * 0.3;
|
|
58
|
+
if (combinedScore >= threshold) {
|
|
59
|
+
return {
|
|
60
|
+
isDuplicate: true,
|
|
61
|
+
similarity: combinedScore,
|
|
62
|
+
matchedEntry: entry,
|
|
63
|
+
reason: `Similar to "${entry.frontmatter.title}" (${Math.round(combinedScore * 100)}% match)`
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
// Also check for exact title match regardless of threshold
|
|
67
|
+
if (titleSim === 1) {
|
|
68
|
+
return {
|
|
69
|
+
isDuplicate: true,
|
|
70
|
+
similarity: 1,
|
|
71
|
+
matchedEntry: entry,
|
|
72
|
+
reason: `Exact title match: "${entry.frontmatter.title}"`
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
isDuplicate: false,
|
|
78
|
+
similarity: 0
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Finds related entries based on tag and title similarity.
|
|
83
|
+
*
|
|
84
|
+
* @param entry - The entry to find relations for
|
|
85
|
+
* @param allEntries - All wiki entries
|
|
86
|
+
* @param maxResults - Maximum number of related entries to return
|
|
87
|
+
* @param threshold - Minimum similarity threshold
|
|
88
|
+
* @returns Array of related entry paths sorted by similarity
|
|
89
|
+
*/
|
|
90
|
+
function findRelatedEntries(entry, allEntries, maxResults = 5, threshold = 0.3) {
|
|
91
|
+
const scores = [];
|
|
92
|
+
for (const other of allEntries) {
|
|
93
|
+
// Skip self
|
|
94
|
+
if (other.path === entry.path)
|
|
95
|
+
continue;
|
|
96
|
+
const titleSim = stringSimilarity(entry.frontmatter.title, other.frontmatter.title);
|
|
97
|
+
const tagSim = tagSimilarity(entry.frontmatter.tags, other.frontmatter.tags);
|
|
98
|
+
// Cross-category bonus for shared tags
|
|
99
|
+
const crossCategoryBonus = entry.category !== other.category && tagSim > 0.5 ? 0.1 : 0;
|
|
100
|
+
const score = titleSim * 0.4 + tagSim * 0.5 + crossCategoryBonus;
|
|
101
|
+
if (score >= threshold) {
|
|
102
|
+
scores.push({ path: other.path, score });
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// Sort by score descending and return top results
|
|
106
|
+
return scores
|
|
107
|
+
.sort((a, b) => b.score - a.score)
|
|
108
|
+
.slice(0, maxResults)
|
|
109
|
+
.map(s => s.path);
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=similarity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"similarity.js","sourceRoot":"","sources":["../../src/similarity.ts"],"names":[],"mappings":";;AAOA,4CAeC;AAMD,sCAWC;AAsBD,8CAyCC;AAWD,gDA8BC;AA5ID;;;GAGG;AACH,SAAgB,gBAAgB,CAAC,CAAS,EAAE,CAAS;IACnD,MAAM,MAAM,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;IACtC,MAAM,MAAM,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;IAEtC,IAAI,MAAM,KAAK,MAAM;QAAE,OAAO,CAAC,CAAC;IAChC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IAEzD,0DAA0D;IAC1D,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IAC5C,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IAE5C,MAAM,YAAY,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IACnE,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;IAEnD,OAAO,YAAY,GAAG,KAAK,C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CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAE7E,uCAAuC;QACvC,MAAM,kBAAkB,GAAG,KAAK,CAAC,QAAQ,KAAK,KAAK,CAAC,QAAQ,IAAI,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAEvF,MAAM,KAAK,GAAG,QAAQ,GAAG,GAAG,GAAG,MAAM,GAAG,GAAG,GAAG,kBAAkB,CAAC;QAEjE,IAAI,KAAK,IAAI,SAAS,EAAE,CAAC;YACvB,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;IAED,kDAAkD;IAClD,OAAO,MAAM;SACV,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC;SACjC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC;SACpB,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { WikiStats } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Extended statistics for wiki health dashboard.
|
|
4
|
+
*/
|
|
5
|
+
export interface ExtendedWikiStats extends WikiStats {
|
|
6
|
+
totalUseCount: number;
|
|
7
|
+
mostUsed: {
|
|
8
|
+
path: string;
|
|
9
|
+
title: string;
|
|
10
|
+
useCount: number;
|
|
11
|
+
}[];
|
|
12
|
+
neverUsed: {
|
|
13
|
+
path: string;
|
|
14
|
+
title: string;
|
|
15
|
+
}[];
|
|
16
|
+
staleEntries: {
|
|
17
|
+
path: string;
|
|
18
|
+
title: string;
|
|
19
|
+
daysSinceUpdate: number;
|
|
20
|
+
}[];
|
|
21
|
+
averageAge: number;
|
|
22
|
+
highConfidence: number;
|
|
23
|
+
mediumConfidence: number;
|
|
24
|
+
lowConfidence: number;
|
|
25
|
+
healthScore: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Gets comprehensive wiki statistics.
|
|
29
|
+
*
|
|
30
|
+
* @param projectRoot - The root directory of the project
|
|
31
|
+
* @param staleDays - Number of days without update to consider stale (default 90)
|
|
32
|
+
* @returns ExtendedWikiStats with all metrics
|
|
33
|
+
*/
|
|
34
|
+
export declare function getExtendedStats(projectRoot: string, staleDays?: number): Promise<ExtendedWikiStats>;
|
|
35
|
+
/**
|
|
36
|
+
* Gets basic wiki stats (compatible with existing WikiStats interface).
|
|
37
|
+
*
|
|
38
|
+
* @param projectRoot - The root directory of the project
|
|
39
|
+
* @returns Basic WikiStats
|
|
40
|
+
*/
|
|
41
|
+
export declare function getStats(projectRoot: string): Promise<WikiStats>;
|
|
42
|
+
/**
|
|
43
|
+
* Applies confidence decay to stale entries.
|
|
44
|
+
* Reduces confidence by a percentage for entries not updated in a while.
|
|
45
|
+
*
|
|
46
|
+
* @param projectRoot - The root directory of the project
|
|
47
|
+
* @param staleDays - Days since update to start decay (default 90)
|
|
48
|
+
* @param decayPercent - Percentage to reduce confidence (default 10)
|
|
49
|
+
* @returns List of entries that were decayed
|
|
50
|
+
*/
|
|
51
|
+
export declare function applyConfidenceDecay(projectRoot: string, staleDays?: number, decayPercent?: number): Promise<{
|
|
52
|
+
path: string;
|
|
53
|
+
oldConfidence: number;
|
|
54
|
+
newConfidence: number;
|
|
55
|
+
}[]>;
|
|
56
|
+
//# sourceMappingURL=stats.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../src/stats.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAc,MAAM,YAAY,CAAC;AAInD;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,SAAS;IAElD,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC9D,SAAS,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAG7C,YAAY,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,eAAe,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACzE,UAAU,EAAE,MAAM,CAAC;IAGnB,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IAGtB,WAAW,EAAE,MAAM,CAAC;CACrB;AAYD;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACpC,WAAW,EAAE,MAAM,EACnB,SAAS,GAAE,MAAW,GACrB,OAAO,CAAC,iBAAiB,CAAC,CAoG5B;AA2CD;;;;;GAKG;AACH,wBAAsB,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAWtE;AAED;;;;;;;;GAQG;AACH,wBAAsB,oBAAoB,CACxC,WAAW,EAAE,MAAM,EACnB,SAAS,GAAE,MAAW,EACtB,YAAY,GAAE,MAAW,GACxB,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,EAAE,CAAC,CA+C3E"}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getExtendedStats = getExtendedStats;
|
|
4
|
+
exports.getStats = getStats;
|
|
5
|
+
exports.applyConfidenceDecay = applyConfidenceDecay;
|
|
6
|
+
// src/stats.ts
|
|
7
|
+
const types_js_1 = require("./types.js");
|
|
8
|
+
const entry_js_1 = require("./entry.js");
|
|
9
|
+
const config_js_1 = require("./config.js");
|
|
10
|
+
/**
|
|
11
|
+
* Calculates days since a date string (ISO format).
|
|
12
|
+
*/
|
|
13
|
+
function daysSince(dateStr) {
|
|
14
|
+
const date = new Date(dateStr);
|
|
15
|
+
const now = new Date();
|
|
16
|
+
const diffMs = now.getTime() - date.getTime();
|
|
17
|
+
return Math.floor(diffMs / (1000 * 60 * 60 * 24));
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Gets comprehensive wiki statistics.
|
|
21
|
+
*
|
|
22
|
+
* @param projectRoot - The root directory of the project
|
|
23
|
+
* @param staleDays - Number of days without update to consider stale (default 90)
|
|
24
|
+
* @returns ExtendedWikiStats with all metrics
|
|
25
|
+
*/
|
|
26
|
+
async function getExtendedStats(projectRoot, staleDays = 90) {
|
|
27
|
+
if (!(0, config_js_1.wikiExists)(projectRoot)) {
|
|
28
|
+
throw new Error('Wiki not initialized');
|
|
29
|
+
}
|
|
30
|
+
const entries = await (0, entry_js_1.listEntries)(projectRoot);
|
|
31
|
+
// Basic counts
|
|
32
|
+
const total = entries.length;
|
|
33
|
+
const active = entries.filter(e => e.frontmatter.status === 'active').length;
|
|
34
|
+
const flagged = entries.filter(e => e.frontmatter.status === 'flagged').length;
|
|
35
|
+
const deprecated = entries.filter(e => e.frontmatter.status === 'deprecated').length;
|
|
36
|
+
const stubs = entries.filter(e => e.frontmatter.stub).length;
|
|
37
|
+
// By category
|
|
38
|
+
const byCategory = {};
|
|
39
|
+
for (const entry of entries) {
|
|
40
|
+
byCategory[entry.category] = (byCategory[entry.category] || 0) + 1;
|
|
41
|
+
}
|
|
42
|
+
// Usage stats
|
|
43
|
+
let totalUseCount = 0;
|
|
44
|
+
const usageData = [];
|
|
45
|
+
for (const entry of entries) {
|
|
46
|
+
const useCount = entry.frontmatter.use_count || 0;
|
|
47
|
+
totalUseCount += useCount;
|
|
48
|
+
usageData.push({
|
|
49
|
+
path: entry.path,
|
|
50
|
+
title: entry.frontmatter.title,
|
|
51
|
+
useCount
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
// Sort for most/least used
|
|
55
|
+
const sortedByUse = [...usageData].sort((a, b) => b.useCount - a.useCount);
|
|
56
|
+
const mostUsed = sortedByUse.filter(e => e.useCount > 0).slice(0, 5);
|
|
57
|
+
const neverUsed = sortedByUse
|
|
58
|
+
.filter(e => e.useCount === 0)
|
|
59
|
+
.map(e => ({ path: e.path, title: e.title }));
|
|
60
|
+
// Staleness
|
|
61
|
+
const staleEntries = [];
|
|
62
|
+
let totalAge = 0;
|
|
63
|
+
for (const entry of entries) {
|
|
64
|
+
const days = daysSince(entry.frontmatter.updated);
|
|
65
|
+
totalAge += days;
|
|
66
|
+
if (days >= staleDays && entry.frontmatter.status === 'active') {
|
|
67
|
+
staleEntries.push({
|
|
68
|
+
path: entry.path,
|
|
69
|
+
title: entry.frontmatter.title,
|
|
70
|
+
daysSinceUpdate: days
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
const averageAge = total > 0 ? Math.round(totalAge / total) : 0;
|
|
75
|
+
// Sort stale by days descending
|
|
76
|
+
staleEntries.sort((a, b) => b.daysSinceUpdate - a.daysSinceUpdate);
|
|
77
|
+
// Confidence distribution
|
|
78
|
+
const highConfidence = entries.filter(e => e.frontmatter.confidence >= types_js_1.CONFIDENCE.HIGH).length;
|
|
79
|
+
const mediumConfidence = entries.filter(e => e.frontmatter.confidence >= types_js_1.CONFIDENCE.MEDIUM && e.frontmatter.confidence < types_js_1.CONFIDENCE.HIGH).length;
|
|
80
|
+
const lowConfidence = entries.filter(e => e.frontmatter.confidence < types_js_1.CONFIDENCE.MEDIUM).length;
|
|
81
|
+
// Health score calculation
|
|
82
|
+
// Factors: active ratio, stale ratio, flagged ratio, stub ratio, usage
|
|
83
|
+
const healthScore = calculateHealthScore({
|
|
84
|
+
total,
|
|
85
|
+
active,
|
|
86
|
+
flagged,
|
|
87
|
+
deprecated,
|
|
88
|
+
stubs,
|
|
89
|
+
staleCount: staleEntries.length,
|
|
90
|
+
neverUsedCount: neverUsed.length,
|
|
91
|
+
highConfidence
|
|
92
|
+
});
|
|
93
|
+
return {
|
|
94
|
+
total,
|
|
95
|
+
active,
|
|
96
|
+
flagged,
|
|
97
|
+
deprecated,
|
|
98
|
+
stubs,
|
|
99
|
+
byCategory,
|
|
100
|
+
totalUseCount,
|
|
101
|
+
mostUsed,
|
|
102
|
+
neverUsed: neverUsed.slice(0, 10), // Limit to 10
|
|
103
|
+
staleEntries: staleEntries.slice(0, 10), // Limit to 10
|
|
104
|
+
averageAge,
|
|
105
|
+
highConfidence,
|
|
106
|
+
mediumConfidence,
|
|
107
|
+
lowConfidence,
|
|
108
|
+
healthScore
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Calculates a health score (0-100) for the wiki.
|
|
113
|
+
*/
|
|
114
|
+
function calculateHealthScore(input) {
|
|
115
|
+
if (input.total === 0)
|
|
116
|
+
return 100; // Empty wiki is healthy
|
|
117
|
+
// Active ratio (0-30 points)
|
|
118
|
+
const activeRatio = input.active / input.total;
|
|
119
|
+
const activeScore = activeRatio * 30;
|
|
120
|
+
// Low flagged ratio (0-20 points)
|
|
121
|
+
const flaggedRatio = input.flagged / input.total;
|
|
122
|
+
const flaggedScore = (1 - flaggedRatio) * 20;
|
|
123
|
+
// Low stale ratio (0-20 points)
|
|
124
|
+
const staleRatio = input.staleCount / input.total;
|
|
125
|
+
const staleScore = (1 - staleRatio) * 20;
|
|
126
|
+
// Low stub ratio (0-15 points)
|
|
127
|
+
const stubRatio = input.stubs / input.total;
|
|
128
|
+
const stubScore = (1 - stubRatio) * 15;
|
|
129
|
+
// High confidence ratio (0-15 points)
|
|
130
|
+
const highConfRatio = input.highConfidence / input.total;
|
|
131
|
+
const confScore = highConfRatio * 15;
|
|
132
|
+
const total = activeScore + flaggedScore + staleScore + stubScore + confScore;
|
|
133
|
+
return Math.round(Math.max(0, Math.min(100, total)));
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Gets basic wiki stats (compatible with existing WikiStats interface).
|
|
137
|
+
*
|
|
138
|
+
* @param projectRoot - The root directory of the project
|
|
139
|
+
* @returns Basic WikiStats
|
|
140
|
+
*/
|
|
141
|
+
async function getStats(projectRoot) {
|
|
142
|
+
const extended = await getExtendedStats(projectRoot);
|
|
143
|
+
return {
|
|
144
|
+
total: extended.total,
|
|
145
|
+
active: extended.active,
|
|
146
|
+
flagged: extended.flagged,
|
|
147
|
+
deprecated: extended.deprecated,
|
|
148
|
+
stubs: extended.stubs,
|
|
149
|
+
byCategory: extended.byCategory
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Applies confidence decay to stale entries.
|
|
154
|
+
* Reduces confidence by a percentage for entries not updated in a while.
|
|
155
|
+
*
|
|
156
|
+
* @param projectRoot - The root directory of the project
|
|
157
|
+
* @param staleDays - Days since update to start decay (default 90)
|
|
158
|
+
* @param decayPercent - Percentage to reduce confidence (default 10)
|
|
159
|
+
* @returns List of entries that were decayed
|
|
160
|
+
*/
|
|
161
|
+
async function applyConfidenceDecay(projectRoot, staleDays = 90, decayPercent = 10) {
|
|
162
|
+
const { updateEntry } = await import('./entry.js');
|
|
163
|
+
const entries = await (0, entry_js_1.listEntries)(projectRoot);
|
|
164
|
+
const decayed = [];
|
|
165
|
+
for (const entry of entries) {
|
|
166
|
+
// Skip non-active entries
|
|
167
|
+
if (entry.frontmatter.status !== 'active')
|
|
168
|
+
continue;
|
|
169
|
+
// Skip recently used entries
|
|
170
|
+
if (entry.frontmatter.last_used) {
|
|
171
|
+
const daysSinceUsed = daysSince(entry.frontmatter.last_used);
|
|
172
|
+
if (daysSinceUsed < staleDays)
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
const daysSinceUpdate = daysSince(entry.frontmatter.updated);
|
|
176
|
+
if (daysSinceUpdate < staleDays)
|
|
177
|
+
continue;
|
|
178
|
+
// Calculate decay based on how stale (more stale = more decay)
|
|
179
|
+
const staleMultiplier = Math.min(3, Math.floor(daysSinceUpdate / staleDays));
|
|
180
|
+
const totalDecay = decayPercent * staleMultiplier;
|
|
181
|
+
const oldConfidence = entry.frontmatter.confidence;
|
|
182
|
+
const newConfidence = Math.max(types_js_1.CONFIDENCE.MIN, oldConfidence - totalDecay);
|
|
183
|
+
if (newConfidence < oldConfidence) {
|
|
184
|
+
updateEntry(projectRoot, entry.path, { confidence: newConfidence }, {
|
|
185
|
+
by: 'system',
|
|
186
|
+
reason: `Confidence decay: ${daysSinceUpdate} days since update`,
|
|
187
|
+
context: 'auto-decay'
|
|
188
|
+
});
|
|
189
|
+
decayed.push({
|
|
190
|
+
path: entry.path,
|
|
191
|
+
oldConfidence,
|
|
192
|
+
newConfidence
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return decayed;
|
|
197
|
+
}
|
|
198
|
+
//# sourceMappingURL=stats.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stats.js","sourceRoot":"","sources":["../../src/stats.ts"],"names":[],"mappings":";;AA4CA,4CAuGC;AAiDD,4BAWC;AAWD,oDAmDC;AA7QD,eAAe;AACf,yCAAmD;AACnD,yCAAyC;AACzC,2CAAyC;AAwBzC;;GAEG;AACH,SAAS,SAAS,CAAC,OAAe;IAChC,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/B,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IACvB,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;IAC9C,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;AACpD,CAAC;AAED;;;;;;GAMG;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C,OAAO,CAAC,CAAC;QAC7D,IAAI,eAAe,GAAG,SAAS;YAAE,SAAS;QAE1C,+DAA+D;QAC/D,MAAM,eAAe,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,eAAe,GAAG,SAAS,CAAC,CAAC,CAAC;QAC7E,MAAM,UAAU,GAAG,YAAY,GAAG,eAAe,CAAC;QAElD,MAAM,aAAa,GAAG,KAAK,CAAC,WAAW,CAAC,UAAU,CAAC;QACnD,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,qBAAU,CAAC,GAAG,EAAE,aAAa,GAAG,UAAU,CAAC,CAAC;QAE3E,IAAI,aAAa,GAAG,aAAa,EAAE,CAAC;YAClC,WAAW,CACT,WAAW,EACX,KAAK,CAAC,IAAI,EACV,EAAE,UAAU,EAAE,aAAa,EAAE,EAC7B;gBACE,EAAE,EAAE,QAAQ;gBACZ,MAAM,EAAE,qBAAqB,eAAe,oBAAoB;gBAChE,OAAO,EAAE,YAAY;aACtB,CACF,CAAC;YAEF,OAAO,CAAC,IAAI,CAAC;gBACX,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,aAAa;gBACb,aAAa;aACd,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a section within a category template.
|
|
3
|
+
*/
|
|
4
|
+
export interface TemplateSection {
|
|
5
|
+
heading: string;
|
|
6
|
+
placeholder: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Template definitions for each default category.
|
|
10
|
+
* Maps category names to their template sections.
|
|
11
|
+
*/
|
|
12
|
+
export declare const CATEGORY_TEMPLATES: Record<string, TemplateSection[]>;
|
|
13
|
+
/**
|
|
14
|
+
* Gets the template sections for a given category.
|
|
15
|
+
* Falls back to 'issues' template if category is not found.
|
|
16
|
+
*
|
|
17
|
+
* @param category - The category name
|
|
18
|
+
* @returns Array of template sections for the category
|
|
19
|
+
*/
|
|
20
|
+
export declare function getTemplate(category: string): TemplateSection[];
|
|
21
|
+
/**
|
|
22
|
+
* Generates stub content with TODO placeholders for a given category.
|
|
23
|
+
* Useful for creating new entries that need to be filled in later.
|
|
24
|
+
*
|
|
25
|
+
* @param category - The category name
|
|
26
|
+
* @returns Record mapping heading names to placeholder content with TODO markers
|
|
27
|
+
*/
|
|
28
|
+
export declare function generateStubContent(category: string): Record<string, string>;
|
|
29
|
+
/**
|
|
30
|
+
* Generates category overview markdown content.
|
|
31
|
+
* Creates a formatted overview page for a category with usage instructions
|
|
32
|
+
* and placeholders for auto-populated sections.
|
|
33
|
+
*
|
|
34
|
+
* @param category - The category name
|
|
35
|
+
* @returns Formatted markdown string for the category overview
|
|
36
|
+
*/
|
|
37
|
+
export declare function generateOverviewContent(category: string): string;
|
|
38
|
+
/**
|
|
39
|
+
* Gets all available template category names.
|
|
40
|
+
*
|
|
41
|
+
* @returns Array of category names that have templates defined
|
|
42
|
+
*/
|
|
43
|
+
export declare function getAvailableTemplates(): string[];
|
|
44
|
+
/**
|
|
45
|
+
* Checks if a template exists for the given category.
|
|
46
|
+
*
|
|
47
|
+
* @param category - The category name to check
|
|
48
|
+
* @returns True if a template exists for the category
|
|
49
|
+
*/
|
|
50
|
+
export declare function hasTemplate(category: string): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Gets the description for a category.
|
|
53
|
+
*
|
|
54
|
+
* @param category - The category name
|
|
55
|
+
* @returns The category description or a default message
|
|
56
|
+
*/
|
|
57
|
+
export declare function getCategoryDescription(category: string): string;
|
|
58
|
+
/**
|
|
59
|
+
* Generates the content for the wiki README.md file.
|
|
60
|
+
* @returns Formatted markdown string for the wiki README
|
|
61
|
+
*/
|
|
62
|
+
export declare function generateWikiReadme(): string;
|
|
63
|
+
//# sourceMappingURL=templates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/templates.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,EAAE,CA+HhE,CAAC;AAsDF;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,eAAe,EAAE,CAE/D;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAS5E;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAqBhE;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,EAAE,CAEhD;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAErD;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAoE3C"}
|