@ryuenn3123/agentic-senior-core 2.0.5 → 2.0.7

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 (121) hide show
  1. package/.agent-context/blueprints/mobile-app.md +91 -21
  2. package/.agent-context/profiles/platform.md +13 -13
  3. package/.agent-context/profiles/regulated.md +13 -13
  4. package/.agent-context/profiles/startup.md +13 -13
  5. package/.agent-context/review-checklists/frontend-skill-parity.md +28 -28
  6. package/.agent-context/review-checklists/frontend-usability.md +33 -33
  7. package/.agent-context/review-checklists/release-operations.md +29 -29
  8. package/.agent-context/skills/README.md +62 -62
  9. package/.agent-context/skills/backend/README.md +67 -67
  10. package/.agent-context/skills/backend/architecture.md +360 -360
  11. package/.agent-context/skills/backend/compatibility-manifest.json +8 -8
  12. package/.agent-context/skills/backend/data-access.md +230 -230
  13. package/.agent-context/skills/backend/errors.md +137 -137
  14. package/.agent-context/skills/backend/validation.md +116 -116
  15. package/.agent-context/skills/backend.md +28 -28
  16. package/.agent-context/skills/cli/README.md +55 -49
  17. package/.agent-context/skills/cli/compatibility-manifest.json +8 -8
  18. package/.agent-context/skills/cli/init.md +37 -37
  19. package/.agent-context/skills/cli/output.md +35 -35
  20. package/.agent-context/skills/cli/safety-telemetry.md +39 -0
  21. package/.agent-context/skills/cli/upgrade.md +37 -37
  22. package/.agent-context/skills/cli.md +31 -28
  23. package/.agent-context/skills/distribution/.evidence/compatibility-manifest.json +9 -0
  24. package/.agent-context/skills/distribution/.evidence/sbom-excerpt.json +6 -0
  25. package/.agent-context/skills/distribution/.evidence/test-report.json +8 -0
  26. package/.agent-context/skills/distribution/CHANGELOG.md +7 -0
  27. package/.agent-context/skills/distribution/README.md +27 -19
  28. package/.agent-context/skills/distribution/compatibility-manifest.json +8 -8
  29. package/.agent-context/skills/distribution/compatibility.md +31 -31
  30. package/.agent-context/skills/distribution/package.json +5 -0
  31. package/.agent-context/skills/distribution/provenance-attestation.md +47 -0
  32. package/.agent-context/skills/distribution/publish.md +36 -36
  33. package/.agent-context/skills/distribution/rollback.md +31 -31
  34. package/.agent-context/skills/distribution/tests/.gitkeep +1 -0
  35. package/.agent-context/skills/distribution.md +31 -28
  36. package/.agent-context/skills/frontend/.evidence/compatibility-manifest.json +9 -0
  37. package/.agent-context/skills/frontend/.evidence/sbom-excerpt.json +6 -0
  38. package/.agent-context/skills/frontend/.evidence/test-report.json +8 -0
  39. package/.agent-context/skills/frontend/CHANGELOG.md +7 -0
  40. package/.agent-context/skills/frontend/README.md +49 -36
  41. package/.agent-context/skills/frontend/accessibility.md +107 -107
  42. package/.agent-context/skills/frontend/compatibility-manifest.json +8 -8
  43. package/.agent-context/skills/frontend/conversion-clarity.md +51 -0
  44. package/.agent-context/skills/frontend/motion.md +66 -66
  45. package/.agent-context/skills/frontend/package.json +5 -0
  46. package/.agent-context/skills/frontend/performance.md +62 -62
  47. package/.agent-context/skills/frontend/responsive-delivery.md +41 -0
  48. package/.agent-context/skills/frontend/tests/.gitkeep +1 -0
  49. package/.agent-context/skills/frontend/ui-architecture.md +128 -128
  50. package/.agent-context/skills/frontend.md +35 -29
  51. package/.agent-context/skills/fullstack/.evidence/compatibility-manifest.json +9 -0
  52. package/.agent-context/skills/fullstack/.evidence/sbom-excerpt.json +6 -0
  53. package/.agent-context/skills/fullstack/.evidence/test-report.json +8 -0
  54. package/.agent-context/skills/fullstack/CHANGELOG.md +7 -0
  55. package/.agent-context/skills/fullstack/README.md +27 -19
  56. package/.agent-context/skills/fullstack/compatibility-manifest.json +8 -8
  57. package/.agent-context/skills/fullstack/contracts.md +52 -52
  58. package/.agent-context/skills/fullstack/end-to-end.md +41 -41
  59. package/.agent-context/skills/fullstack/feature-slicing.md +64 -64
  60. package/.agent-context/skills/fullstack/package.json +5 -0
  61. package/.agent-context/skills/fullstack/release-coordination.md +51 -0
  62. package/.agent-context/skills/fullstack/tests/.gitkeep +1 -0
  63. package/.agent-context/skills/fullstack.md +29 -26
  64. package/.agent-context/skills/index.json +107 -107
  65. package/.agent-context/skills/review-quality/.evidence/compatibility-manifest.json +9 -0
  66. package/.agent-context/skills/review-quality/.evidence/sbom-excerpt.json +6 -0
  67. package/.agent-context/skills/review-quality/.evidence/test-report.json +8 -0
  68. package/.agent-context/skills/review-quality/CHANGELOG.md +7 -0
  69. package/.agent-context/skills/review-quality/README.md +27 -19
  70. package/.agent-context/skills/review-quality/benchmark.md +29 -29
  71. package/.agent-context/skills/review-quality/compatibility-manifest.json +8 -8
  72. package/.agent-context/skills/review-quality/package.json +5 -0
  73. package/.agent-context/skills/review-quality/planning.md +37 -37
  74. package/.agent-context/skills/review-quality/release-decision.md +49 -0
  75. package/.agent-context/skills/review-quality/security.md +33 -33
  76. package/.agent-context/skills/review-quality/tests/.gitkeep +1 -0
  77. package/.agent-context/skills/review-quality.md +30 -27
  78. package/.agent-context/stacks/flutter.md +16 -16
  79. package/.agent-context/stacks/react-native.md +16 -16
  80. package/.agent-context/state/architecture-map.md +25 -25
  81. package/.agent-context/state/benchmark-analysis.json +431 -431
  82. package/.agent-context/state/benchmark-thresholds.json +10 -10
  83. package/.agent-context/state/benchmark-watchlist.json +19 -19
  84. package/.agent-context/state/dependency-map.md +32 -32
  85. package/.agent-context/state/quality-trend-report.json +16 -6
  86. package/.agent-context/state/skill-platform.json +38 -38
  87. package/.agent-context/state/weekly-governance-report.json +126 -0
  88. package/.agent-override.md +36 -36
  89. package/.cursorrules +1 -1
  90. package/.gemini/instructions.md +20 -20
  91. package/.github/ISSUE_TEMPLATE/v1.7-frontend-work-item.yml +54 -54
  92. package/.github/copilot-instructions.md +20 -20
  93. package/.github/workflows/benchmark-detection.yml +38 -38
  94. package/.github/workflows/benchmark-intelligence.yml +50 -50
  95. package/.github/workflows/frontend-usability-gate.yml +36 -36
  96. package/.github/workflows/governance-weekly-report.yml +43 -0
  97. package/.github/workflows/release-gate.yml +32 -32
  98. package/.github/workflows/sbom-compliance.yml +32 -32
  99. package/.windsurfrules +1 -1
  100. package/AGENTS.md +27 -27
  101. package/README.md +383 -368
  102. package/lib/cli/commands/optimize.mjs +171 -171
  103. package/lib/cli/compatibility.mjs +124 -124
  104. package/lib/cli/constants.mjs +35 -0
  105. package/lib/cli/token-optimization.mjs +275 -275
  106. package/lib/cli/utils.mjs +4 -1
  107. package/mcp.json +92 -92
  108. package/package.json +2 -1
  109. package/scripts/benchmark-gate.mjs +121 -121
  110. package/scripts/benchmark-intelligence.mjs +140 -140
  111. package/scripts/detection-benchmark.mjs +138 -138
  112. package/scripts/frontend-usability-audit.mjs +87 -87
  113. package/scripts/generate-sbom.mjs +61 -61
  114. package/scripts/governance-weekly-report.mjs +293 -0
  115. package/scripts/init-project.ps1 +104 -104
  116. package/scripts/llm-judge.mjs +664 -664
  117. package/scripts/quality-trend-report.mjs +288 -288
  118. package/scripts/release-gate.mjs +261 -259
  119. package/scripts/skill-tier-policy.mjs +75 -75
  120. package/scripts/token-optimization-benchmark.mjs +252 -252
  121. package/scripts/validate.mjs +874 -865
