@ryuenn3123/agentic-senior-core 2.0.3 → 2.0.5

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 (87) hide show
  1. package/.agent-context/blueprints/mobile-app.md +21 -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 +49 -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/upgrade.md +37 -37
  21. package/.agent-context/skills/cli.md +28 -28
  22. package/.agent-context/skills/distribution/README.md +18 -18
  23. package/.agent-context/skills/distribution/compatibility-manifest.json +8 -8
  24. package/.agent-context/skills/distribution/compatibility.md +31 -31
  25. package/.agent-context/skills/distribution/publish.md +36 -36
  26. package/.agent-context/skills/distribution/rollback.md +31 -31
  27. package/.agent-context/skills/distribution.md +28 -28
  28. package/.agent-context/skills/frontend/README.md +35 -35
  29. package/.agent-context/skills/frontend/accessibility.md +107 -107
  30. package/.agent-context/skills/frontend/compatibility-manifest.json +8 -8
  31. package/.agent-context/skills/frontend/motion.md +66 -66
  32. package/.agent-context/skills/frontend/performance.md +62 -62
  33. package/.agent-context/skills/frontend/ui-architecture.md +128 -128
  34. package/.agent-context/skills/frontend.md +29 -29
  35. package/.agent-context/skills/fullstack/README.md +18 -18
  36. package/.agent-context/skills/fullstack/compatibility-manifest.json +8 -8
  37. package/.agent-context/skills/fullstack/contracts.md +52 -52
  38. package/.agent-context/skills/fullstack/end-to-end.md +41 -41
  39. package/.agent-context/skills/fullstack/feature-slicing.md +64 -64
  40. package/.agent-context/skills/fullstack.md +26 -26
  41. package/.agent-context/skills/index.json +107 -107
  42. package/.agent-context/skills/review-quality/README.md +18 -18
  43. package/.agent-context/skills/review-quality/benchmark.md +29 -29
  44. package/.agent-context/skills/review-quality/compatibility-manifest.json +8 -8
  45. package/.agent-context/skills/review-quality/planning.md +37 -37
  46. package/.agent-context/skills/review-quality/security.md +33 -33
  47. package/.agent-context/skills/review-quality.md +27 -27
  48. package/.agent-context/stacks/flutter.md +16 -16
  49. package/.agent-context/stacks/react-native.md +16 -16
  50. package/.agent-context/state/architecture-map.md +25 -25
  51. package/.agent-context/state/benchmark-analysis.json +431 -431
  52. package/.agent-context/state/benchmark-thresholds.json +10 -10
  53. package/.agent-context/state/benchmark-watchlist.json +19 -19
  54. package/.agent-context/state/dependency-map.md +32 -32
  55. package/.agent-context/state/quality-trend-report.json +79 -0
  56. package/.agent-context/state/skill-platform.json +38 -38
  57. package/.agent-context/state/token-optimization-benchmark.json +130 -0
  58. package/.agent-override.md +36 -36
  59. package/.cursorrules +1 -1
  60. package/.gemini/instructions.md +21 -97
  61. package/.github/ISSUE_TEMPLATE/v1.7-frontend-work-item.yml +54 -54
  62. package/.github/copilot-instructions.md +21 -166
  63. package/.github/workflows/benchmark-detection.yml +38 -38
  64. package/.github/workflows/benchmark-intelligence.yml +50 -50
  65. package/.github/workflows/frontend-usability-gate.yml +36 -36
  66. package/.github/workflows/release-gate.yml +32 -32
  67. package/.github/workflows/sbom-compliance.yml +32 -32
  68. package/.windsurfrules +1 -1
  69. package/AGENTS.md +28 -181
  70. package/README.md +368 -346
  71. package/lib/cli/commands/optimize.mjs +171 -171
  72. package/lib/cli/compatibility.mjs +124 -124
  73. package/lib/cli/token-optimization.mjs +275 -275
  74. package/mcp.json +92 -92
  75. package/package.json +3 -1
  76. package/scripts/benchmark-gate.mjs +121 -121
  77. package/scripts/benchmark-intelligence.mjs +140 -140
  78. package/scripts/detection-benchmark.mjs +138 -138
  79. package/scripts/frontend-usability-audit.mjs +87 -87
  80. package/scripts/generate-sbom.mjs +61 -61
  81. package/scripts/init-project.ps1 +104 -104
  82. package/scripts/llm-judge.mjs +664 -664
  83. package/scripts/quality-trend-report.mjs +289 -0
  84. package/scripts/release-gate.mjs +259 -204
  85. package/scripts/skill-tier-policy.mjs +75 -75
  86. package/scripts/token-optimization-benchmark.mjs +252 -0
  87. package/scripts/validate.mjs +865 -811
