@ryuenn3123/agentic-senior-core 4.4.0 → 5.1.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.
Files changed (196) hide show
  1. package/.agents/plugins/marketplace.json +21 -0
  2. package/.agents/rules/agentic-senior-core.md +126 -0
  3. package/.claude-plugin/marketplace.json +17 -0
  4. package/.claude-plugin/plugin.json +17 -0
  5. package/.clinerules/agentic-senior-core.md +94 -0
  6. package/.codex-plugin/plugin.json +24 -0
  7. package/.cursor/rules/agentic-senior-core.mdc +99 -0
  8. package/.devin-plugin/plugin.json +13 -0
  9. package/.github/copilot-instructions.md +94 -0
  10. package/.github/plugin/marketplace.json +20 -0
  11. package/.github/plugin/plugin.json +16 -0
  12. package/.kiro/steering/agentic-senior-core.md +94 -0
  13. package/.openclaw/skills/asc/SKILL.md +23 -0
  14. package/.openclaw/skills/asc-audit/SKILL.md +28 -0
  15. package/.openclaw/skills/asc-review/SKILL.md +54 -0
  16. package/.opencode/plugins/agentic-senior-core.mjs +31 -0
  17. package/.windsurf/rules/agentic-senior-core.md +94 -0
  18. package/AGENTS.md +126 -127
  19. package/CONTRIBUTING.md +93 -63
  20. package/README.md +160 -111
  21. package/__init__.py +61 -0
  22. package/bin/agentic-senior-core.js +42 -41
  23. package/commands/asc-audit.md +1 -0
  24. package/commands/asc-audit.toml +2 -0
  25. package/commands/asc-help.md +9 -0
  26. package/commands/asc-help.toml +2 -0
  27. package/commands/asc-refactor.md +1 -0
  28. package/commands/asc-refactor.toml +2 -0
  29. package/commands/asc-review.md +1 -0
  30. package/commands/asc-review.toml +2 -0
  31. package/gemini-extension.json +10 -0
  32. package/hooks/copilot-hooks.json +21 -0
  33. package/hooks/hooks.json +31 -0
  34. package/hooks/session-start.js +36 -0
  35. package/hooks/subagent-start.js +38 -0
  36. package/lib/cli/commands/adapter.mjs +109 -0
  37. package/lib/cli/commands/clean.mjs +63 -0
  38. package/lib/cli/commands/status.mjs +94 -0
  39. package/package.json +43 -60
  40. package/plugin.yaml +16 -0
  41. package/scripts/uninstall.js +38 -0
  42. package/skills/asc/SKILL.md +16 -0
  43. package/skills/asc-audit/SKILL.md +28 -0
  44. package/skills/asc-refactor/SKILL.md +35 -0
  45. package/skills/asc-review/SKILL.md +54 -0
  46. package/.agent-context/policies/llm-judge-threshold.json +0 -29
  47. package/.agent-context/prompts/bootstrap-design.md +0 -63
  48. package/.agent-context/prompts/compact-natural-mode.md +0 -100
  49. package/.agent-context/prompts/init-project.md +0 -60
  50. package/.agent-context/prompts/refactor.md +0 -38
  51. package/.agent-context/prompts/review-code.md +0 -31
  52. package/.agent-context/review-checklists/architecture-review.md +0 -57
  53. package/.agent-context/review-checklists/pr-checklist.md +0 -134
  54. package/.agent-context/rules/api-docs.md +0 -24
  55. package/.agent-context/rules/api-versioning.md +0 -16
  56. package/.agent-context/rules/architecture.md +0 -38
  57. package/.agent-context/rules/background-jobs.md +0 -17
  58. package/.agent-context/rules/config-and-flags.md +0 -16
  59. package/.agent-context/rules/database-design.md +0 -18
  60. package/.agent-context/rules/docker-runtime.md +0 -17
  61. package/.agent-context/rules/error-handling.md +0 -16
  62. package/.agent-context/rules/event-driven.md +0 -16
  63. package/.agent-context/rules/frontend-architecture.md +0 -54
  64. package/.agent-context/rules/microservices.md +0 -16
  65. package/.agent-context/rules/migrations.md +0 -16
  66. package/.agent-context/rules/observability.md +0 -16
  67. package/.agent-context/rules/performance.md +0 -16
  68. package/.agent-context/rules/realtime.md +0 -16
  69. package/.agent-context/rules/resilience.md +0 -18
  70. package/.agent-context/rules/security.md +0 -18
  71. package/.agent-context/rules/testing.md +0 -16
  72. package/.agent-context/state/README.md +0 -25
  73. package/.agent-context/state/architecture-map.md +0 -40
  74. package/.agent-context/state/benchmark-comparison-schema.json +0 -181
  75. package/.agent-context/state/benchmark-reproducibility.json +0 -87
  76. package/.agent-context/state/benchmark-thresholds.json +0 -10
  77. package/.agent-context/state/benchmark-writer-judge-config.json +0 -58
  78. package/.agent-context/state/dependency-map.md +0 -41
  79. package/.agent-context/state/memory-adapter-contract.json +0 -52
  80. package/.agent-context/state/memory-schema-v1.json +0 -88
  81. package/GEMINI.md +0 -1
  82. package/benchmarks/README.md +0 -60
  83. package/benchmarks/compact-natural-mode/fixtures.mjs +0 -359
  84. package/benchmarks/compact-natural-mode/scorer.mjs +0 -331
  85. package/benchmarks/runtime-token-saver/fixtures.mjs +0 -836
  86. package/lib/cli/adaptive-context/catalog.mjs +0 -394
  87. package/lib/cli/adaptive-context/file-signals.mjs +0 -100
  88. package/lib/cli/adaptive-context/implications.mjs +0 -44
  89. package/lib/cli/adaptive-context.mjs +0 -151
  90. package/lib/cli/audits/typography-palette-anti-repeat/color-utils.mjs +0 -156
  91. package/lib/cli/audits/typography-palette-anti-repeat/file-scanner.mjs +0 -103
  92. package/lib/cli/audits/typography-palette-anti-repeat/typography-utils.mjs +0 -70
  93. package/lib/cli/backup.mjs +0 -210
  94. package/lib/cli/commands/context.mjs +0 -140
  95. package/lib/cli/commands/init/project-context.mjs +0 -60
  96. package/lib/cli/commands/init/runtime-environment.mjs +0 -59
  97. package/lib/cli/commands/init/setup-decisions.mjs +0 -83
  98. package/lib/cli/commands/init.mjs +0 -654
  99. package/lib/cli/commands/launch.mjs +0 -76
  100. package/lib/cli/commands/optimize.mjs +0 -284
  101. package/lib/cli/commands/rollback.mjs +0 -64
  102. package/lib/cli/commands/upgrade/token-optimization-state.mjs +0 -51
  103. package/lib/cli/commands/upgrade.mjs +0 -451
  104. package/lib/cli/compiler.mjs +0 -187
  105. package/lib/cli/constants.mjs +0 -136
  106. package/lib/cli/detector/constants.mjs +0 -135
  107. package/lib/cli/detector/design-evidence/collector.mjs +0 -256
  108. package/lib/cli/detector/design-evidence/constants.mjs +0 -39
  109. package/lib/cli/detector/design-evidence/file-traversal.mjs +0 -83
  110. package/lib/cli/detector/design-evidence/structured-attribute-evidence.mjs +0 -117
  111. package/lib/cli/detector/design-evidence/summary.mjs +0 -109
  112. package/lib/cli/detector/design-evidence/utility-helpers.mjs +0 -122
  113. package/lib/cli/detector/design-evidence.mjs +0 -25
  114. package/lib/cli/detector/stack-detection.mjs +0 -243
  115. package/lib/cli/detector/ui-signals.mjs +0 -150
  116. package/lib/cli/detector/workspace-scan.mjs +0 -177
  117. package/lib/cli/detector.mjs +0 -23
  118. package/lib/cli/init-detection-flow.mjs +0 -48
  119. package/lib/cli/init-options.mjs +0 -237
  120. package/lib/cli/init-selection.mjs +0 -29
  121. package/lib/cli/memory-continuity.mjs +0 -537
  122. package/lib/cli/preflight.mjs +0 -76
  123. package/lib/cli/project-scaffolder/constants.mjs +0 -69
  124. package/lib/cli/project-scaffolder/discovery.mjs +0 -272
  125. package/lib/cli/project-scaffolder/prompt-builders.mjs +0 -171
  126. package/lib/cli/project-scaffolder/storage.mjs +0 -144
  127. package/lib/cli/project-scaffolder/ui-scope-detection.mjs +0 -36
  128. package/lib/cli/project-scaffolder.mjs +0 -29
  129. package/lib/cli/rollback.mjs +0 -66
  130. package/lib/cli/token-optimization.mjs +0 -401
  131. package/lib/cli/utils/filesystem.mjs +0 -81
  132. package/lib/cli/utils/managed-surface.mjs +0 -280
  133. package/lib/cli/utils/prompting.mjs +0 -44
  134. package/lib/cli/utils.mjs +0 -479
  135. package/mcp.json +0 -134
  136. package/scripts/adaptive-context/fixtures.mjs +0 -183
  137. package/scripts/adaptive-context-benchmark.mjs +0 -9
  138. package/scripts/ascx-runtime-token-saver-benchmark.mjs +0 -9
  139. package/scripts/benchmark-evidence-bundle.mjs +0 -645
  140. package/scripts/benchmark-gate.mjs +0 -121
  141. package/scripts/benchmark-intelligence.mjs +0 -33
  142. package/scripts/benchmark-writer-judge-matrix.mjs +0 -379
  143. package/scripts/build-release-benchmark-bundle.mjs +0 -202
  144. package/scripts/bump-version.mjs +0 -103
  145. package/scripts/clean-local-artifacts.mjs +0 -78
  146. package/scripts/compact-natural-mode-benchmark.mjs +0 -9
  147. package/scripts/context-triggered-audit.mjs +0 -391
  148. package/scripts/detection-benchmark.mjs +0 -127
  149. package/scripts/docs-quality-drift-report.mjs +0 -358
  150. package/scripts/documentation-boundary-audit.mjs +0 -305
  151. package/scripts/explain-on-demand-audit.mjs +0 -427
  152. package/scripts/forbidden-content-check.mjs +0 -123
  153. package/scripts/frontend-usability-audit.mjs +0 -243
  154. package/scripts/generate-sbom.mjs +0 -61
  155. package/scripts/governance-weekly-report.mjs +0 -466
  156. package/scripts/llm-judge/checklist-loader.mjs +0 -45
  157. package/scripts/llm-judge/constants.mjs +0 -66
  158. package/scripts/llm-judge/diff-collection.mjs +0 -74
  159. package/scripts/llm-judge/prompting.mjs +0 -78
  160. package/scripts/llm-judge/providers.mjs +0 -111
  161. package/scripts/llm-judge/verdict.mjs +0 -134
  162. package/scripts/llm-judge.mjs +0 -200
  163. package/scripts/memory-continuity-benchmark.mjs +0 -322
  164. package/scripts/quality-trend-report.mjs +0 -289
  165. package/scripts/release-gate/audit-checks.mjs +0 -441
  166. package/scripts/release-gate/constants.mjs +0 -53
  167. package/scripts/release-gate/runtime.mjs +0 -63
  168. package/scripts/release-gate/static-checks.mjs +0 -182
  169. package/scripts/release-gate.mjs +0 -42
  170. package/scripts/rules-guardian-audit.mjs +0 -580
  171. package/scripts/single-source-lazy-loading-audit.mjs +0 -449
  172. package/scripts/sync-thin-adapters.mjs +0 -72
  173. package/scripts/token-optimization-benchmark.mjs +0 -252
  174. package/scripts/ui-design-judge/constants.mjs +0 -13
  175. package/scripts/ui-design-judge/design-execution-summary.mjs +0 -81
  176. package/scripts/ui-design-judge/git-input.mjs +0 -134
  177. package/scripts/ui-design-judge/prompting.mjs +0 -52
  178. package/scripts/ui-design-judge/providers.mjs +0 -102
  179. package/scripts/ui-design-judge/reporting.mjs +0 -183
  180. package/scripts/ui-design-judge/rubric-calibration.mjs +0 -214
  181. package/scripts/ui-design-judge/rubric-goldset.json +0 -188
  182. package/scripts/ui-design-judge.mjs +0 -319
  183. package/scripts/ui-rubric-calibration.mjs +0 -35
  184. package/scripts/validate/audits/cache-layer-contract.mjs +0 -230
  185. package/scripts/validate/audits/caching-scope-hygiene.mjs +0 -235
  186. package/scripts/validate/audits/file-size.mjs +0 -158
  187. package/scripts/validate/audits/reflection-citations.mjs +0 -130
  188. package/scripts/validate/audits/release-bundle.mjs +0 -135
  189. package/scripts/validate/audits/rule-id-uniqueness.mjs +0 -278
  190. package/scripts/validate/config.mjs +0 -501
  191. package/scripts/validate/coverage-checks.mjs +0 -446
  192. package/scripts/validate/file-structure.mjs +0 -158
  193. package/scripts/validate/markdown-content.mjs +0 -109
  194. package/scripts/validate/project-metadata.mjs +0 -166
  195. package/scripts/validate/utils.mjs +0 -52
  196. package/scripts/validate.mjs +0 -267
