@ryuenn3123/agentic-senior-core 4.3.2 → 4.3.4

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 (36) hide show
  1. package/.agent-context/prompts/bootstrap-design.md +56 -222
  2. package/.agent-context/rules/api-docs.md +17 -126
  3. package/.agent-context/rules/api-versioning.md +9 -86
  4. package/.agent-context/rules/architecture.md +18 -136
  5. package/.agent-context/rules/background-jobs.md +9 -85
  6. package/.agent-context/rules/config-and-flags.md +8 -71
  7. package/.agent-context/rules/database-design.md +9 -65
  8. package/.agent-context/rules/docker-runtime.md +9 -62
  9. package/.agent-context/rules/efficiency-vs-hype.md +7 -37
  10. package/.agent-context/rules/error-handling.md +8 -33
  11. package/.agent-context/rules/event-driven.md +8 -34
  12. package/.agent-context/rules/frontend-architecture.md +22 -140
  13. package/.agent-context/rules/git-workflow.md +8 -77
  14. package/.agent-context/rules/microservices.md +8 -36
  15. package/.agent-context/rules/migrations.md +8 -76
  16. package/.agent-context/rules/observability.md +7 -60
  17. package/.agent-context/rules/performance.md +8 -28
  18. package/.agent-context/rules/realtime.md +7 -22
  19. package/.agent-context/rules/resilience.md +9 -69
  20. package/.agent-context/rules/security.md +9 -64
  21. package/.agent-context/rules/testing.md +8 -34
  22. package/AGENTS.md +10 -17
  23. package/README.md +1 -1
  24. package/lib/cli/adaptive-context/catalog.mjs +1 -6
  25. package/lib/cli/compiler.mjs +1 -2
  26. package/lib/cli/project-scaffolder/prompt-builders.mjs +21 -149
  27. package/package.json +1 -1
  28. package/scripts/frontend-usability-audit.mjs +4 -45
  29. package/scripts/release-gate/constants.mjs +1 -0
  30. package/scripts/validate/config.mjs +20 -134
  31. package/scripts/validate/coverage-checks.mjs +2 -12
  32. package/scripts/validate/file-structure.mjs +165 -0
  33. package/scripts/validate/markdown-content.mjs +109 -0
  34. package/scripts/validate/project-metadata.mjs +166 -0
  35. package/scripts/validate.mjs +42 -435
  36. package/.agent-context/prompts/research-design.md +0 -160