@@ -0,0 +1,252 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * token-optimization-benchmark.mjs
5
+ *
6
+ * Measures token-estimate reduction between baseline commands and
7
+ * native optimized command variants. If RTK is installed, it also
8
+ * compares RTK command output in the same scenarios.
9
+ */
10
+
11
+ import { existsSync } from 'node:fs';
12
+ import fs from 'node:fs/promises';
13
+ import { spawnSync } from 'node:child_process';
14
+ import { dirname, join, resolve } from 'node:path';
15
+ import { fileURLToPath } from 'node:url';
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 REPORT_PATH = join(REPOSITORY_ROOT, '.agent-context', 'state', 'token-optimization-benchmark.json');
21
+ const LOCAL_RTK_BINARY_PATH = join(REPOSITORY_ROOT, '.benchmarks', 'tools', 'rtk', 'rtk.exe');
22
+ const TOKEN_ESTIMATE_DIVISOR = 4;
23
+ const ARGUMENT_FLAGS = new Set(process.argv.slice(2));
24
+ const isStdoutOnlyMode = ARGUMENT_FLAGS.has('--stdout-only');
25
+
26
+ const BENCHMARK_SCENARIOS = [
27
+ {
28
+ scenarioId: 'git-show',
29
+ scenarioName: 'Latest commit detail review',
30
+ baselineCommand: { command: 'git', args: ['show', 'HEAD', '--stat', '--patch', '--no-color'] },
31
+ nativeOptimizedCommand: { command: 'git', args: ['show', 'HEAD', '--stat', '--no-color'] },
32
+ rtkCommand: { command: 'rtk', args: ['git', 'show', 'HEAD', '--stat', '--patch', '--no-color'] },
33
+ },
34
+ {
35
+ scenarioId: 'git-log',
36
+ scenarioName: 'Commit history review',
37
+ baselineCommand: { command: 'git', args: ['log', '-n', '50'] },
38
+ nativeOptimizedCommand: { command: 'git', args: ['log', '--oneline', '-n', '50'] },
39
+ rtkCommand: { command: 'rtk', args: ['git', 'log', '-n', '50'] },
40
+ },
41
+ {
42
+ scenarioId: 'search-token',
43
+ scenarioName: 'Search result scan',
44
+ baselineCommand: { command: 'git', args: ['grep', '-n', 'token'] },
45
+ nativeOptimizedCommand: { command: 'git', args: ['grep', '-n', 'token', 'README.md', 'docs'] },
46
+ rtkCommand: { command: 'rtk', args: ['git', 'grep', '-n', 'token'] },
47
+ },
48
+ ];
49
+
50
+ function estimateTokenCount(outputText) {
51
+ if (!outputText || outputText.length === 0) {
52
+ return 0;
53
+ }
54
+
55
+ return Math.ceil(outputText.length / TOKEN_ESTIMATE_DIVISOR);
56
+ }
57
+
58
+ function formatCommandLine(commandDefinition) {
59
+ return [commandDefinition.command, ...commandDefinition.args].join(' ');
60
+ }
61
+
62
+ function executeCommand(commandDefinition) {
63
+ const commandResult = spawnSync(commandDefinition.command, commandDefinition.args, {
64
+ cwd: REPOSITORY_ROOT,
65
+ encoding: 'utf8',
66
+ maxBuffer: 1024 * 1024 * 20,
67
+ });
68
+
69
+ const standardOutput = commandResult.stdout || '';
70
+ const standardError = commandResult.stderr || '';
71
+ const combinedOutput = `${standardOutput}${standardError}`;
72
+ const normalizedOutput = combinedOutput.trimEnd();
73
+
74
+ const outputLineCount = normalizedOutput.length === 0
75
+ ? 0
76
+ : normalizedOutput.split(/\r?\n/u).length;
77
+
78
+ return {
79
+ command: formatCommandLine(commandDefinition),
80
+ exitCode: typeof commandResult.status === 'number' ? commandResult.status : 1,
81
+ outputChars: normalizedOutput.length,
82
+ outputLines: outputLineCount,
83
+ estimatedTokens: estimateTokenCount(normalizedOutput),
84
+ };
85
+ }
86
+
87
+ function resolveRtkBinaryPath() {
88
+ const configuredRtkBinaryPath = process.env.RTK_BINARY_PATH;
89
+
90
+ if (configuredRtkBinaryPath && existsSync(configuredRtkBinaryPath)) {
91
+ return {
92
+ executablePath: configuredRtkBinaryPath,
93
+ source: 'env',
94
+ };
95
+ }
96
+
97
+ if (existsSync(LOCAL_RTK_BINARY_PATH)) {
98
+ return {
99
+ executablePath: LOCAL_RTK_BINARY_PATH,
100
+ source: 'local-tools',
101
+ };
102
+ }
103
+
104
+ return {
105
+ executablePath: 'rtk',
106
+ source: 'system-path',
107
+ };
108
+ }
109
+
110
+ function detectRtkAvailability() {
111
+ const rtkBinary = resolveRtkBinaryPath();
112
+
113
+ const versionResult = spawnSync(rtkBinary.executablePath, ['--version'], {
114
+ cwd: REPOSITORY_ROOT,
115
+ encoding: 'utf8',
116
+ maxBuffer: 1024 * 1024,
117
+ });
118
+
119
+ if (versionResult.error || versionResult.status !== 0) {
120
+ return {
121
+ isAvailable: false,
122
+ version: null,
123
+ source: rtkBinary.source,
124
+ executablePath: rtkBinary.executablePath,
125
+ reason: versionResult.error
126
+ ? versionResult.error.message
127
+ : (versionResult.stderr || versionResult.stdout || 'RTK command unavailable').trim(),
128
+ };
129
+ }
130
+
131
+ const versionMatch = (versionResult.stdout || '').match(/\d+\.\d+\.\d+/u);
132
+ return {
133
+ isAvailable: true,
134
+ version: versionMatch ? versionMatch[0] : null,
135
+ source: rtkBinary.source,
136
+ executablePath: rtkBinary.executablePath,
137
+ reason: null,
138
+ };
139
+ }
140
+
141
+ function buildRtkCommand(commandDefinition, rtkAvailability) {
142
+ return {
143
+ command: rtkAvailability.executablePath || commandDefinition.command,
144
+ args: commandDefinition.args,
145
+ };
146
+ }
147
+
148
+ function computeSavingsSummary(baselineTokens, optimizedTokens) {
149
+ if (baselineTokens <= 0) {
150
+ return {
151
+ tokenDelta: 0,
152
+ savingsPercent: 0,
153
+ };
154
+ }
155
+
156
+ const tokenDelta = baselineTokens - optimizedTokens;
157
+ const savingsPercent = Number(((tokenDelta / baselineTokens) * 100).toFixed(2));
158
+
159
+ return {
160
+ tokenDelta,
161
+ savingsPercent,
162
+ };
163
+ }
164
+
165
+ function calculateAverageSavings(benchmarkRows, savingsKeyName) {
166
+ const availableSavings = benchmarkRows
167
+ .map((benchmarkRow) => benchmarkRow[savingsKeyName]?.savingsPercent)
168
+ .filter((savingsPercent) => typeof savingsPercent === 'number');
169
+
170
+ if (availableSavings.length === 0) {
171
+ return null;
172
+ }
173
+
174
+ const totalSavings = availableSavings.reduce((runningTotal, savingsPercent) => runningTotal + savingsPercent, 0);
175
+ return Number((totalSavings / availableSavings.length).toFixed(2));
176
+ }
177
+
178
+ async function runTokenOptimizationBenchmark() {
179
+ const rtkAvailability = detectRtkAvailability();
180
+ const scenarioResults = [];
181
+
182
+ for (const benchmarkScenario of BENCHMARK_SCENARIOS) {
183
+ const baselineRun = executeCommand(benchmarkScenario.baselineCommand);
184
+ const nativeOptimizedRun = executeCommand(benchmarkScenario.nativeOptimizedCommand);
185
+ const nativeSavings = computeSavingsSummary(
186
+ baselineRun.estimatedTokens,
187
+ nativeOptimizedRun.estimatedTokens
188
+ );
189
+
190
+ let rtkRun = null;
191
+ let rtkSavings = null;
192
+
193
+ if (rtkAvailability.isAvailable) {
194
+ rtkRun = executeCommand(buildRtkCommand(benchmarkScenario.rtkCommand, rtkAvailability));
195
+ if (rtkRun.exitCode === 0) {
196
+ rtkSavings = computeSavingsSummary(baselineRun.estimatedTokens, rtkRun.estimatedTokens);
197
+ }
198
+ }
199
+
200
+ scenarioResults.push({
201
+ scenarioId: benchmarkScenario.scenarioId,
202
+ scenarioName: benchmarkScenario.scenarioName,
203
+ baseline: baselineRun,
204
+ nativeOptimized: nativeOptimizedRun,
205
+ nativeSavings,
206
+ rtk: rtkRun,
207
+ rtkSavings,
208
+ });
209
+ }
210
+
211
+ const benchmarkReport = {
212
+ generatedAt: new Date().toISOString(),
213
+ reportName: 'token-optimization-benchmark',
214
+ methodology: {
215
+ tokenEstimate: `estimated_tokens = ceil(output_chars / ${TOKEN_ESTIMATE_DIVISOR})`,
216
+ scope: 'command-output estimate only; model-specific tokenization differs by provider',
217
+ repositoryRoot: REPOSITORY_ROOT,
218
+ },
219
+ environment: {
220
+ nodeVersion: process.version,
221
+ platform: process.platform,
222
+ rtk: rtkAvailability,
223
+ },
224
+ scenarios: scenarioResults,
225
+ summary: {
226
+ scenarioCount: scenarioResults.length,
227
+ averageNativeSavingsPercent: calculateAverageSavings(scenarioResults, 'nativeSavings'),
228
+ averageRtkSavingsPercent: calculateAverageSavings(scenarioResults, 'rtkSavings'),
229
+ },
230
+ artifact: {
231
+ path: REPORT_PATH,
232
+ writeMode: isStdoutOnlyMode ? 'stdout-only' : 'stdout-and-file',
233
+ },
234
+ };
235
+
236
+ if (!isStdoutOnlyMode) {
237
+ await fs.mkdir(dirname(REPORT_PATH), { recursive: true });
238
+ await fs.writeFile(REPORT_PATH, JSON.stringify(benchmarkReport, null, 2) + '\n', 'utf8');
239
+ }
240
+
241
+ return benchmarkReport;
242
+ }
243
+
244
+ runTokenOptimizationBenchmark()
245
+ .then((benchmarkReport) => {
246
+ console.log(JSON.stringify(benchmarkReport, null, 2));
247
+ })
248
+ .catch((benchmarkError) => {
249
+ const errorMessage = benchmarkError instanceof Error ? benchmarkError.message : String(benchmarkError);
250
+ console.error(`Token benchmark failed: ${errorMessage}`);
251
+ process.exit(1);
252
+ });