@ryuenn3123/agentic-senior-core 1.9.0 → 1.9.1
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/.agent-context/blueprints/mobile-app.md +21 -21
- package/.agent-context/policies/llm-judge-threshold.json +19 -19
- package/.agent-context/profiles/platform.md +13 -13
- package/.agent-context/profiles/regulated.md +13 -13
- package/.agent-context/profiles/startup.md +13 -13
- package/.agent-context/review-checklists/frontend-skill-parity.md +28 -28
- package/.agent-context/review-checklists/frontend-usability.md +33 -33
- package/.agent-context/review-checklists/release-operations.md +29 -29
- package/.agent-context/skills/README.md +62 -62
- package/.agent-context/skills/backend/README.md +67 -67
- package/.agent-context/skills/backend/architecture.md +360 -360
- package/.agent-context/skills/backend/data-access.md +230 -230
- package/.agent-context/skills/backend/errors.md +137 -137
- package/.agent-context/skills/backend/validation.md +116 -116
- package/.agent-context/skills/backend.md +28 -28
- package/.agent-context/skills/cli/README.md +49 -49
- package/.agent-context/skills/cli/init.md +37 -37
- package/.agent-context/skills/cli/output.md +35 -35
- package/.agent-context/skills/cli/upgrade.md +37 -37
- package/.agent-context/skills/cli.md +28 -28
- package/.agent-context/skills/distribution/README.md +18 -18
- package/.agent-context/skills/distribution/compatibility.md +31 -31
- package/.agent-context/skills/distribution/publish.md +36 -36
- package/.agent-context/skills/distribution/rollback.md +31 -31
- package/.agent-context/skills/distribution.md +28 -28
- package/.agent-context/skills/frontend/README.md +35 -35
- package/.agent-context/skills/frontend/accessibility.md +107 -107
- package/.agent-context/skills/frontend/motion.md +66 -66
- package/.agent-context/skills/frontend/performance.md +62 -62
- package/.agent-context/skills/frontend/ui-architecture.md +128 -128
- package/.agent-context/skills/frontend.md +29 -29
- package/.agent-context/skills/fullstack/README.md +18 -18
- package/.agent-context/skills/fullstack/contracts.md +52 -52
- package/.agent-context/skills/fullstack/end-to-end.md +41 -41
- package/.agent-context/skills/fullstack/feature-slicing.md +64 -64
- package/.agent-context/skills/fullstack.md +26 -26
- package/.agent-context/skills/index.json +107 -107
- package/.agent-context/skills/review-quality/README.md +18 -18
- package/.agent-context/skills/review-quality/benchmark.md +29 -29
- package/.agent-context/skills/review-quality/planning.md +37 -37
- package/.agent-context/skills/review-quality/security.md +33 -33
- package/.agent-context/skills/review-quality.md +27 -27
- package/.agent-context/stacks/flutter.md +16 -16
- package/.agent-context/stacks/react-native.md +16 -16
- package/.agent-context/state/architecture-map.md +25 -25
- package/.agent-context/state/benchmark-analysis.json +431 -431
- package/.agent-context/state/benchmark-thresholds.json +10 -10
- package/.agent-context/state/benchmark-watchlist.json +19 -19
- package/.agent-context/state/dependency-map.md +32 -32
- package/.agent-context/state/skill-platform.json +38 -38
- package/.agent-override.md +36 -36
- package/.cursorrules +140 -140
- package/.github/ISSUE_TEMPLATE/v1.7-frontend-work-item.yml +54 -54
- package/.github/workflows/benchmark-detection.yml +38 -38
- package/.github/workflows/benchmark-intelligence.yml +50 -50
- package/.github/workflows/frontend-usability-gate.yml +36 -36
- package/.github/workflows/publish.yml +32 -0
- package/.github/workflows/release-gate.yml +32 -32
- package/.github/workflows/sbom-compliance.yml +32 -32
- package/.windsurfrules +106 -106
- package/AGENTS.md +181 -181
- package/README.md +318 -318
- package/bin/agentic-senior-core.js +1556 -1556
- package/mcp.json +92 -92
- package/package.json +1 -1
- package/scripts/benchmark-gate.mjs +121 -121
- package/scripts/benchmark-intelligence.mjs +140 -140
- package/scripts/detection-benchmark.mjs +138 -138
- package/scripts/frontend-usability-audit.mjs +87 -87
- package/scripts/generate-sbom.mjs +61 -61
- package/scripts/init-project.ps1 +104 -104
- package/scripts/llm-judge.mjs +664 -664
- package/scripts/release-gate.mjs +116 -116
- package/scripts/skill-tier-policy.mjs +75 -75
- package/scripts/validate.mjs +636 -636
package/scripts/release-gate.mjs
CHANGED
|
@@ -1,116 +1,116 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* release-gate.mjs
|
|
5
|
-
*
|
|
6
|
-
* Enterprise release gate for V1.8.
|
|
7
|
-
* Produces machine-readable output for CI and fails fast on missing release evidence.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { existsSync, readFileSync } from 'node:fs';
|
|
11
|
-
import { resolve, dirname } from 'node:path';
|
|
12
|
-
import { fileURLToPath } from 'node:url';
|
|
13
|
-
|
|
14
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
15
|
-
const __dirname = dirname(__filename);
|
|
16
|
-
const REPOSITORY_ROOT = resolve(__dirname, '..');
|
|
17
|
-
|
|
18
|
-
const VERSION_PATTERN = /^\d+\.\d+\.\d+$/;
|
|
19
|
-
|
|
20
|
-
function readText(relativeFilePath) {
|
|
21
|
-
const absolutePath = resolve(REPOSITORY_ROOT, relativeFilePath);
|
|
22
|
-
if (!existsSync(absolutePath)) {
|
|
23
|
-
return '';
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return readFileSync(absolutePath, 'utf8');
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function pushResult(results, isPassed, checkName, details) {
|
|
30
|
-
results.push({
|
|
31
|
-
checkName,
|
|
32
|
-
passed: isPassed,
|
|
33
|
-
details,
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function runReleaseGate() {
|
|
38
|
-
const results = [];
|
|
39
|
-
const packageJsonPath = 'package.json';
|
|
40
|
-
const changelogPath = 'CHANGELOG.md';
|
|
41
|
-
const roadmapPath = 'docs/roadmap.md';
|
|
42
|
-
|
|
43
|
-
const packageJsonContent = readText(packageJsonPath);
|
|
44
|
-
if (!packageJsonContent) {
|
|
45
|
-
pushResult(results, false, 'package-json-exists', `Missing ${packageJsonPath}`);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
let packageManifest = null;
|
|
49
|
-
if (packageJsonContent) {
|
|
50
|
-
try {
|
|
51
|
-
packageManifest = JSON.parse(packageJsonContent);
|
|
52
|
-
pushResult(results, true, 'package-json-parse', 'package.json is valid JSON');
|
|
53
|
-
} catch (packageParseError) {
|
|
54
|
-
const parseMessage = packageParseError instanceof Error ? packageParseError.message : 'Unknown parse error';
|
|
55
|
-
pushResult(results, false, 'package-json-parse', `Cannot parse package.json: ${parseMessage}`);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const releaseVersion = packageManifest?.version;
|
|
60
|
-
if (!releaseVersion || !VERSION_PATTERN.test(releaseVersion)) {
|
|
61
|
-
pushResult(results, false, 'version-semver', `Invalid package version: ${String(releaseVersion)}`);
|
|
62
|
-
} else {
|
|
63
|
-
pushResult(results, true, 'version-semver', `Version ${releaseVersion} matches x.y.z format`);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const changelogContent = readText(changelogPath);
|
|
67
|
-
if (!changelogContent) {
|
|
68
|
-
pushResult(results, false, 'changelog-exists', `Missing ${changelogPath}`);
|
|
69
|
-
} else if (!releaseVersion) {
|
|
70
|
-
pushResult(results, false, 'changelog-version-entry', 'Cannot check changelog because version is invalid');
|
|
71
|
-
} else if (!changelogContent.includes(`## ${releaseVersion} - `)) {
|
|
72
|
-
pushResult(results, false, 'changelog-version-entry', `Missing release header for ${releaseVersion} in CHANGELOG.md`);
|
|
73
|
-
} else {
|
|
74
|
-
pushResult(results, true, 'changelog-version-entry', `Found release header for ${releaseVersion}`);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const roadmapContent = readText(roadmapPath);
|
|
78
|
-
if (!roadmapContent) {
|
|
79
|
-
pushResult(results, false, 'roadmap-exists', `Missing ${roadmapPath}`);
|
|
80
|
-
} else if (!roadmapContent.includes('V1.8')) {
|
|
81
|
-
pushResult(results, false, 'roadmap-v18', 'Roadmap does not mention V1.8 release track');
|
|
82
|
-
} else {
|
|
83
|
-
pushResult(results, true, 'roadmap-v18', 'Roadmap includes V1.8 release track');
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const requiredEnterpriseFiles = [
|
|
87
|
-
'.agent-context/review-checklists/release-operations.md',
|
|
88
|
-
'docs/v1.8-operations-playbook.md',
|
|
89
|
-
'.github/workflows/release-gate.yml',
|
|
90
|
-
'.github/workflows/sbom-compliance.yml',
|
|
91
|
-
];
|
|
92
|
-
|
|
93
|
-
for (const requiredEnterpriseFile of requiredEnterpriseFiles) {
|
|
94
|
-
const absoluteRequiredPath = resolve(REPOSITORY_ROOT, requiredEnterpriseFile);
|
|
95
|
-
if (!existsSync(absoluteRequiredPath)) {
|
|
96
|
-
pushResult(results, false, 'required-enterprise-file', `Missing ${requiredEnterpriseFile}`);
|
|
97
|
-
continue;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
pushResult(results, true, 'required-enterprise-file', `${requiredEnterpriseFile} is present`);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const failureCount = results.filter((checkResult) => !checkResult.passed).length;
|
|
104
|
-
const releaseGateReport = {
|
|
105
|
-
generatedAt: new Date().toISOString(),
|
|
106
|
-
gateName: 'release-gate',
|
|
107
|
-
passed: failureCount === 0,
|
|
108
|
-
failureCount,
|
|
109
|
-
results,
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
console.log(JSON.stringify(releaseGateReport, null, 2));
|
|
113
|
-
process.exit(releaseGateReport.passed ? 0 : 1);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
runReleaseGate();
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* release-gate.mjs
|
|
5
|
+
*
|
|
6
|
+
* Enterprise release gate for V1.8.
|
|
7
|
+
* Produces machine-readable output for CI and fails fast on missing release evidence.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
11
|
+
import { resolve, dirname } from 'node:path';
|
|
12
|
+
import { fileURLToPath } from 'node:url';
|
|
13
|
+
|
|
14
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
15
|
+
const __dirname = dirname(__filename);
|
|
16
|
+
const REPOSITORY_ROOT = resolve(__dirname, '..');
|
|
17
|
+
|
|
18
|
+
const VERSION_PATTERN = /^\d+\.\d+\.\d+$/;
|
|
19
|
+
|
|
20
|
+
function readText(relativeFilePath) {
|
|
21
|
+
const absolutePath = resolve(REPOSITORY_ROOT, relativeFilePath);
|
|
22
|
+
if (!existsSync(absolutePath)) {
|
|
23
|
+
return '';
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return readFileSync(absolutePath, 'utf8');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function pushResult(results, isPassed, checkName, details) {
|
|
30
|
+
results.push({
|
|
31
|
+
checkName,
|
|
32
|
+
passed: isPassed,
|
|
33
|
+
details,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function runReleaseGate() {
|
|
38
|
+
const results = [];
|
|
39
|
+
const packageJsonPath = 'package.json';
|
|
40
|
+
const changelogPath = 'CHANGELOG.md';
|
|
41
|
+
const roadmapPath = 'docs/roadmap.md';
|
|
42
|
+
|
|
43
|
+
const packageJsonContent = readText(packageJsonPath);
|
|
44
|
+
if (!packageJsonContent) {
|
|
45
|
+
pushResult(results, false, 'package-json-exists', `Missing ${packageJsonPath}`);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
let packageManifest = null;
|
|
49
|
+
if (packageJsonContent) {
|
|
50
|
+
try {
|
|
51
|
+
packageManifest = JSON.parse(packageJsonContent);
|
|
52
|
+
pushResult(results, true, 'package-json-parse', 'package.json is valid JSON');
|
|
53
|
+
} catch (packageParseError) {
|
|
54
|
+
const parseMessage = packageParseError instanceof Error ? packageParseError.message : 'Unknown parse error';
|
|
55
|
+
pushResult(results, false, 'package-json-parse', `Cannot parse package.json: ${parseMessage}`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const releaseVersion = packageManifest?.version;
|
|
60
|
+
if (!releaseVersion || !VERSION_PATTERN.test(releaseVersion)) {
|
|
61
|
+
pushResult(results, false, 'version-semver', `Invalid package version: ${String(releaseVersion)}`);
|
|
62
|
+
} else {
|
|
63
|
+
pushResult(results, true, 'version-semver', `Version ${releaseVersion} matches x.y.z format`);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const changelogContent = readText(changelogPath);
|
|
67
|
+
if (!changelogContent) {
|
|
68
|
+
pushResult(results, false, 'changelog-exists', `Missing ${changelogPath}`);
|
|
69
|
+
} else if (!releaseVersion) {
|
|
70
|
+
pushResult(results, false, 'changelog-version-entry', 'Cannot check changelog because version is invalid');
|
|
71
|
+
} else if (!changelogContent.includes(`## ${releaseVersion} - `)) {
|
|
72
|
+
pushResult(results, false, 'changelog-version-entry', `Missing release header for ${releaseVersion} in CHANGELOG.md`);
|
|
73
|
+
} else {
|
|
74
|
+
pushResult(results, true, 'changelog-version-entry', `Found release header for ${releaseVersion}`);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const roadmapContent = readText(roadmapPath);
|
|
78
|
+
if (!roadmapContent) {
|
|
79
|
+
pushResult(results, false, 'roadmap-exists', `Missing ${roadmapPath}`);
|
|
80
|
+
} else if (!roadmapContent.includes('V1.8')) {
|
|
81
|
+
pushResult(results, false, 'roadmap-v18', 'Roadmap does not mention V1.8 release track');
|
|
82
|
+
} else {
|
|
83
|
+
pushResult(results, true, 'roadmap-v18', 'Roadmap includes V1.8 release track');
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const requiredEnterpriseFiles = [
|
|
87
|
+
'.agent-context/review-checklists/release-operations.md',
|
|
88
|
+
'docs/v1.8-operations-playbook.md',
|
|
89
|
+
'.github/workflows/release-gate.yml',
|
|
90
|
+
'.github/workflows/sbom-compliance.yml',
|
|
91
|
+
];
|
|
92
|
+
|
|
93
|
+
for (const requiredEnterpriseFile of requiredEnterpriseFiles) {
|
|
94
|
+
const absoluteRequiredPath = resolve(REPOSITORY_ROOT, requiredEnterpriseFile);
|
|
95
|
+
if (!existsSync(absoluteRequiredPath)) {
|
|
96
|
+
pushResult(results, false, 'required-enterprise-file', `Missing ${requiredEnterpriseFile}`);
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
pushResult(results, true, 'required-enterprise-file', `${requiredEnterpriseFile} is present`);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const failureCount = results.filter((checkResult) => !checkResult.passed).length;
|
|
104
|
+
const releaseGateReport = {
|
|
105
|
+
generatedAt: new Date().toISOString(),
|
|
106
|
+
gateName: 'release-gate',
|
|
107
|
+
passed: failureCount === 0,
|
|
108
|
+
failureCount,
|
|
109
|
+
results,
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
console.log(JSON.stringify(releaseGateReport, null, 2));
|
|
113
|
+
process.exit(releaseGateReport.passed ? 0 : 1);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
runReleaseGate();
|
|
@@ -1,76 +1,76 @@
|
|
|
1
|
-
export const SKILL_TIER_MINIMUMS = {
|
|
2
|
-
standard: { minWords: 60, minHeadings: 1, minChecklistItems: 0, minCodeBlocks: 0 },
|
|
3
|
-
advance: { minWords: 100, minHeadings: 2, minChecklistItems: 1, minCodeBlocks: 0 },
|
|
4
|
-
expert: { minWords: 130, minHeadings: 3, minChecklistItems: 1, minCodeBlocks: 0 },
|
|
5
|
-
above: { minWords: 240, minHeadings: 3, minChecklistItems: 1, minCodeBlocks: 1 },
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export function countWords(markdownContent) {
|
|
9
|
-
return markdownContent
|
|
10
|
-
.replace(/```[\s\S]*?```/g, ' ')
|
|
11
|
-
.replace(/[^A-Za-z0-9_\-\s]/g, ' ')
|
|
12
|
-
.trim()
|
|
13
|
-
.split(/\s+/)
|
|
14
|
-
.filter(Boolean).length;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function countMarkdownHeadings(markdownContent) {
|
|
18
|
-
const headingMatches = markdownContent.match(/^#{2,6}\s+/gm);
|
|
19
|
-
return headingMatches ? headingMatches.length : 0;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function countChecklistItems(markdownContent) {
|
|
23
|
-
const checklistMatches = markdownContent.match(/^\s*[-*]\s+\[[ xX]\]\s+/gm);
|
|
24
|
-
return checklistMatches ? checklistMatches.length : 0;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function countCodeBlocks(markdownContent) {
|
|
28
|
-
const fenceMatches = markdownContent.match(/```/g);
|
|
29
|
-
if (!fenceMatches) {
|
|
30
|
-
return 0;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return Math.floor(fenceMatches.length / 2);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export function extractSkillTier(markdownContent) {
|
|
37
|
-
const normalizedMarkdownContent = markdownContent.replace(/\*\*/g, '');
|
|
38
|
-
const tierMatch = normalizedMarkdownContent.match(/\bTier\s*:\s*`?(standard|advance|expert|above)`?\b/i);
|
|
39
|
-
return tierMatch ? tierMatch[1].toLowerCase() : null;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export function validateSkillTopicContent(markdownContent) {
|
|
43
|
-
const detectedTier = extractSkillTier(markdownContent);
|
|
44
|
-
|
|
45
|
-
if (!detectedTier) {
|
|
46
|
-
return { isValid: false, reason: 'missing-tier' };
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const minimumRules = SKILL_TIER_MINIMUMS[detectedTier];
|
|
50
|
-
if (!minimumRules) {
|
|
51
|
-
return { isValid: false, reason: 'unsupported-tier', detectedTier };
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const wordCount = countWords(markdownContent);
|
|
55
|
-
const headingCount = countMarkdownHeadings(markdownContent);
|
|
56
|
-
const checklistCount = countChecklistItems(markdownContent);
|
|
57
|
-
const codeBlockCount = countCodeBlocks(markdownContent);
|
|
58
|
-
|
|
59
|
-
if (wordCount < minimumRules.minWords) {
|
|
60
|
-
return { isValid: false, reason: 'word-count', detectedTier, wordCount, minimumRules };
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (headingCount < minimumRules.minHeadings) {
|
|
64
|
-
return { isValid: false, reason: 'heading-count', detectedTier, headingCount, minimumRules };
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (checklistCount < minimumRules.minChecklistItems) {
|
|
68
|
-
return { isValid: false, reason: 'checklist-count', detectedTier, checklistCount, minimumRules };
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if (codeBlockCount < minimumRules.minCodeBlocks) {
|
|
72
|
-
return { isValid: false, reason: 'code-block-count', detectedTier, codeBlockCount, minimumRules };
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return { isValid: true, detectedTier, wordCount, headingCount, checklistCount, codeBlockCount, minimumRules };
|
|
1
|
+
export const SKILL_TIER_MINIMUMS = {
|
|
2
|
+
standard: { minWords: 60, minHeadings: 1, minChecklistItems: 0, minCodeBlocks: 0 },
|
|
3
|
+
advance: { minWords: 100, minHeadings: 2, minChecklistItems: 1, minCodeBlocks: 0 },
|
|
4
|
+
expert: { minWords: 130, minHeadings: 3, minChecklistItems: 1, minCodeBlocks: 0 },
|
|
5
|
+
above: { minWords: 240, minHeadings: 3, minChecklistItems: 1, minCodeBlocks: 1 },
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export function countWords(markdownContent) {
|
|
9
|
+
return markdownContent
|
|
10
|
+
.replace(/```[\s\S]*?```/g, ' ')
|
|
11
|
+
.replace(/[^A-Za-z0-9_\-\s]/g, ' ')
|
|
12
|
+
.trim()
|
|
13
|
+
.split(/\s+/)
|
|
14
|
+
.filter(Boolean).length;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function countMarkdownHeadings(markdownContent) {
|
|
18
|
+
const headingMatches = markdownContent.match(/^#{2,6}\s+/gm);
|
|
19
|
+
return headingMatches ? headingMatches.length : 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function countChecklistItems(markdownContent) {
|
|
23
|
+
const checklistMatches = markdownContent.match(/^\s*[-*]\s+\[[ xX]\]\s+/gm);
|
|
24
|
+
return checklistMatches ? checklistMatches.length : 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function countCodeBlocks(markdownContent) {
|
|
28
|
+
const fenceMatches = markdownContent.match(/```/g);
|
|
29
|
+
if (!fenceMatches) {
|
|
30
|
+
return 0;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return Math.floor(fenceMatches.length / 2);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function extractSkillTier(markdownContent) {
|
|
37
|
+
const normalizedMarkdownContent = markdownContent.replace(/\*\*/g, '');
|
|
38
|
+
const tierMatch = normalizedMarkdownContent.match(/\bTier\s*:\s*`?(standard|advance|expert|above)`?\b/i);
|
|
39
|
+
return tierMatch ? tierMatch[1].toLowerCase() : null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function validateSkillTopicContent(markdownContent) {
|
|
43
|
+
const detectedTier = extractSkillTier(markdownContent);
|
|
44
|
+
|
|
45
|
+
if (!detectedTier) {
|
|
46
|
+
return { isValid: false, reason: 'missing-tier' };
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const minimumRules = SKILL_TIER_MINIMUMS[detectedTier];
|
|
50
|
+
if (!minimumRules) {
|
|
51
|
+
return { isValid: false, reason: 'unsupported-tier', detectedTier };
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const wordCount = countWords(markdownContent);
|
|
55
|
+
const headingCount = countMarkdownHeadings(markdownContent);
|
|
56
|
+
const checklistCount = countChecklistItems(markdownContent);
|
|
57
|
+
const codeBlockCount = countCodeBlocks(markdownContent);
|
|
58
|
+
|
|
59
|
+
if (wordCount < minimumRules.minWords) {
|
|
60
|
+
return { isValid: false, reason: 'word-count', detectedTier, wordCount, minimumRules };
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (headingCount < minimumRules.minHeadings) {
|
|
64
|
+
return { isValid: false, reason: 'heading-count', detectedTier, headingCount, minimumRules };
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (checklistCount < minimumRules.minChecklistItems) {
|
|
68
|
+
return { isValid: false, reason: 'checklist-count', detectedTier, checklistCount, minimumRules };
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (codeBlockCount < minimumRules.minCodeBlocks) {
|
|
72
|
+
return { isValid: false, reason: 'code-block-count', detectedTier, codeBlockCount, minimumRules };
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return { isValid: true, detectedTier, wordCount, headingCount, checklistCount, codeBlockCount, minimumRules };
|
|
76
76
|
}
|