@@ -0,0 +1,165 @@
1
+ import { join } from 'node:path';
2
+ import { readdir } from 'node:fs/promises';
3
+
4
+ export async function validateRequiredFiles(context) {
5
+ const { ROOT_DIR, fileExists, pass, fail } = context;
6
+ console.log('\nChecking required files...');
7
+
8
+ const requiredFiles = [
9
+ 'bin/agentic-senior-core.js',
10
+ 'scripts/validate.mjs',
11
+ 'scripts/llm-judge.mjs',
12
+ 'scripts/detection-benchmark.mjs',
13
+ 'scripts/benchmark-evidence-bundle.mjs',
14
+ 'scripts/benchmark-writer-judge-matrix.mjs',
15
+ 'scripts/benchmark-gate.mjs',
16
+ 'scripts/benchmark-intelligence.mjs',
17
+ 'scripts/memory-continuity-benchmark.mjs',
18
+ 'scripts/docs-quality-drift-report.mjs',
19
+ 'scripts/governance-weekly-report.mjs',
20
+ 'scripts/mcp-server.mjs',
21
+ 'scripts/mcp-server/constants.mjs',
22
+ 'scripts/mcp-server/tool-registry.mjs',
23
+ 'scripts/mcp-server/tools.mjs',
24
+ 'scripts/frontend-usability-audit.mjs',
25
+ 'scripts/ui-design-judge.mjs',
26
+ 'scripts/documentation-boundary-audit.mjs',
27
+ 'scripts/context-triggered-audit.mjs',
28
+ 'scripts/rules-guardian-audit.mjs',
29
+ 'scripts/explain-on-demand-audit.mjs',
30
+ 'scripts/single-source-lazy-loading-audit.mjs',
31
+ 'scripts/audit-cache-layer-contract.mjs',
32
+ 'scripts/audit-typography-palette-anti-repeat.mjs',
33
+ 'lib/cli/audits/typography-palette-anti-repeat-audit.mjs',
34
+ 'lib/cli/commands/audit-design-anti-repeat.mjs',
35
+ 'scripts/sync-thin-adapters.mjs',
36
+ 'scripts/release-gate.mjs',
37
+ 'scripts/generate-sbom.mjs',
38
+ '.agent-context/policies/llm-judge-threshold.json',
39
+ '.agent-context/prompts/compact-natural-mode.md',
40
+ 'mcp.json',
41
+ 'AGENTS.md',
42
+ 'CLAUDE.md',
43
+ 'GEMINI.md',
44
+ 'README.md',
45
+ 'CHANGELOG.md',
46
+ 'docs/doc-index.md',
47
+ 'docs/project-brief.md',
48
+ 'docs/flow-overview.md',
49
+ 'docs/api-contract.md',
50
+ 'docs/faq.md',
51
+ 'docs/deep-dive.md',
52
+ 'docs/archive/HISTORY.md',
53
+ 'docs/archive/CHANGELOG-archive.md',
54
+ '.agent-context/state/benchmark-reproducibility.json',
55
+ '.agent-context/state/benchmark-writer-judge-config.json',
56
+ '.agent-context/state/memory-schema-v1.json',
57
+ '.agent-context/state/memory-adapter-contract.json',
58
+ '.vscode/mcp.json',
59
+ '.github/workflows/release-gate.yml',
60
+ '.github/workflows/sbom-compliance.yml',
61
+ '.github/workflows/benchmark-intelligence.yml',
62
+ '.github/workflows/docs-quality-drift-report.yml',
63
+ '.github/workflows/governance-weekly-report.yml',
64
+ 'tests/cli-smoke.test.mjs',
65
+ 'tests/mcp-server.test.mjs',
66
+ 'tests/llm-judge.test.mjs',
67
+ 'tests/operations.test.mjs',
68
+ 'LICENSE',
69
+ '.gitignore',
70
+ ];
71
+
72
+ for (const requiredFilePath of requiredFiles) {
73
+ const absoluteRequiredFilePath = join(ROOT_DIR, requiredFilePath);
74
+
75
+ if (await fileExists(absoluteRequiredFilePath)) {
76
+ pass(requiredFilePath);
77
+ continue;
78
+ }
79
+
80
+ fail(`Missing required file: ${requiredFilePath}`);
81
+ }
82
+ }
83
+
84
+ export async function validateRuleFiles(context) {
85
+ const { AGENT_CONTEXT_DIR, fileExists, readTextFile, pass, fail } = context;
86
+ console.log('\nChecking rule, checklist, prompt, and state files...');
87
+
88
+ const expectedPaths = [
89
+ 'rules/naming-conv.md',
90
+ 'rules/architecture.md',
91
+ 'rules/security.md',
92
+ 'rules/performance.md',
93
+ 'rules/error-handling.md',
94
+ 'rules/testing.md',
95
+ 'rules/git-workflow.md',
96
+ 'rules/efficiency-vs-hype.md',
97
+ 'rules/api-docs.md',
98
+ 'rules/microservices.md',
99
+ 'rules/event-driven.md',
100
+ 'rules/database-design.md',
101
+ 'rules/realtime.md',
102
+ 'rules/frontend-architecture.md',
103
+ 'rules/docker-runtime.md',
104
+ 'rules/observability.md',
105
+ 'rules/resilience.md',
106
+ 'rules/migrations.md',
107
+ 'rules/background-jobs.md',
108
+ 'rules/config-and-flags.md',
109
+ 'rules/api-versioning.md',
110
+ 'review-checklists/pr-checklist.md',
111
+ 'review-checklists/architecture-review.md',
112
+ 'prompts/init-project.md',
113
+ 'prompts/compact-natural-mode.md',
114
+ 'prompts/bootstrap-design.md',
115
+ 'prompts/refactor.md',
116
+ 'prompts/review-code.md',
117
+ 'state/architecture-map.md',
118
+ 'state/dependency-map.md',
119
+ ];
120
+
121
+ for (const expectedPath of expectedPaths) {
122
+ const absoluteExpectedPath = join(AGENT_CONTEXT_DIR, expectedPath);
123
+
124
+ if (!(await fileExists(absoluteExpectedPath))) {
125
+ fail(`Missing agent context file: .agent-context/${expectedPath}`);
126
+ continue;
127
+ }
128
+
129
+ const fileContent = await readTextFile(absoluteExpectedPath);
130
+ if (fileContent.trim().length < 100) {
131
+ fail(`Agent context file is suspiciously short: .agent-context/${expectedPath}`);
132
+ continue;
133
+ }
134
+
135
+ pass(`.agent-context/${expectedPath}`);
136
+ }
137
+ }
138
+
139
+ export async function validateChecklistConsolidation(context) {
140
+ const { AGENT_CONTEXT_DIR, pass, fail } = context;
141
+ console.log('\nChecking review checklist consolidation...');
142
+
143
+ const reviewChecklistDirectoryPath = join(AGENT_CONTEXT_DIR, 'review-checklists');
144
+ const checklistEntries = await readdir(reviewChecklistDirectoryPath, { withFileTypes: true });
145
+ const checklistFileNames = checklistEntries
146
+ .filter((entry) => entry.isFile() && entry.name.endsWith('.md'))
147
+ .map((entry) => entry.name)
148
+ .sort((leftName, rightName) => leftName.localeCompare(rightName));
149
+
150
+ const expectedChecklistFileNames = ['architecture-review.md', 'pr-checklist.md'];
151
+
152
+ if (checklistFileNames.length <= 2) {
153
+ pass(`Checklist count is consolidated (${checklistFileNames.length}/2)`);
154
+ } else {
155
+ fail(`Checklist count exceeds limit (${checklistFileNames.length}/2): ${checklistFileNames.join(', ')}`);
156
+ }
157
+
158
+ for (const expectedChecklistFileName of expectedChecklistFileNames) {
159
+ if (checklistFileNames.includes(expectedChecklistFileName)) {
160
+ pass(`Checklist exists: .agent-context/review-checklists/${expectedChecklistFileName}`);
161
+ } else {
162
+ fail(`Missing consolidated checklist: .agent-context/review-checklists/${expectedChecklistFileName}`);
163
+ }
164
+ }
165
+ }
@@ -0,0 +1,109 @@
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
+ }
@@ -0,0 +1,166 @@
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
+ }