@@ -1,87 +1,87 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * frontend-usability-audit.mjs
5
- *
6
- * Governance-level audit for V1.7 frontend execution assets.
7
- * This repository does not host a frontend runtime app, so the audit validates
8
- * required execution artifacts and quality gates documentation.
9
- */
10
-
11
- import { existsSync, readFileSync } from 'node:fs';
12
- import { resolve, dirname } from 'node:path';
13
- import { fileURLToPath } from 'node:url';
14
-
15
- const __filename = fileURLToPath(import.meta.url);
16
- const __dirname = dirname(__filename);
17
- const REPOSITORY_ROOT = resolve(__dirname, '..');
18
-
19
- const REQUIRED_FILES = [
20
- 'docs/roadmap.md',
21
- 'docs/v1.7-issue-breakdown.md',
22
- 'docs/v1.7-execution-playbook.md',
23
- '.agent-context/review-checklists/frontend-usability.md',
24
- ];
25
-
26
- const REQUIRED_ROADMAP_SNIPPETS = [
27
- 'V1.7',
28
- 'Frontend Product Experience',
29
- 'Release status: Completed',
30
- 'Delivered Scope',
31
- ];
32
-
33
- const REQUIRED_CHECKLIST_SNIPPETS = [
34
- 'Responsiveness',
35
- 'Accessibility',
36
- 'Performance',
37
- 'Documentation and Release Evidence',
38
- ];
39
-
40
- function assertFileExists(relativeFilePath, failures) {
41
- const absoluteFilePath = resolve(REPOSITORY_ROOT, relativeFilePath);
42
- if (!existsSync(absoluteFilePath)) {
43
- failures.push(`Missing required file: ${relativeFilePath}`);
44
- }
45
- }
46
-
47
- function assertContains(contentLabel, filePath, fileContent, snippets, failures) {
48
- for (const snippetText of snippets) {
49
- if (!fileContent.includes(snippetText)) {
50
- failures.push(`${contentLabel} missing snippet "${snippetText}" in ${filePath}`);
51
- }
52
- }
53
- }
54
-
55
- function runAudit() {
56
- const failures = [];
57
-
58
- for (const requiredFilePath of REQUIRED_FILES) {
59
- assertFileExists(requiredFilePath, failures);
60
- }
61
-
62
- const roadmapPath = 'docs/roadmap.md';
63
- const checklistPath = '.agent-context/review-checklists/frontend-usability.md';
64
-
65
- if (existsSync(resolve(REPOSITORY_ROOT, roadmapPath))) {
66
- const roadmapContent = readFileSync(resolve(REPOSITORY_ROOT, roadmapPath), 'utf8');
67
- assertContains('Roadmap', roadmapPath, roadmapContent, REQUIRED_ROADMAP_SNIPPETS, failures);
68
- }
69
-
70
- if (existsSync(resolve(REPOSITORY_ROOT, checklistPath))) {
71
- const checklistContent = readFileSync(resolve(REPOSITORY_ROOT, checklistPath), 'utf8');
72
- assertContains('Checklist', checklistPath, checklistContent, REQUIRED_CHECKLIST_SNIPPETS, failures);
73
- }
74
-
75
- const reportPayload = {
76
- generatedAt: new Date().toISOString(),
77
- auditName: 'frontend-usability-audit',
78
- passed: failures.length === 0,
79
- failureCount: failures.length,
80
- failures,
81
- };
82
-
83
- console.log(JSON.stringify(reportPayload, null, 2));
84
- process.exit(reportPayload.passed ? 0 : 1);
85
- }
86
-
87
- runAudit();
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * frontend-usability-audit.mjs
5
+ *
6
+ * Governance-level audit for V1.7 frontend execution assets.
7
+ * This repository does not host a frontend runtime app, so the audit validates
8
+ * required execution artifacts and quality gates documentation.
9
+ */
10
+
11
+ import { existsSync, readFileSync } from 'node:fs';
12
+ import { resolve, dirname } from 'node:path';
13
+ import { fileURLToPath } from 'node:url';
14
+
15
+ const __filename = fileURLToPath(import.meta.url);
16
+ const __dirname = dirname(__filename);
17
+ const REPOSITORY_ROOT = resolve(__dirname, '..');
18
+
19
+ const REQUIRED_FILES = [
20
+ 'docs/roadmap.md',
21
+ 'docs/v1.7-issue-breakdown.md',
22
+ 'docs/v1.7-execution-playbook.md',
23
+ '.agent-context/review-checklists/frontend-usability.md',
24
+ ];
25
+
26
+ const REQUIRED_ROADMAP_SNIPPETS = [
27
+ 'V1.7',
28
+ 'Frontend Product Experience',
29
+ 'Release status: Completed',
30
+ 'Delivered Scope',
31
+ ];
32
+
33
+ const REQUIRED_CHECKLIST_SNIPPETS = [
34
+ 'Responsiveness',
35
+ 'Accessibility',
36
+ 'Performance',
37
+ 'Documentation and Release Evidence',
38
+ ];
39
+
40
+ function assertFileExists(relativeFilePath, failures) {
41
+ const absoluteFilePath = resolve(REPOSITORY_ROOT, relativeFilePath);
42
+ if (!existsSync(absoluteFilePath)) {
43
+ failures.push(`Missing required file: ${relativeFilePath}`);
44
+ }
45
+ }
46
+
47
+ function assertContains(contentLabel, filePath, fileContent, snippets, failures) {
48
+ for (const snippetText of snippets) {
49
+ if (!fileContent.includes(snippetText)) {
50
+ failures.push(`${contentLabel} missing snippet "${snippetText}" in ${filePath}`);
51
+ }
52
+ }
53
+ }
54
+
55
+ function runAudit() {
56
+ const failures = [];
57
+
58
+ for (const requiredFilePath of REQUIRED_FILES) {
59
+ assertFileExists(requiredFilePath, failures);
60
+ }
61
+
62
+ const roadmapPath = 'docs/roadmap.md';
63
+ const checklistPath = '.agent-context/review-checklists/frontend-usability.md';
64
+
65
+ if (existsSync(resolve(REPOSITORY_ROOT, roadmapPath))) {
66
+ const roadmapContent = readFileSync(resolve(REPOSITORY_ROOT, roadmapPath), 'utf8');
67
+ assertContains('Roadmap', roadmapPath, roadmapContent, REQUIRED_ROADMAP_SNIPPETS, failures);
68
+ }
69
+
70
+ if (existsSync(resolve(REPOSITORY_ROOT, checklistPath))) {
71
+ const checklistContent = readFileSync(resolve(REPOSITORY_ROOT, checklistPath), 'utf8');
72
+ assertContains('Checklist', checklistPath, checklistContent, REQUIRED_CHECKLIST_SNIPPETS, failures);
73
+ }
74
+
75
+ const reportPayload = {
76
+ generatedAt: new Date().toISOString(),
77
+ auditName: 'frontend-usability-audit',
78
+ passed: failures.length === 0,
79
+ failureCount: failures.length,
80
+ failures,
81
+ };
82
+
83
+ console.log(JSON.stringify(reportPayload, null, 2));
84
+ process.exit(reportPayload.passed ? 0 : 1);
85
+ }
86
+
87
+ runAudit();
@@ -1,61 +1,61 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * generate-sbom.mjs
5
- *
6
- * Minimal CycloneDX-compatible SBOM for governance CI evidence.
7
- */
8
-
9
- import { readFileSync } from 'node:fs';
10
- import { resolve, dirname } from 'node:path';
11
- import { fileURLToPath } from 'node:url';
12
- import { randomUUID } from 'node:crypto';
13
-
14
- const __filename = fileURLToPath(import.meta.url);
15
- const __dirname = dirname(__filename);
16
- const REPOSITORY_ROOT = resolve(__dirname, '..');
17
- const PACKAGE_JSON_PATH = resolve(REPOSITORY_ROOT, 'package.json');
18
-
19
- function buildComponents(dependencyGroup, dependencies) {
20
- return Object.entries(dependencies || {}).map(([dependencyName, dependencyVersion]) => ({
21
- type: 'library',
22
- name: dependencyName,
23
- version: String(dependencyVersion).replace(/^[^\d]*/, ''),
24
- scope: dependencyGroup,
25
- purl: `pkg:npm/${dependencyName}@${String(dependencyVersion).replace(/^[^\d]*/, '')}`,
26
- }));
27
- }
28
-
29
- function generateSbom() {
30
- const packageManifest = JSON.parse(readFileSync(PACKAGE_JSON_PATH, 'utf8'));
31
- const runtimeComponents = buildComponents('required', packageManifest.dependencies);
32
- const developmentComponents = buildComponents('optional', packageManifest.devDependencies);
33
- const allComponents = [...runtimeComponents, ...developmentComponents];
34
-
35
- const sbomPayload = {
36
- bomFormat: 'CycloneDX',
37
- specVersion: '1.5',
38
- serialNumber: `urn:uuid:${randomUUID()}`,
39
- version: 1,
40
- metadata: {
41
- timestamp: new Date().toISOString(),
42
- component: {
43
- type: 'application',
44
- name: packageManifest.name,
45
- version: packageManifest.version,
46
- },
47
- tools: [
48
- {
49
- vendor: 'Agentic-Senior-Core',
50
- name: 'generate-sbom.mjs',
51
- version: packageManifest.version,
52
- },
53
- ],
54
- },
55
- components: allComponents,
56
- };
57
-
58
- console.log(JSON.stringify(sbomPayload, null, 2));
59
- }
60
-
61
- generateSbom();
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * generate-sbom.mjs
5
+ *
6
+ * Minimal CycloneDX-compatible SBOM for governance CI evidence.
7
+ */
8
+
9
+ import { readFileSync } from 'node:fs';
10
+ import { resolve, dirname } from 'node:path';
11
+ import { fileURLToPath } from 'node:url';
12
+ import { randomUUID } from 'node:crypto';
13
+
14
+ const __filename = fileURLToPath(import.meta.url);
15
+ const __dirname = dirname(__filename);
16
+ const REPOSITORY_ROOT = resolve(__dirname, '..');
17
+ const PACKAGE_JSON_PATH = resolve(REPOSITORY_ROOT, 'package.json');
18
+
19
+ function buildComponents(dependencyGroup, dependencies) {
20
+ return Object.entries(dependencies || {}).map(([dependencyName, dependencyVersion]) => ({
21
+ type: 'library',
22
+ name: dependencyName,
23
+ version: String(dependencyVersion).replace(/^[^\d]*/, ''),
24
+ scope: dependencyGroup,
25
+ purl: `pkg:npm/${dependencyName}@${String(dependencyVersion).replace(/^[^\d]*/, '')}`,
26
+ }));
27
+ }
28
+
29
+ function generateSbom() {
30
+ const packageManifest = JSON.parse(readFileSync(PACKAGE_JSON_PATH, 'utf8'));
31
+ const runtimeComponents = buildComponents('required', packageManifest.dependencies);
32
+ const developmentComponents = buildComponents('optional', packageManifest.devDependencies);
33
+ const allComponents = [...runtimeComponents, ...developmentComponents];
34
+
35
+ const sbomPayload = {
36
+ bomFormat: 'CycloneDX',
37
+ specVersion: '1.5',
38
+ serialNumber: `urn:uuid:${randomUUID()}`,
39
+ version: 1,
40
+ metadata: {
41
+ timestamp: new Date().toISOString(),
42
+ component: {
43
+ type: 'application',
44
+ name: packageManifest.name,
45
+ version: packageManifest.version,
46
+ },
47
+ tools: [
48
+ {
49
+ vendor: 'Agentic-Senior-Core',
50
+ name: 'generate-sbom.mjs',
51
+ version: packageManifest.version,
52
+ },
53
+ ],
54
+ },
55
+ components: allComponents,
56
+ };
57
+
58
+ console.log(JSON.stringify(sbomPayload, null, 2));
59
+ }
60
+
61
+ generateSbom();
@@ -0,0 +1,293 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * governance-weekly-report.mjs
5
+ *
6
+ * Aggregates weekly governance readiness signals for maintainers.
7
+ * Produces a machine-readable report with trend, trust, and release posture.
8
+ */
9
+
10
+ import { existsSync, readFileSync } from 'node:fs';
11
+ import fs from 'node:fs/promises';
12
+ import { spawnSync } from 'node:child_process';
13
+ import { dirname, join, resolve } from 'node:path';
14
+ import { fileURLToPath } from 'node:url';
15
+ import { calculateTrustScore } from './trust-scorer.mjs';
16
+
17
+ const SCRIPT_FILE_PATH = fileURLToPath(import.meta.url);
18
+ const SCRIPT_DIR = dirname(SCRIPT_FILE_PATH);
19
+ const REPOSITORY_ROOT = resolve(SCRIPT_DIR, '..');
20
+ const QUALITY_TREND_PATH = join(REPOSITORY_ROOT, '.agent-context', 'state', 'quality-trend-report.json');
21
+ const REPORT_PATH = join(REPOSITORY_ROOT, '.agent-context', 'state', 'weekly-governance-report.json');
22
+ const ARGUMENT_FLAGS = new Set(process.argv.slice(2));
23
+ const isStdoutOnlyMode = ARGUMENT_FLAGS.has('--stdout-only');
24
+ const WEEKLY_WINDOW_DAYS = 7;
25
+ const HISTORY_LIMIT = 26;
26
+ const REQUIRED_VERIFIED_DOMAINS = new Set(['cli', 'frontend', 'fullstack', 'distribution', 'review-quality']);
27
+
28
+ function readJsonOrNull(filePath) {
29
+ if (!existsSync(filePath)) {
30
+ return null;
31
+ }
32
+
33
+ try {
34
+ return JSON.parse(readFileSync(filePath, 'utf8'));
35
+ } catch {
36
+ return null;
37
+ }
38
+ }
39
+
40
+ function runJsonScript(scriptRelativePath, scriptArguments = []) {
41
+ const absoluteScriptPath = join(REPOSITORY_ROOT, scriptRelativePath);
42
+ const commandResult = spawnSync('node', [absoluteScriptPath, ...scriptArguments], {
43
+ cwd: REPOSITORY_ROOT,
44
+ encoding: 'utf8',
45
+ maxBuffer: 1024 * 1024 * 10,
46
+ });
47
+
48
+ const standardOutput = (commandResult.stdout || '').trim();
49
+ const standardError = (commandResult.stderr || '').trim();
50
+ const exitCode = typeof commandResult.status === 'number' ? commandResult.status : 1;
51
+
52
+ if (!standardOutput) {
53
+ return {
54
+ scriptPath: scriptRelativePath,
55
+ exitCode,
56
+ parsedReport: null,
57
+ parseError: 'Script produced no stdout JSON payload',
58
+ stderr: standardError,
59
+ };
60
+ }
61
+
62
+ try {
63
+ return {
64
+ scriptPath: scriptRelativePath,
65
+ exitCode,
66
+ parsedReport: JSON.parse(standardOutput),
67
+ parseError: null,
68
+ stderr: standardError,
69
+ };
70
+ } catch (jsonParseError) {
71
+ const parseErrorMessage = jsonParseError instanceof Error ? jsonParseError.message : String(jsonParseError);
72
+ return {
73
+ scriptPath: scriptRelativePath,
74
+ exitCode,
75
+ parsedReport: null,
76
+ parseError: parseErrorMessage,
77
+ stderr: standardError,
78
+ };
79
+ }
80
+ }
81
+
82
+ function loadQualityTrendReport() {
83
+ const existingQualityTrend = readJsonOrNull(QUALITY_TREND_PATH);
84
+ if (existingQualityTrend) {
85
+ return {
86
+ source: 'state-file',
87
+ report: existingQualityTrend,
88
+ freshness: existingQualityTrend.generatedAt || null,
89
+ };
90
+ }
91
+
92
+ const generatedQualityTrend = runJsonScript('scripts/quality-trend-report.mjs', ['--stdout-only']);
93
+ return {
94
+ source: 'generated-stdout',
95
+ report: generatedQualityTrend.parsedReport,
96
+ freshness: generatedQualityTrend.parsedReport?.generatedAt || null,
97
+ parseError: generatedQualityTrend.parseError,
98
+ exitCode: generatedQualityTrend.exitCode,
99
+ };
100
+ }
101
+
102
+ function collectCommitSignals(windowDays) {
103
+ const commitLogResult = spawnSync('git', ['log', `--since=${windowDays}.days`, '--pretty=format:%s'], {
104
+ cwd: REPOSITORY_ROOT,
105
+ encoding: 'utf8',
106
+ maxBuffer: 1024 * 1024,
107
+ });
108
+
109
+ if (commitLogResult.status !== 0) {
110
+ return {
111
+ windowDays,
112
+ commitCount: 0,
113
+ releaseCommitCount: 0,
114
+ rollbackCommitCount: 0,
115
+ releaseFrequencyPercent: null,
116
+ rollbackFrequencyPercent: null,
117
+ error: (commitLogResult.stderr || 'Failed to read git log').trim(),
118
+ };
119
+ }
120
+
121
+ const commitSubjects = (commitLogResult.stdout || '')
122
+ .split(/\r?\n/u)
123
+ .map((subjectLine) => subjectLine.trim())
124
+ .filter((subjectLine) => subjectLine.length > 0);
125
+
126
+ const commitCount = commitSubjects.length;
127
+ const releaseCommitCount = commitSubjects.filter((subjectLine) => /release|publish|chore\(release\)/i.test(subjectLine)).length;
128
+ const rollbackCommitCount = commitSubjects.filter((subjectLine) => /rollback|revert/i.test(subjectLine)).length;
129
+
130
+ return {
131
+ windowDays,
132
+ commitCount,
133
+ releaseCommitCount,
134
+ rollbackCommitCount,
135
+ releaseFrequencyPercent: commitCount === 0 ? 0 : Number(((releaseCommitCount / commitCount) * 100).toFixed(2)),
136
+ rollbackFrequencyPercent: commitCount === 0 ? 0 : Number(((rollbackCommitCount / commitCount) * 100).toFixed(2)),
137
+ error: null,
138
+ };
139
+ }
140
+
141
+ async function collectSkillTrustSignals() {
142
+ const skillDirectoryPath = join(REPOSITORY_ROOT, '.agent-context', 'skills');
143
+ const skillDirectoryEntries = await fs.readdir(skillDirectoryPath, { withFileTypes: true });
144
+ const skillDomainNames = skillDirectoryEntries
145
+ .filter((directoryEntry) => directoryEntry.isDirectory())
146
+ .map((directoryEntry) => directoryEntry.name)
147
+ .sort((leftDomainName, rightDomainName) => leftDomainName.localeCompare(rightDomainName));
148
+
149
+ const trustRows = [];
150
+ const tierCounts = {
151
+ verified: 0,
152
+ community: 0,
153
+ experimental: 0,
154
+ };
155
+
156
+ for (const skillDomainName of skillDomainNames) {
157
+ const trustResult = await calculateTrustScore(join(skillDirectoryPath, skillDomainName));
158
+
159
+ if (typeof tierCounts[trustResult.tier] === 'number') {
160
+ tierCounts[trustResult.tier] += 1;
161
+ }
162
+
163
+ trustRows.push({
164
+ domain: skillDomainName,
165
+ tier: trustResult.tier,
166
+ score: trustResult.score,
167
+ });
168
+ }
169
+
170
+ const requiredVerifiedDomainFailures = trustRows
171
+ .filter((trustRow) => REQUIRED_VERIFIED_DOMAINS.has(trustRow.domain) && trustRow.tier !== 'verified')
172
+ .map((trustRow) => trustRow.domain);
173
+
174
+ return {
175
+ domains: trustRows,
176
+ tierCounts,
177
+ requiredVerifiedDomains: Array.from(REQUIRED_VERIFIED_DOMAINS),
178
+ requiredVerifiedDomainFailures,
179
+ allRequiredVerified: requiredVerifiedDomainFailures.length === 0,
180
+ };
181
+ }
182
+
183
+ function buildBlockers(qualityTrendReport, skillTrustSignals, commitSignals) {
184
+ const blockers = [];
185
+
186
+ const qualityGatePassRatePercent = qualityTrendReport?.governanceHealth?.gatePassRatePercent;
187
+ if (typeof qualityGatePassRatePercent !== 'number' || qualityGatePassRatePercent < 100) {
188
+ blockers.push('Governance gate pass rate is below 100%.');
189
+ }
190
+
191
+ if (!skillTrustSignals.allRequiredVerified) {
192
+ blockers.push(
193
+ `Required verified skill domains missing: ${skillTrustSignals.requiredVerifiedDomainFailures.join(', ')}`
194
+ );
195
+ }
196
+
197
+ if (commitSignals.error) {
198
+ blockers.push(`Commit signal extraction failed: ${commitSignals.error}`);
199
+ }
200
+
201
+ return blockers;
202
+ }
203
+
204
+ function buildHistoryEntry(weeklyReport) {
205
+ return {
206
+ generatedAt: weeklyReport.generatedAt,
207
+ readinessStatus: weeklyReport.releaseReadiness.isReady ? 'ready' : 'blocked',
208
+ blockerCount: weeklyReport.releaseReadiness.blockers.length,
209
+ gatePassRatePercent: weeklyReport.qualitySignals.governanceHealth.gatePassRatePercent,
210
+ verifiedSkillDomainCount: weeklyReport.skillTrust.tierCounts.verified,
211
+ releaseFrequencyPercent: weeklyReport.commitSignals.releaseFrequencyPercent,
212
+ rollbackFrequencyPercent: weeklyReport.commitSignals.rollbackFrequencyPercent,
213
+ };
214
+ }
215
+
216
+ function mergeHistory(previousReport, currentHistoryEntry) {
217
+ const existingHistory = Array.isArray(previousReport?.history) ? previousReport.history : [];
218
+ const mergedHistory = [...existingHistory, currentHistoryEntry];
219
+
220
+ if (mergedHistory.length <= HISTORY_LIMIT) {
221
+ return mergedHistory;
222
+ }
223
+
224
+ return mergedHistory.slice(mergedHistory.length - HISTORY_LIMIT);
225
+ }
226
+
227
+ async function runWeeklyGovernanceReport() {
228
+ const qualityTrendState = loadQualityTrendReport();
229
+ const qualityTrendReport = qualityTrendState.report;
230
+
231
+ const skillTrustSignals = await collectSkillTrustSignals();
232
+ const commitSignals = collectCommitSignals(WEEKLY_WINDOW_DAYS);
233
+ const blockers = buildBlockers(qualityTrendReport, skillTrustSignals, commitSignals);
234
+
235
+ const weeklyReportSnapshot = {
236
+ generatedAt: new Date().toISOString(),
237
+ reportName: 'weekly-governance-report',
238
+ methodology: {
239
+ qualityTrendSource: qualityTrendState.source,
240
+ qualityTrendGeneratedAt: qualityTrendState.freshness,
241
+ commitWindowDays: WEEKLY_WINDOW_DAYS,
242
+ requiredVerifiedDomains: Array.from(REQUIRED_VERIFIED_DOMAINS),
243
+ },
244
+ qualitySignals: {
245
+ governanceHealth: {
246
+ availableGateCount: qualityTrendReport?.governanceHealth?.availableGateCount ?? null,
247
+ passedGateCount: qualityTrendReport?.governanceHealth?.passedGateCount ?? null,
248
+ gatePassRatePercent: qualityTrendReport?.governanceHealth?.gatePassRatePercent ?? null,
249
+ },
250
+ rejectionCategories: Array.isArray(qualityTrendReport?.rejectionCategories)
251
+ ? qualityTrendReport.rejectionCategories
252
+ : [],
253
+ tokenEfficiency: qualityTrendReport?.tokenEfficiency || null,
254
+ },
255
+ skillTrust: skillTrustSignals,
256
+ commitSignals,
257
+ releaseReadiness: {
258
+ isReady: blockers.length === 0,
259
+ blockers,
260
+ summary: blockers.length === 0
261
+ ? 'Weekly governance posture is ready for maintenance releases.'
262
+ : 'Weekly governance posture is blocked by unresolved readiness signals.',
263
+ },
264
+ artifact: {
265
+ path: REPORT_PATH,
266
+ writeMode: isStdoutOnlyMode ? 'stdout-only' : 'stdout-and-file',
267
+ },
268
+ };
269
+
270
+ const previousReport = readJsonOrNull(REPORT_PATH);
271
+ const history = mergeHistory(previousReport, buildHistoryEntry(weeklyReportSnapshot));
272
+ const weeklyReport = {
273
+ ...weeklyReportSnapshot,
274
+ history,
275
+ };
276
+
277
+ if (!isStdoutOnlyMode) {
278
+ await fs.mkdir(dirname(REPORT_PATH), { recursive: true });
279
+ await fs.writeFile(REPORT_PATH, JSON.stringify(weeklyReport, null, 2) + '\n', 'utf8');
280
+ }
281
+
282
+ return weeklyReport;
283
+ }
284
+
285
+ runWeeklyGovernanceReport()
286
+ .then((weeklyReport) => {
287
+ console.log(JSON.stringify(weeklyReport, null, 2));
288
+ })
289
+ .catch((reportError) => {
290
+ const errorMessage = reportError instanceof Error ? reportError.message : String(reportError);
291
+ console.error(`Weekly governance report failed: ${errorMessage}`);
292
+ process.exit(1);
293
+ });