@@ -1,109 +0,0 @@
1
- import { dirname, join, relative, resolve } from 'node:path';
2
-
3
- export async function validateMarkdownFiles(context) {
4
- const { ROOT_DIR, collectFiles, readTextFile, pass, fail } = context;
5
- console.log('\nChecking markdown content...');
6
-
7
- const markdownFilePaths = await collectFiles(ROOT_DIR, (fileName) => fileName.endsWith('.md'));
8
-
9
- for (const markdownFilePath of markdownFilePaths) {
10
- const markdownContent = await readTextFile(markdownFilePath);
11
- const relativeMarkdownPath = relative(ROOT_DIR, markdownFilePath);
12
-
13
- if (markdownContent.trim().length === 0) {
14
- fail(`Empty markdown file: ${relativeMarkdownPath}`);
15
- continue;
16
- }
17
-
18
- pass(`${relativeMarkdownPath} (${markdownContent.length} chars)`);
19
- }
20
- }
21
-
22
- export async function validateCrossReferences(context) {
23
- const { ROOT_DIR, collectFiles, readTextFile, fileExists, pass, fail, warn } = context;
24
- console.log('\nChecking internal links...');
25
-
26
- const markdownFilePaths = await collectFiles(ROOT_DIR, (fileName) => fileName.endsWith('.md'));
27
- const linkPattern = /\[([^\]]*)\]\((?!https?:\/\/|#)([^)]+)\)/g;
28
- let checkedLinkCount = 0;
29
-
30
- for (const markdownFilePath of markdownFilePaths) {
31
- const markdownContent = await readTextFile(markdownFilePath);
32
- const currentFileDirectory = dirname(markdownFilePath);
33
- const relativeMarkdownPath = relative(ROOT_DIR, markdownFilePath);
34
- let linkMatch = linkPattern.exec(markdownContent);
35
-
36
- while (linkMatch) {
37
- const rawLinkTarget = linkMatch[2].split('#')[0];
38
- if (rawLinkTarget) {
39
- checkedLinkCount += 1;
40
- const resolvedLinkPath = resolve(currentFileDirectory, rawLinkTarget);
41
-
42
- if (await fileExists(resolvedLinkPath)) {
43
- pass(`${relativeMarkdownPath} → ${linkMatch[2]}`);
44
- } else {
45
- fail(`Broken link in ${relativeMarkdownPath}: ${linkMatch[2]}`);
46
- }
47
- }
48
-
49
- linkMatch = linkPattern.exec(markdownContent);
50
- }
51
- }
52
-
53
- if (checkedLinkCount === 0) {
54
- warn('No internal links were found in markdown files');
55
- }
56
- }
57
-
58
- export async function validateAgentsManifest(context) {
59
- const { ROOT_DIR, readTextFile, fileExists, pass, fail, warn } = context;
60
- console.log('\nChecking AGENTS.md manifest links...');
61
-
62
- const agentsContent = await readTextFile(join(ROOT_DIR, 'AGENTS.md'));
63
- const fileReferencePattern = /\[`?([^`\]]+)`?\]\(([^)]+)\)/g;
64
- let manifestLinkCount = 0;
65
- let fileReferenceMatch = fileReferencePattern.exec(agentsContent);
66
-
67
- while (fileReferenceMatch) {
68
- const manifestLinkTarget = fileReferenceMatch[2];
69
-
70
- if (!manifestLinkTarget.startsWith('http')) {
71
- manifestLinkCount += 1;
72
- const resolvedManifestLinkPath = resolve(ROOT_DIR, manifestLinkTarget);
73
-
74
- if (await fileExists(resolvedManifestLinkPath)) {
75
- pass(`AGENTS.md → ${manifestLinkTarget}`);
76
- } else {
77
- fail(`AGENTS.md references missing file: ${manifestLinkTarget}`);
78
- }
79
- }
80
-
81
- fileReferenceMatch = fileReferencePattern.exec(agentsContent);
82
- }
83
-
84
- if (manifestLinkCount === 0) {
85
- warn('AGENTS.md does not contain any local manifest links');
86
- }
87
- }
88
-
89
- export async function validateDocumentationFlow(context) {
90
- const { README_PATH, readTextFile, pass, fail } = context;
91
- console.log('\nChecking documentation flow...');
92
-
93
- const readmeContent = await readTextFile(README_PATH);
94
- const requiredReadmeSnippets = [
95
- 'npx @ryuenn3123/agentic-senior-core init',
96
- 'npm run validate',
97
- 'docs/faq.md',
98
- 'docs/deep-dive.md',
99
- 'docs/archive/HISTORY.md',
100
- ];
101
-
102
- for (const requiredReadmeSnippet of requiredReadmeSnippets) {
103
- if (readmeContent.includes(requiredReadmeSnippet)) {
104
- pass(`README.md mentions ${requiredReadmeSnippet}`);
105
- } else {
106
- fail(`README.md must mention ${requiredReadmeSnippet}`);
107
- }
108
- }
109
- }
@@ -1,166 +0,0 @@
1
- import { join } from 'node:path';
2
- import { ALLOWED_SEVERITIES } from './config.mjs';
3
-
4
- export async function validatePackageMetadata(context) {
5
- const { PACKAGE_JSON_PATH, BUN_LOCK_PATH, readTextFile, fileExists, pass, fail, warn } = context;
6
- console.log('\nChecking package metadata...');
7
-
8
- const packageJson = JSON.parse(await readTextFile(PACKAGE_JSON_PATH));
9
- const versionPattern = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;
10
-
11
- if (typeof packageJson.version !== 'string' || !versionPattern.test(packageJson.version)) {
12
- fail('package.json version must be a semantic version string');
13
- } else {
14
- pass(`package.json version ${packageJson.version}`);
15
- }
16
-
17
- if (packageJson.scripts?.validate === 'node ./scripts/validate.mjs') {
18
- pass('package.json validate script is Node-first');
19
- } else {
20
- fail('package.json validate script must use node ./scripts/validate.mjs');
21
- }
22
-
23
- if (packageJson.scripts?.test) {
24
- pass('package.json test script exists');
25
- } else {
26
- fail('package.json test script is missing');
27
- }
28
-
29
- if (packageJson.devDependencies && Object.keys(packageJson.devDependencies).length > 0) {
30
- warn('package.json still has devDependencies; review whether they are necessary');
31
- } else {
32
- pass('package.json has no unnecessary devDependencies');
33
- }
34
-
35
- if (Array.isArray(packageJson.files) && packageJson.files.includes('AGENTS.md')) {
36
- pass('package.json publishes canonical AGENTS.md');
37
- } else {
38
- fail('package.json must publish AGENTS.md so init and upgrade can copy the canonical root instructions file');
39
- }
40
-
41
- if (await fileExists(BUN_LOCK_PATH)) {
42
- fail('bun.lock must not be tracked while npm is the package manager source of truth');
43
- } else {
44
- pass('No bun.lock drift file present');
45
- }
46
- }
47
-
48
- export async function validatePolicyFile(context) {
49
- const { POLICY_FILE_PATH, readTextFile, pass, fail } = context;
50
- console.log('\nChecking LLM Judge policy...');
51
-
52
- const policyContent = await readTextFile(POLICY_FILE_PATH);
53
- const parsedPolicy = JSON.parse(policyContent);
54
- const selectedProfileName = parsedPolicy.selectedProfile;
55
- const profileThresholds = parsedPolicy.profileThresholds;
56
-
57
- if (typeof selectedProfileName !== 'string') {
58
- fail('Policy file must define selectedProfile as a string');
59
- } else {
60
- pass(`LLM Judge selected profile: ${selectedProfileName}`);
61
- }
62
-
63
- if (!profileThresholds || typeof profileThresholds !== 'object') {
64
- fail('Policy file must define profileThresholds');
65
- return;
66
- }
67
-
68
- for (const [profileName, profileSettings] of Object.entries(profileThresholds)) {
69
- if (!Array.isArray(profileSettings.blockingSeverities)) {
70
- fail(`Policy profile ${profileName} must define blockingSeverities`);
71
- continue;
72
- }
73
-
74
- const invalidSeverity = profileSettings.blockingSeverities.find((severity) => !ALLOWED_SEVERITIES.has(severity));
75
- if (invalidSeverity) {
76
- fail(`Policy profile ${profileName} uses unsupported severity: ${invalidSeverity}`);
77
- continue;
78
- }
79
-
80
- pass(`Policy profile ${profileName} blocking severities are valid`);
81
- }
82
-
83
- if (typeof profileThresholds[selectedProfileName] === 'object') {
84
- pass('Policy selectedProfile points to a valid profile');
85
- } else {
86
- fail('Policy selectedProfile must match one of the configured profileThresholds');
87
- }
88
- }
89
-
90
- export async function validateVersionConsistency(context) {
91
- const { ROOT_DIR, PACKAGE_JSON_PATH, CHANGELOG_PATH, PACKAGE_LOCK_PATH, GENERATED_RULE_FILES, readTextFile, fileExists, pass, fail } = context;
92
- console.log('\nChecking release version consistency...');
93
-
94
- const packageJson = JSON.parse(await readTextFile(PACKAGE_JSON_PATH));
95
- const packageVersion = packageJson.version;
96
- const changelogContent = await readTextFile(CHANGELOG_PATH);
97
-
98
- if (changelogContent.includes(`## ${packageVersion}`)) {
99
- pass(`CHANGELOG.md contains release entry for ${packageVersion}`);
100
- } else {
101
- fail(`CHANGELOG.md is missing a ## ${packageVersion} heading`);
102
- }
103
-
104
- if (await fileExists(PACKAGE_LOCK_PATH)) {
105
- const packageLock = JSON.parse(await readTextFile(PACKAGE_LOCK_PATH));
106
- const rootLockVersion = packageLock.packages?.['']?.version;
107
- if (packageLock.version === packageVersion && rootLockVersion === packageVersion) {
108
- pass(`package-lock.json matches package version ${packageVersion}`);
109
- } else {
110
- fail(`package-lock.json version drift: expected ${packageVersion}, found ${packageLock.version || 'missing'} / ${rootLockVersion || 'missing'}`);
111
- }
112
- } else {
113
- fail('package-lock.json is required for npm release consistency');
114
- }
115
-
116
- for (const generatedRuleFileName of GENERATED_RULE_FILES) {
117
- const generatedRuleContent = await readTextFile(join(ROOT_DIR, generatedRuleFileName));
118
-
119
- if (generatedRuleContent.includes(`Generated by Agentic-Senior-Core CLI v${packageVersion}`)) {
120
- pass(`${generatedRuleFileName} matches package version ${packageVersion}`);
121
- } else {
122
- fail(`${generatedRuleFileName} does not match package version ${packageVersion}`);
123
- }
124
- }
125
- }
126
-
127
- export async function validateMcpConfiguration(context) {
128
- const { ROOT_DIR, readTextFile, pass, fail } = context;
129
- console.log('\nChecking MCP configuration...');
130
-
131
- const mcpConfiguration = JSON.parse(await readTextFile(join(ROOT_DIR, 'mcp.json')));
132
- const workspaceMcpConfiguration = JSON.parse(await readTextFile(join(ROOT_DIR, '.vscode', 'mcp.json')));
133
- const workspaceServerConfig = workspaceMcpConfiguration.servers?.['agentic-senior-core'];
134
-
135
- if (mcpConfiguration.knowledgeLayers?.enabled === true) {
136
- pass('Root MCP config has knowledgeLayers enabled');
137
- } else {
138
- fail('Root MCP config must have knowledgeLayers.enabled: true');
139
- }
140
-
141
- if (typeof workspaceMcpConfiguration.$schema === 'undefined') {
142
- pass('Workspace MCP config omits $schema (supported by current VS Code MCP schema inference)');
143
- } else if (workspaceMcpConfiguration.$schema === 'vscode://schemas/mcp') {
144
- pass('Workspace MCP config uses trusted VS Code schema');
145
- } else {
146
- fail('Workspace MCP config $schema must be omitted or set to vscode://schemas/mcp');
147
- }
148
-
149
- if (workspaceServerConfig?.command === 'node') {
150
- pass('Workspace MCP server command uses Node');
151
- } else {
152
- fail('Workspace MCP server command must use Node');
153
- }
154
-
155
- if (workspaceServerConfig?.cwd === '${workspaceFolder}') {
156
- pass('Workspace MCP server cwd uses ${workspaceFolder}');
157
- } else {
158
- fail('Workspace MCP server cwd must be ${workspaceFolder}');
159
- }
160
-
161
- if (Array.isArray(workspaceServerConfig?.args) && workspaceServerConfig.args.includes('./scripts/mcp-server.mjs')) {
162
- pass('Workspace MCP server points to scripts/mcp-server.mjs');
163
- } else {
164
- fail('Workspace MCP server must include ./scripts/mcp-server.mjs argument');
165
- }
166
- }
@@ -1,52 +0,0 @@
1
- import { readdir, readFile, stat } from 'node:fs/promises';
2
- import { join } from 'node:path';
3
-
4
- export async function fileExists(filePath) {
5
- try {
6
- await stat(filePath);
7
- return true;
8
- } catch {
9
- return false;
10
- }
11
- }
12
-
13
- export async function readTextFile(filePath) {
14
- return readFile(filePath, 'utf8');
15
- }
16
-
17
- export async function collectFiles(directoryPath, fileExtensionMatcher) {
18
- const matchingFilePaths = [];
19
-
20
- async function walk(currentDirectoryPath) {
21
- const directoryEntries = await readdir(currentDirectoryPath, { withFileTypes: true });
22
-
23
- for (const directoryEntry of directoryEntries) {
24
- if (
25
- directoryEntry.name === '.git'
26
- || directoryEntry.name === 'node_modules'
27
- || directoryEntry.name === '.agentic-backup'
28
- || directoryEntry.name === '.benchmarks'
29
- ) {
30
- continue;
31
- }
32
-
33
- const entryPath = join(currentDirectoryPath, directoryEntry.name);
34
-
35
- if (directoryEntry.isDirectory()) {
36
- await walk(entryPath);
37
- continue;
38
- }
39
-
40
- if (fileExtensionMatcher(directoryEntry.name)) {
41
- matchingFilePaths.push(entryPath);
42
- }
43
- }
44
- }
45
-
46
- await walk(directoryPath);
47
- return matchingFilePaths;
48
- }
49
-
50
- export function normalizeLineEndings(content) {
51
- return content.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
52
- }
@@ -1,267 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // Phase 1 governance refactor completed: monolithic script split into modular sub-files.
4
- /**
5
- * validate.mjs — Repository Integrity Validator
6
- *
7
- * Validates the Agentic-Senior-Core repository:
8
- * - Required files exist
9
- * - Markdown and JSON documents are readable
10
- * - Cross-references resolve from the correct source directory
11
- * - Version references stay consistent for release builds
12
- * - LLM Judge policy configuration is valid
13
- *
14
- * Usage: node scripts/validate.mjs
15
- */
16
-
17
- import { readdir, readFile, stat } from 'node:fs/promises';
18
- import { dirname, join, relative, resolve } from 'node:path';
19
- import { fileURLToPath } from 'node:url';
20
- import { ALLOWED_SEVERITIES } from './validate/config.mjs';
21
- import { runCacheLayerContractAudit } from './validate/audits/cache-layer-contract.mjs';
22
- import { runCachingScopeHygieneAudit } from './validate/audits/caching-scope-hygiene.mjs';
23
-
24
- import { runAuditFileSize } from './validate/audits/file-size.mjs';
25
- import { runReflectionCitationAudit } from './validate/audits/reflection-citations.mjs';
26
- import { runReleaseBundleAudit } from './validate/audits/release-bundle.mjs';
27
- import { runRuleIdUniquenessAudit } from './validate/audits/rule-id-uniqueness.mjs';
28
- import {
29
- validateDependencyFreshnessAutomationCoverage,
30
- validateDetectionTransparencyCoverage,
31
- validateDeterministicBoundaryEnforcementCoverage,
32
- validateDiagramFormatCoverage,
33
- validateDockerRuntimeAutomationCoverage,
34
- validateHumanWritingGovernance,
35
- validateInstructionAdapters,
36
- validateRulesOnlyActiveSurfaceCoverage,
37
- validateSkillPurgeSurface,
38
- validateStackDecisionBoundaryCoverage,
39
- validateTemplateFreeBootstrapCoverage,
40
- validateTerminologyMapping,
41
- validateUiDesignAutomationCoverage,
42
- validateUniversalSopConsolidationCoverage,
43
- validateUpgradeUiContractWarningCoverage,
44
- } from './validate/coverage-checks.mjs';
45
- import {
46
- validateRequiredFiles,
47
- validateRuleFiles,
48
- validateChecklistConsolidation,
49
- } from './validate/file-structure.mjs';
50
- import {
51
- validateMarkdownFiles,
52
- validateCrossReferences,
53
- validateAgentsManifest,
54
- validateDocumentationFlow,
55
- } from './validate/markdown-content.mjs';
56
- import {
57
- validatePackageMetadata,
58
- validatePolicyFile,
59
- validateVersionConsistency,
60
- validateMcpConfiguration,
61
- } from './validate/project-metadata.mjs';
62
- import { fileExists, readTextFile, collectFiles, normalizeLineEndings } from './validate/utils.mjs';
63
-
64
- const SCRIPT_FILE_PATH = fileURLToPath(import.meta.url);
65
- const ROOT_DIR = resolve(dirname(SCRIPT_FILE_PATH), '..');
66
- const AGENT_CONTEXT_DIR = join(ROOT_DIR, '.agent-context');
67
- const CANONICAL_INSTRUCTION_PATH = join(ROOT_DIR, 'AGENTS.md');
68
- const PACKAGE_JSON_PATH = join(ROOT_DIR, 'package.json');
69
- const PACKAGE_LOCK_PATH = join(ROOT_DIR, 'package-lock.json');
70
- const BUN_LOCK_PATH = join(ROOT_DIR, 'bun.lock');
71
- const CHANGELOG_PATH = join(ROOT_DIR, 'CHANGELOG.md');
72
- const README_PATH = join(ROOT_DIR, 'README.md');
73
- const POLICY_FILE_PATH = join(ROOT_DIR, '.agent-context', 'policies', 'llm-judge-threshold.json');
74
- const GENERATED_RULE_FILES = [];
75
-
76
- const validationResult = {
77
- passed: 0,
78
- failed: 0,
79
- errors: [],
80
- warnings: [],
81
- };
82
-
83
-
84
-
85
- function pass(message) {
86
- validationResult.passed += 1;
87
- console.log(` PASS ${message}`);
88
- }
89
-
90
- function fail(message) {
91
- validationResult.failed += 1;
92
- validationResult.errors.push(message);
93
- console.log(` FAIL ${message}`);
94
- }
95
-
96
- function warn(message) {
97
- validationResult.warnings.push(message);
98
- console.log(` WARN ${message}`);
99
- }
100
-
101
-
102
-
103
-
104
- async function validateFileSizeAudit() {
105
- console.log('\nChecking file size threshold (audit:file-size)...');
106
- const report = runAuditFileSize();
107
-
108
- if (report.passed) {
109
- pass(`File size audit clean: ${report.scannedFileCount} files scanned, ${report.exemptedCount} exempted under @file-size-exception`);
110
- } else {
111
- for (const violation of report.violations) {
112
- fail(`File exceeds ${report.threshold} LOC: ${violation.filePath} (${violation.lineCount} LOC). Split into focused submodules or declare a justified // @file-size-exception: <reason> marker in the first 5 lines.`);
113
- }
114
- }
115
- }
116
-
117
- async function validateCacheLayerContractAudit() {
118
- console.log('\nChecking cache layer contract (audit:cache-layer-contract)...');
119
- const report = runCacheLayerContractAudit();
120
-
121
- if (report.passed) {
122
- pass(`Cache layer contract audit clean: ${report.providerCount} provider(s), ${report.fixtureCount} fixture(s), ${report.resultCount} result row(s)`);
123
- } else {
124
- for (const violation of report.violations) {
125
- fail(`Cache layer contract violation [${violation.kind}]: ${violation.detail}`);
126
- }
127
- }
128
- }
129
-
130
- async function validateRuleIdUniquenessAudit() {
131
- console.log('\nChecking rule ID uniqueness (audit:rule-id-uniqueness)...');
132
- const report = runRuleIdUniquenessAudit();
133
-
134
- if (report.passed) {
135
- pass(`Rule ID audit clean: ${report.migratedFileCount} migrated rule file(s), ${report.skippedFileCount} pre-migration, ${report.knownSectionIdCount} section ID(s), ${report.refMentionCount} [REF:] mention(s) all resolve`);
136
- } else {
137
- for (const violation of report.violations) {
138
- fail(`Rule ID violation [${violation.kind}] in ${violation.file}: ${violation.detail}`);
139
- }
140
- }
141
- }
142
-
143
- async function validateReflectionCitationAudit() {
144
- console.log('\nChecking reflection citations (audit:reflection-citations)...');
145
- const report = runReflectionCitationAudit();
146
-
147
- if (report.passed) {
148
- pass(`Reflection citation audit clean: ${report.surfaceCount} surface(s), ${report.knownRuleIdCount} known rule ID(s)`);
149
- } else {
150
- for (const violation of report.violations) {
151
- fail(`Reflection citation violation [${violation.kind}] in ${violation.file}: ${violation.detail}`);
152
- }
153
- }
154
- }
155
-
156
- async function validateCachingScopeHygieneAudit() {
157
- console.log('\nChecking caching scope hygiene (audit:caching-scope-hygiene)...');
158
- const report = runCachingScopeHygieneAudit();
159
-
160
- if (report.passed) {
161
- pass(`Caching scope hygiene clean: ${report.surfaceCount} public surface(s), ${report.totalClaimCount} caching saving claim(s) all integration-scoped`);
162
- } else {
163
- for (const violation of report.violations) {
164
- fail(`Caching scope hygiene violation [${violation.kind}] in ${violation.file}:${violation.line}: ${violation.detail}`);
165
- }
166
- }
167
- }
168
-
169
-
170
-
171
- async function validateReleaseBundleAudit() {
172
- console.log('\nChecking release benchmark bundle (audit:release-bundle)...');
173
- const report = runReleaseBundleAudit();
174
-
175
- if (report.passed) {
176
- pass(`Release bundle integrity clean: ${report.artifactCount} artifact(s), release_target=${report.releaseTarget}, release_status=${report.releaseStatus}`);
177
- } else {
178
- for (const violation of report.violations) {
179
- fail(`Release bundle violation [${violation.kind}]: ${violation.detail}`);
180
- }
181
- }
182
- }
183
-
184
-
185
- async function main() {
186
- console.log('===============================================');
187
- console.log(' Agentic-Senior-Core Repository Validator');
188
- console.log('===============================================');
189
-
190
- const coverageValidationContext = {
191
- AGENT_CONTEXT_DIR,
192
- CANONICAL_INSTRUCTION_PATH,
193
- ROOT_DIR,
194
- fail,
195
- fileExists,
196
- normalizeLineEndings,
197
- pass,
198
- readTextFile,
199
- };
200
-
201
- const generalValidationContext = {
202
- ...coverageValidationContext,
203
- PACKAGE_JSON_PATH,
204
- PACKAGE_LOCK_PATH,
205
- BUN_LOCK_PATH,
206
- CHANGELOG_PATH,
207
- README_PATH,
208
- POLICY_FILE_PATH,
209
- GENERATED_RULE_FILES,
210
- collectFiles,
211
- warn,
212
- };
213
-
214
- await validateRequiredFiles(generalValidationContext);
215
- await validateMarkdownFiles(generalValidationContext);
216
- await validateRuleFiles(generalValidationContext);
217
- await validateChecklistConsolidation(generalValidationContext);
218
- await validateAgentsManifest(generalValidationContext);
219
- await validateCrossReferences(generalValidationContext);
220
- await validatePackageMetadata(generalValidationContext);
221
- await validatePolicyFile(generalValidationContext);
222
- await validateVersionConsistency(generalValidationContext);
223
- await validateDocumentationFlow(generalValidationContext);
224
- await validateTerminologyMapping(coverageValidationContext);
225
- await validateDetectionTransparencyCoverage(coverageValidationContext);
226
- await validateStackDecisionBoundaryCoverage(coverageValidationContext);
227
- await validateUniversalSopConsolidationCoverage(coverageValidationContext);
228
- await validateDiagramFormatCoverage(coverageValidationContext);
229
- await validateTemplateFreeBootstrapCoverage(coverageValidationContext);
230
- await validateUpgradeUiContractWarningCoverage(coverageValidationContext);
231
- await validateUiDesignAutomationCoverage(coverageValidationContext);
232
- await validateDockerRuntimeAutomationCoverage(coverageValidationContext);
233
- await validateDependencyFreshnessAutomationCoverage(coverageValidationContext);
234
- await validateDeterministicBoundaryEnforcementCoverage(coverageValidationContext);
235
- await validateRulesOnlyActiveSurfaceCoverage(coverageValidationContext);
236
- await validateMcpConfiguration(generalValidationContext);
237
- await validateHumanWritingGovernance(coverageValidationContext);
238
- await validateInstructionAdapters(coverageValidationContext);
239
- await validateSkillPurgeSurface(coverageValidationContext);
240
- await validateCacheLayerContractAudit();
241
- await validateReflectionCitationAudit();
242
- await validateCachingScopeHygieneAudit();
243
-
244
- await validateReleaseBundleAudit();
245
- await validateFileSizeAudit();
246
- await validateRuleIdUniquenessAudit();
247
-
248
- console.log('\n===============================================');
249
- console.log(' RESULTS');
250
- console.log('===============================================');
251
- console.log(` Passed: ${validationResult.passed}`);
252
- console.log(` Failed: ${validationResult.failed}`);
253
- console.log(` Warnings: ${validationResult.warnings.length}`);
254
- console.log('===============================================');
255
-
256
- if (validationResult.failed > 0) {
257
- console.log('\nVALIDATION FAILED\n');
258
- process.exit(1);
259
- }
260
-
261
- console.log('\nALL CHECKS PASSED\n');
262
- }
263
-
264
- main().catch((error) => {
265
- console.error('Validator crashed:', error);
266
- process.exit(1);
267
- });