@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.
- package/.agent-context/blueprints/mobile-app.md +91 -21
- package/.agent-context/profiles/platform.md +13 -13
- package/.agent-context/profiles/regulated.md +13 -13
- package/.agent-context/profiles/startup.md +13 -13
- package/.agent-context/review-checklists/frontend-skill-parity.md +28 -28
- package/.agent-context/review-checklists/frontend-usability.md +33 -33
- package/.agent-context/review-checklists/release-operations.md +29 -29
- package/.agent-context/skills/README.md +62 -62
- package/.agent-context/skills/backend/README.md +67 -67
- package/.agent-context/skills/backend/architecture.md +360 -360
- package/.agent-context/skills/backend/compatibility-manifest.json +8 -8
- package/.agent-context/skills/backend/data-access.md +230 -230
- package/.agent-context/skills/backend/errors.md +137 -137
- package/.agent-context/skills/backend/validation.md +116 -116
- package/.agent-context/skills/backend.md +28 -28
- package/.agent-context/skills/cli/README.md +55 -49
- package/.agent-context/skills/cli/compatibility-manifest.json +8 -8
- package/.agent-context/skills/cli/init.md +37 -37
- package/.agent-context/skills/cli/output.md +35 -35
- package/.agent-context/skills/cli/safety-telemetry.md +39 -0
- package/.agent-context/skills/cli/upgrade.md +37 -37
- package/.agent-context/skills/cli.md +31 -28
- package/.agent-context/skills/distribution/.evidence/compatibility-manifest.json +9 -0
- package/.agent-context/skills/distribution/.evidence/sbom-excerpt.json +6 -0
- package/.agent-context/skills/distribution/.evidence/test-report.json +8 -0
- package/.agent-context/skills/distribution/CHANGELOG.md +7 -0
- package/.agent-context/skills/distribution/README.md +27 -19
- package/.agent-context/skills/distribution/compatibility-manifest.json +8 -8
- package/.agent-context/skills/distribution/compatibility.md +31 -31
- package/.agent-context/skills/distribution/package.json +5 -0
- package/.agent-context/skills/distribution/provenance-attestation.md +47 -0
- package/.agent-context/skills/distribution/publish.md +36 -36
- package/.agent-context/skills/distribution/rollback.md +31 -31
- package/.agent-context/skills/distribution/tests/.gitkeep +1 -0
- package/.agent-context/skills/distribution.md +31 -28
- package/.agent-context/skills/frontend/.evidence/compatibility-manifest.json +9 -0
- package/.agent-context/skills/frontend/.evidence/sbom-excerpt.json +6 -0
- package/.agent-context/skills/frontend/.evidence/test-report.json +8 -0
- package/.agent-context/skills/frontend/CHANGELOG.md +7 -0
- package/.agent-context/skills/frontend/README.md +49 -36
- package/.agent-context/skills/frontend/accessibility.md +107 -107
- package/.agent-context/skills/frontend/compatibility-manifest.json +8 -8
- package/.agent-context/skills/frontend/conversion-clarity.md +51 -0
- package/.agent-context/skills/frontend/motion.md +66 -66
- package/.agent-context/skills/frontend/package.json +5 -0
- package/.agent-context/skills/frontend/performance.md +62 -62
- package/.agent-context/skills/frontend/responsive-delivery.md +41 -0
- package/.agent-context/skills/frontend/tests/.gitkeep +1 -0
- package/.agent-context/skills/frontend/ui-architecture.md +128 -128
- package/.agent-context/skills/frontend.md +35 -29
- package/.agent-context/skills/fullstack/.evidence/compatibility-manifest.json +9 -0
- package/.agent-context/skills/fullstack/.evidence/sbom-excerpt.json +6 -0
- package/.agent-context/skills/fullstack/.evidence/test-report.json +8 -0
- package/.agent-context/skills/fullstack/CHANGELOG.md +7 -0
- package/.agent-context/skills/fullstack/README.md +27 -19
- package/.agent-context/skills/fullstack/compatibility-manifest.json +8 -8
- package/.agent-context/skills/fullstack/contracts.md +52 -52
- package/.agent-context/skills/fullstack/end-to-end.md +41 -41
- package/.agent-context/skills/fullstack/feature-slicing.md +64 -64
- package/.agent-context/skills/fullstack/package.json +5 -0
- package/.agent-context/skills/fullstack/release-coordination.md +51 -0
- package/.agent-context/skills/fullstack/tests/.gitkeep +1 -0
- package/.agent-context/skills/fullstack.md +29 -26
- package/.agent-context/skills/index.json +107 -107
- package/.agent-context/skills/review-quality/.evidence/compatibility-manifest.json +9 -0
- package/.agent-context/skills/review-quality/.evidence/sbom-excerpt.json +6 -0
- package/.agent-context/skills/review-quality/.evidence/test-report.json +8 -0
- package/.agent-context/skills/review-quality/CHANGELOG.md +7 -0
- package/.agent-context/skills/review-quality/README.md +27 -19
- package/.agent-context/skills/review-quality/benchmark.md +29 -29
- package/.agent-context/skills/review-quality/compatibility-manifest.json +8 -8
- package/.agent-context/skills/review-quality/package.json +5 -0
- package/.agent-context/skills/review-quality/planning.md +37 -37
- package/.agent-context/skills/review-quality/release-decision.md +49 -0
- package/.agent-context/skills/review-quality/security.md +33 -33
- package/.agent-context/skills/review-quality/tests/.gitkeep +1 -0
- package/.agent-context/skills/review-quality.md +30 -27
- package/.agent-context/stacks/flutter.md +16 -16
- package/.agent-context/stacks/react-native.md +16 -16
- package/.agent-context/state/architecture-map.md +25 -25
- package/.agent-context/state/benchmark-analysis.json +431 -431
- package/.agent-context/state/benchmark-thresholds.json +10 -10
- package/.agent-context/state/benchmark-watchlist.json +19 -19
- package/.agent-context/state/dependency-map.md +32 -32
- package/.agent-context/state/quality-trend-report.json +16 -6
- package/.agent-context/state/skill-platform.json +38 -38
- package/.agent-context/state/weekly-governance-report.json +126 -0
- package/.agent-override.md +36 -36
- package/.cursorrules +1 -1
- package/.gemini/instructions.md +20 -20
- package/.github/ISSUE_TEMPLATE/v1.7-frontend-work-item.yml +54 -54
- package/.github/copilot-instructions.md +20 -20
- package/.github/workflows/benchmark-detection.yml +38 -38
- package/.github/workflows/benchmark-intelligence.yml +50 -50
- package/.github/workflows/frontend-usability-gate.yml +36 -36
- package/.github/workflows/governance-weekly-report.yml +43 -0
- package/.github/workflows/release-gate.yml +32 -32
- package/.github/workflows/sbom-compliance.yml +32 -32
- package/.windsurfrules +1 -1
- package/AGENTS.md +27 -27
- package/README.md +383 -368
- package/lib/cli/commands/optimize.mjs +171 -171
- package/lib/cli/compatibility.mjs +124 -124
- package/lib/cli/constants.mjs +35 -0
- package/lib/cli/token-optimization.mjs +275 -275
- package/lib/cli/utils.mjs +4 -1
- package/mcp.json +92 -92
- package/package.json +2 -1
- package/scripts/benchmark-gate.mjs +121 -121
- package/scripts/benchmark-intelligence.mjs +140 -140
- package/scripts/detection-benchmark.mjs +138 -138
- package/scripts/frontend-usability-audit.mjs +87 -87
- package/scripts/generate-sbom.mjs +61 -61
- package/scripts/governance-weekly-report.mjs +293 -0
- package/scripts/init-project.ps1 +104 -104
- package/scripts/llm-judge.mjs +664 -664
- package/scripts/quality-trend-report.mjs +288 -288
- package/scripts/release-gate.mjs +261 -259
- package/scripts/skill-tier-policy.mjs +75 -75
- package/scripts/token-optimization-benchmark.mjs +252 -252
- package/scripts/validate.mjs +874 -865
|
@@ -1,171 +1,171 @@
|
|
|
1
|
-
import fs from 'node:fs/promises';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
|
|
4
|
-
import { ensureDirectory, formatDuration } from '../utils.mjs';
|
|
5
|
-
import { compileDynamicContext, loadOnboardingReportIfExists } from '../compiler.mjs';
|
|
6
|
-
import {
|
|
7
|
-
TOKEN_OPTIMIZATION_REPORT_FILE_NAME,
|
|
8
|
-
normalizeAgentName,
|
|
9
|
-
detectRtkBinary,
|
|
10
|
-
buildRtkInstallHint,
|
|
11
|
-
buildRtkHookCommand,
|
|
12
|
-
createTokenOptimizationState,
|
|
13
|
-
readTokenOptimizationState,
|
|
14
|
-
writeTokenOptimizationState,
|
|
15
|
-
} from '../token-optimization.mjs';
|
|
16
|
-
|
|
17
|
-
function normalizeMarkdownFileName(rawFileName, fallbackFileName) {
|
|
18
|
-
if (typeof rawFileName !== 'string' || rawFileName.trim().length === 0) {
|
|
19
|
-
return fallbackFileName;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const normalizedFileName = rawFileName.trim();
|
|
23
|
-
return normalizedFileName.endsWith('.md')
|
|
24
|
-
? normalizedFileName
|
|
25
|
-
: `${normalizedFileName}.md`;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function parseOptimizeArguments(commandArguments) {
|
|
29
|
-
const parsedOptimizeOptions = {
|
|
30
|
-
targetDirectory: '.',
|
|
31
|
-
agent: 'copilot',
|
|
32
|
-
enabled: true,
|
|
33
|
-
show: false,
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
for (let argumentIndex = 0; argumentIndex < commandArguments.length; argumentIndex++) {
|
|
37
|
-
const currentArgument = commandArguments[argumentIndex];
|
|
38
|
-
|
|
39
|
-
if (!currentArgument.startsWith('--')) {
|
|
40
|
-
parsedOptimizeOptions.targetDirectory = currentArgument;
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (currentArgument === '--agent') {
|
|
45
|
-
parsedOptimizeOptions.agent = commandArguments[argumentIndex + 1] || 'copilot';
|
|
46
|
-
argumentIndex += 1;
|
|
47
|
-
continue;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (currentArgument.startsWith('--agent=')) {
|
|
51
|
-
parsedOptimizeOptions.agent = currentArgument.split('=')[1] || 'copilot';
|
|
52
|
-
continue;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (currentArgument === '--enable') {
|
|
56
|
-
parsedOptimizeOptions.enabled = true;
|
|
57
|
-
continue;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if (currentArgument === '--disable') {
|
|
61
|
-
parsedOptimizeOptions.enabled = false;
|
|
62
|
-
continue;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (currentArgument === '--show') {
|
|
66
|
-
parsedOptimizeOptions.show = true;
|
|
67
|
-
continue;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
throw new Error(`Unknown option: ${currentArgument}`);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
parsedOptimizeOptions.agent = normalizeAgentName(parsedOptimizeOptions.agent);
|
|
74
|
-
return parsedOptimizeOptions;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export async function runOptimizeCommand(targetDirectoryArgument, optimizeOptions = {}) {
|
|
78
|
-
const optimizationStartedAt = Date.now();
|
|
79
|
-
const resolvedTargetDirectoryPath = path.resolve(targetDirectoryArgument || '.');
|
|
80
|
-
|
|
81
|
-
await ensureDirectory(resolvedTargetDirectoryPath);
|
|
82
|
-
|
|
83
|
-
const selectedAgentName = normalizeAgentName(optimizeOptions.agent || 'copilot');
|
|
84
|
-
const rtkDetection = detectRtkBinary();
|
|
85
|
-
|
|
86
|
-
if (optimizeOptions.show) {
|
|
87
|
-
const existingOptimizationState = await readTokenOptimizationState(resolvedTargetDirectoryPath);
|
|
88
|
-
console.log(
|
|
89
|
-
JSON.stringify(
|
|
90
|
-
{
|
|
91
|
-
targetDirectory: resolvedTargetDirectoryPath,
|
|
92
|
-
selectedAgent: selectedAgentName,
|
|
93
|
-
externalProxy: rtkDetection,
|
|
94
|
-
tokenOptimizationState: existingOptimizationState,
|
|
95
|
-
},
|
|
96
|
-
null,
|
|
97
|
-
2
|
|
98
|
-
)
|
|
99
|
-
);
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const onboardingReport = await loadOnboardingReportIfExists(resolvedTargetDirectoryPath);
|
|
104
|
-
if (!onboardingReport) {
|
|
105
|
-
throw new Error(
|
|
106
|
-
'Token optimization requires an initialized repository. Run "agentic-senior-core init" first.'
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
const tokenOptimizationState = createTokenOptimizationState({
|
|
111
|
-
isEnabled: optimizeOptions.enabled,
|
|
112
|
-
selectedAgentName,
|
|
113
|
-
rtkDetection,
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
await writeTokenOptimizationState(resolvedTargetDirectoryPath, tokenOptimizationState);
|
|
117
|
-
|
|
118
|
-
const selectedProfileName = typeof onboardingReport.selectedProfile === 'string'
|
|
119
|
-
? onboardingReport.selectedProfile
|
|
120
|
-
: 'balanced';
|
|
121
|
-
const selectedStackFileName = normalizeMarkdownFileName(onboardingReport.selectedStack, 'typescript.md');
|
|
122
|
-
const selectedBlueprintFileName = normalizeMarkdownFileName(onboardingReport.selectedBlueprint, 'api-nextjs.md');
|
|
123
|
-
const includeCiGuardrails = typeof onboardingReport.ciGuardrailsEnabled === 'boolean'
|
|
124
|
-
? onboardingReport.ciGuardrailsEnabled
|
|
125
|
-
: true;
|
|
126
|
-
|
|
127
|
-
await compileDynamicContext({
|
|
128
|
-
targetDirectoryPath: resolvedTargetDirectoryPath,
|
|
129
|
-
selectedProfileName,
|
|
130
|
-
selectedStackFileName,
|
|
131
|
-
selectedBlueprintFileName,
|
|
132
|
-
includeCiGuardrails,
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
const optimizationDurationMs = Date.now() - optimizationStartedAt;
|
|
136
|
-
const tokenOptimizationReport = {
|
|
137
|
-
generatedAt: new Date().toISOString(),
|
|
138
|
-
targetDirectory: resolvedTargetDirectoryPath,
|
|
139
|
-
enabled: tokenOptimizationState.enabled,
|
|
140
|
-
selectedAgent: tokenOptimizationState.selectedAgent,
|
|
141
|
-
preferredShellProxy: tokenOptimizationState.preferredShellProxy,
|
|
142
|
-
externalProxy: tokenOptimizationState.externalProxy,
|
|
143
|
-
setupDurationMs: optimizationDurationMs,
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
const reportFilePath = path.join(
|
|
147
|
-
resolvedTargetDirectoryPath,
|
|
148
|
-
'.agent-context',
|
|
149
|
-
'state',
|
|
150
|
-
TOKEN_OPTIMIZATION_REPORT_FILE_NAME
|
|
151
|
-
);
|
|
152
|
-
await fs.writeFile(reportFilePath, JSON.stringify(tokenOptimizationReport, null, 2) + '\n', 'utf8');
|
|
153
|
-
|
|
154
|
-
console.log(`\nToken optimization ${tokenOptimizationState.enabled ? 'enabled' : 'disabled'}.`);
|
|
155
|
-
console.log(`- Target directory: ${resolvedTargetDirectoryPath}`);
|
|
156
|
-
console.log(`- Agent profile: ${tokenOptimizationState.selectedAgent}`);
|
|
157
|
-
console.log(`- Preferred shell proxy: ${tokenOptimizationState.preferredShellProxy}`);
|
|
158
|
-
console.log(`- Setup time: ${formatDuration(optimizationDurationMs)}`);
|
|
159
|
-
console.log('- Updated files: .cursorrules, .windsurfrules, .agent-context/state/token-optimization.json');
|
|
160
|
-
|
|
161
|
-
if (tokenOptimizationState.enabled) {
|
|
162
|
-
if (rtkDetection.isAvailable) {
|
|
163
|
-
console.log(`- External proxy detected: ${rtkDetection.version ? `v${rtkDetection.version}` : 'yes'}`);
|
|
164
|
-
console.log('- Recommended hook command:');
|
|
165
|
-
console.log(` ${buildRtkHookCommand(tokenOptimizationState.selectedAgent)}`);
|
|
166
|
-
} else {
|
|
167
|
-
console.log('- External proxy not detected. Native fallback mode has been activated.');
|
|
168
|
-
console.log(`- Install hint: ${buildRtkInstallHint()}`);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
|
|
4
|
+
import { ensureDirectory, formatDuration } from '../utils.mjs';
|
|
5
|
+
import { compileDynamicContext, loadOnboardingReportIfExists } from '../compiler.mjs';
|
|
6
|
+
import {
|
|
7
|
+
TOKEN_OPTIMIZATION_REPORT_FILE_NAME,
|
|
8
|
+
normalizeAgentName,
|
|
9
|
+
detectRtkBinary,
|
|
10
|
+
buildRtkInstallHint,
|
|
11
|
+
buildRtkHookCommand,
|
|
12
|
+
createTokenOptimizationState,
|
|
13
|
+
readTokenOptimizationState,
|
|
14
|
+
writeTokenOptimizationState,
|
|
15
|
+
} from '../token-optimization.mjs';
|
|
16
|
+
|
|
17
|
+
function normalizeMarkdownFileName(rawFileName, fallbackFileName) {
|
|
18
|
+
if (typeof rawFileName !== 'string' || rawFileName.trim().length === 0) {
|
|
19
|
+
return fallbackFileName;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const normalizedFileName = rawFileName.trim();
|
|
23
|
+
return normalizedFileName.endsWith('.md')
|
|
24
|
+
? normalizedFileName
|
|
25
|
+
: `${normalizedFileName}.md`;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function parseOptimizeArguments(commandArguments) {
|
|
29
|
+
const parsedOptimizeOptions = {
|
|
30
|
+
targetDirectory: '.',
|
|
31
|
+
agent: 'copilot',
|
|
32
|
+
enabled: true,
|
|
33
|
+
show: false,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
for (let argumentIndex = 0; argumentIndex < commandArguments.length; argumentIndex++) {
|
|
37
|
+
const currentArgument = commandArguments[argumentIndex];
|
|
38
|
+
|
|
39
|
+
if (!currentArgument.startsWith('--')) {
|
|
40
|
+
parsedOptimizeOptions.targetDirectory = currentArgument;
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (currentArgument === '--agent') {
|
|
45
|
+
parsedOptimizeOptions.agent = commandArguments[argumentIndex + 1] || 'copilot';
|
|
46
|
+
argumentIndex += 1;
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (currentArgument.startsWith('--agent=')) {
|
|
51
|
+
parsedOptimizeOptions.agent = currentArgument.split('=')[1] || 'copilot';
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (currentArgument === '--enable') {
|
|
56
|
+
parsedOptimizeOptions.enabled = true;
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (currentArgument === '--disable') {
|
|
61
|
+
parsedOptimizeOptions.enabled = false;
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (currentArgument === '--show') {
|
|
66
|
+
parsedOptimizeOptions.show = true;
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
throw new Error(`Unknown option: ${currentArgument}`);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
parsedOptimizeOptions.agent = normalizeAgentName(parsedOptimizeOptions.agent);
|
|
74
|
+
return parsedOptimizeOptions;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export async function runOptimizeCommand(targetDirectoryArgument, optimizeOptions = {}) {
|
|
78
|
+
const optimizationStartedAt = Date.now();
|
|
79
|
+
const resolvedTargetDirectoryPath = path.resolve(targetDirectoryArgument || '.');
|
|
80
|
+
|
|
81
|
+
await ensureDirectory(resolvedTargetDirectoryPath);
|
|
82
|
+
|
|
83
|
+
const selectedAgentName = normalizeAgentName(optimizeOptions.agent || 'copilot');
|
|
84
|
+
const rtkDetection = detectRtkBinary();
|
|
85
|
+
|
|
86
|
+
if (optimizeOptions.show) {
|
|
87
|
+
const existingOptimizationState = await readTokenOptimizationState(resolvedTargetDirectoryPath);
|
|
88
|
+
console.log(
|
|
89
|
+
JSON.stringify(
|
|
90
|
+
{
|
|
91
|
+
targetDirectory: resolvedTargetDirectoryPath,
|
|
92
|
+
selectedAgent: selectedAgentName,
|
|
93
|
+
externalProxy: rtkDetection,
|
|
94
|
+
tokenOptimizationState: existingOptimizationState,
|
|
95
|
+
},
|
|
96
|
+
null,
|
|
97
|
+
2
|
|
98
|
+
)
|
|
99
|
+
);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const onboardingReport = await loadOnboardingReportIfExists(resolvedTargetDirectoryPath);
|
|
104
|
+
if (!onboardingReport) {
|
|
105
|
+
throw new Error(
|
|
106
|
+
'Token optimization requires an initialized repository. Run "agentic-senior-core init" first.'
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const tokenOptimizationState = createTokenOptimizationState({
|
|
111
|
+
isEnabled: optimizeOptions.enabled,
|
|
112
|
+
selectedAgentName,
|
|
113
|
+
rtkDetection,
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
await writeTokenOptimizationState(resolvedTargetDirectoryPath, tokenOptimizationState);
|
|
117
|
+
|
|
118
|
+
const selectedProfileName = typeof onboardingReport.selectedProfile === 'string'
|
|
119
|
+
? onboardingReport.selectedProfile
|
|
120
|
+
: 'balanced';
|
|
121
|
+
const selectedStackFileName = normalizeMarkdownFileName(onboardingReport.selectedStack, 'typescript.md');
|
|
122
|
+
const selectedBlueprintFileName = normalizeMarkdownFileName(onboardingReport.selectedBlueprint, 'api-nextjs.md');
|
|
123
|
+
const includeCiGuardrails = typeof onboardingReport.ciGuardrailsEnabled === 'boolean'
|
|
124
|
+
? onboardingReport.ciGuardrailsEnabled
|
|
125
|
+
: true;
|
|
126
|
+
|
|
127
|
+
await compileDynamicContext({
|
|
128
|
+
targetDirectoryPath: resolvedTargetDirectoryPath,
|
|
129
|
+
selectedProfileName,
|
|
130
|
+
selectedStackFileName,
|
|
131
|
+
selectedBlueprintFileName,
|
|
132
|
+
includeCiGuardrails,
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
const optimizationDurationMs = Date.now() - optimizationStartedAt;
|
|
136
|
+
const tokenOptimizationReport = {
|
|
137
|
+
generatedAt: new Date().toISOString(),
|
|
138
|
+
targetDirectory: resolvedTargetDirectoryPath,
|
|
139
|
+
enabled: tokenOptimizationState.enabled,
|
|
140
|
+
selectedAgent: tokenOptimizationState.selectedAgent,
|
|
141
|
+
preferredShellProxy: tokenOptimizationState.preferredShellProxy,
|
|
142
|
+
externalProxy: tokenOptimizationState.externalProxy,
|
|
143
|
+
setupDurationMs: optimizationDurationMs,
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
const reportFilePath = path.join(
|
|
147
|
+
resolvedTargetDirectoryPath,
|
|
148
|
+
'.agent-context',
|
|
149
|
+
'state',
|
|
150
|
+
TOKEN_OPTIMIZATION_REPORT_FILE_NAME
|
|
151
|
+
);
|
|
152
|
+
await fs.writeFile(reportFilePath, JSON.stringify(tokenOptimizationReport, null, 2) + '\n', 'utf8');
|
|
153
|
+
|
|
154
|
+
console.log(`\nToken optimization ${tokenOptimizationState.enabled ? 'enabled' : 'disabled'}.`);
|
|
155
|
+
console.log(`- Target directory: ${resolvedTargetDirectoryPath}`);
|
|
156
|
+
console.log(`- Agent profile: ${tokenOptimizationState.selectedAgent}`);
|
|
157
|
+
console.log(`- Preferred shell proxy: ${tokenOptimizationState.preferredShellProxy}`);
|
|
158
|
+
console.log(`- Setup time: ${formatDuration(optimizationDurationMs)}`);
|
|
159
|
+
console.log('- Updated files: .cursorrules, .windsurfrules, .agent-context/state/token-optimization.json');
|
|
160
|
+
|
|
161
|
+
if (tokenOptimizationState.enabled) {
|
|
162
|
+
if (rtkDetection.isAvailable) {
|
|
163
|
+
console.log(`- External proxy detected: ${rtkDetection.version ? `v${rtkDetection.version}` : 'yes'}`);
|
|
164
|
+
console.log('- Recommended hook command:');
|
|
165
|
+
console.log(` ${buildRtkHookCommand(tokenOptimizationState.selectedAgent)}`);
|
|
166
|
+
} else {
|
|
167
|
+
console.log('- External proxy not detected. Native fallback mode has been activated.');
|
|
168
|
+
console.log(`- Install hint: ${buildRtkInstallHint()}`);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
@@ -1,124 +1,124 @@
|
|
|
1
|
-
import fs from 'node:fs/promises';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { platform, version } from 'node:process';
|
|
4
|
-
|
|
5
|
-
import { pathExists } from './utils.mjs';
|
|
6
|
-
|
|
7
|
-
export const SKILL_COMPATIBILITY_MANIFEST_FILE_NAME = 'compatibility-manifest.json';
|
|
8
|
-
|
|
9
|
-
export function getCurrentPlatformLabel() {
|
|
10
|
-
if (platform === 'win32') {
|
|
11
|
-
return 'windows';
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
if (platform === 'darwin') {
|
|
15
|
-
return 'macos';
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return 'linux';
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export function parseNodeMajorVersion(rawVersionString = version) {
|
|
22
|
-
const normalizedVersionString = String(rawVersionString || '').trim();
|
|
23
|
-
const numericVersion = normalizedVersionString.startsWith('v')
|
|
24
|
-
? normalizedVersionString.slice(1)
|
|
25
|
-
: normalizedVersionString;
|
|
26
|
-
|
|
27
|
-
const majorSegment = numericVersion.split('.')[0];
|
|
28
|
-
const parsedMajorVersion = Number.parseInt(majorSegment, 10);
|
|
29
|
-
return Number.isNaN(parsedMajorVersion) ? null : parsedMajorVersion;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function parseNodeMinimumMajor(rawNodeMinimum) {
|
|
33
|
-
const normalizedNodeMinimum = String(rawNodeMinimum || '').trim();
|
|
34
|
-
if (!normalizedNodeMinimum) {
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const majorSegment = normalizedNodeMinimum.split('.')[0];
|
|
39
|
-
const parsedMajorVersion = Number.parseInt(majorSegment, 10);
|
|
40
|
-
return Number.isNaN(parsedMajorVersion) ? null : parsedMajorVersion;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export async function readSkillDomainCompatibilityManifest(targetDirectoryPath, skillDomainName) {
|
|
44
|
-
const compatibilityManifestPath = path.join(
|
|
45
|
-
targetDirectoryPath,
|
|
46
|
-
'.agent-context',
|
|
47
|
-
'skills',
|
|
48
|
-
skillDomainName,
|
|
49
|
-
SKILL_COMPATIBILITY_MANIFEST_FILE_NAME
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
if (!(await pathExists(compatibilityManifestPath))) {
|
|
53
|
-
return {
|
|
54
|
-
exists: false,
|
|
55
|
-
compatibilityManifestPath,
|
|
56
|
-
parsedManifest: null,
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
try {
|
|
61
|
-
const compatibilityManifestContent = await fs.readFile(compatibilityManifestPath, 'utf8');
|
|
62
|
-
return {
|
|
63
|
-
exists: true,
|
|
64
|
-
compatibilityManifestPath,
|
|
65
|
-
parsedManifest: JSON.parse(compatibilityManifestContent),
|
|
66
|
-
};
|
|
67
|
-
} catch (error) {
|
|
68
|
-
return {
|
|
69
|
-
exists: true,
|
|
70
|
-
compatibilityManifestPath,
|
|
71
|
-
parsedManifest: null,
|
|
72
|
-
parseError: error instanceof Error ? error.message : String(error),
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export async function evaluateSkillDomainCompatibility(targetDirectoryPath, skillDomainNames) {
|
|
78
|
-
const uniqueSkillDomainNames = Array.from(new Set(skillDomainNames || []));
|
|
79
|
-
const compatibilityWarnings = [];
|
|
80
|
-
|
|
81
|
-
const currentPlatformLabel = getCurrentPlatformLabel();
|
|
82
|
-
const currentNodeMajorVersion = parseNodeMajorVersion(version);
|
|
83
|
-
|
|
84
|
-
for (const skillDomainName of uniqueSkillDomainNames) {
|
|
85
|
-
const manifestResult = await readSkillDomainCompatibilityManifest(targetDirectoryPath, skillDomainName);
|
|
86
|
-
|
|
87
|
-
if (!manifestResult.exists) {
|
|
88
|
-
compatibilityWarnings.push(
|
|
89
|
-
`Domain ${skillDomainName} has no ${SKILL_COMPATIBILITY_MANIFEST_FILE_NAME}; compatibility cannot be verified.`
|
|
90
|
-
);
|
|
91
|
-
continue;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (!manifestResult.parsedManifest) {
|
|
95
|
-
compatibilityWarnings.push(
|
|
96
|
-
`Domain ${skillDomainName} has invalid ${SKILL_COMPATIBILITY_MANIFEST_FILE_NAME}: ${manifestResult.parseError || 'Unknown parse error'}.`
|
|
97
|
-
);
|
|
98
|
-
continue;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const manifestPlatforms = Array.isArray(manifestResult.parsedManifest.platforms)
|
|
102
|
-
? manifestResult.parsedManifest.platforms
|
|
103
|
-
: [];
|
|
104
|
-
|
|
105
|
-
if (manifestPlatforms.length > 0 && !manifestPlatforms.includes(currentPlatformLabel)) {
|
|
106
|
-
compatibilityWarnings.push(
|
|
107
|
-
`Domain ${skillDomainName} does not list platform ${currentPlatformLabel} in ${SKILL_COMPATIBILITY_MANIFEST_FILE_NAME}.`
|
|
108
|
-
);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
const minimumNodeMajorVersion = parseNodeMinimumMajor(manifestResult.parsedManifest.nodeMin);
|
|
112
|
-
if (
|
|
113
|
-
typeof minimumNodeMajorVersion === 'number'
|
|
114
|
-
&& typeof currentNodeMajorVersion === 'number'
|
|
115
|
-
&& currentNodeMajorVersion < minimumNodeMajorVersion
|
|
116
|
-
) {
|
|
117
|
-
compatibilityWarnings.push(
|
|
118
|
-
`Domain ${skillDomainName} requires Node.js >= ${minimumNodeMajorVersion}, current major version is ${currentNodeMajorVersion}.`
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return compatibilityWarnings;
|
|
124
|
-
}
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { platform, version } from 'node:process';
|
|
4
|
+
|
|
5
|
+
import { pathExists } from './utils.mjs';
|
|
6
|
+
|
|
7
|
+
export const SKILL_COMPATIBILITY_MANIFEST_FILE_NAME = 'compatibility-manifest.json';
|
|
8
|
+
|
|
9
|
+
export function getCurrentPlatformLabel() {
|
|
10
|
+
if (platform === 'win32') {
|
|
11
|
+
return 'windows';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (platform === 'darwin') {
|
|
15
|
+
return 'macos';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return 'linux';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function parseNodeMajorVersion(rawVersionString = version) {
|
|
22
|
+
const normalizedVersionString = String(rawVersionString || '').trim();
|
|
23
|
+
const numericVersion = normalizedVersionString.startsWith('v')
|
|
24
|
+
? normalizedVersionString.slice(1)
|
|
25
|
+
: normalizedVersionString;
|
|
26
|
+
|
|
27
|
+
const majorSegment = numericVersion.split('.')[0];
|
|
28
|
+
const parsedMajorVersion = Number.parseInt(majorSegment, 10);
|
|
29
|
+
return Number.isNaN(parsedMajorVersion) ? null : parsedMajorVersion;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function parseNodeMinimumMajor(rawNodeMinimum) {
|
|
33
|
+
const normalizedNodeMinimum = String(rawNodeMinimum || '').trim();
|
|
34
|
+
if (!normalizedNodeMinimum) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const majorSegment = normalizedNodeMinimum.split('.')[0];
|
|
39
|
+
const parsedMajorVersion = Number.parseInt(majorSegment, 10);
|
|
40
|
+
return Number.isNaN(parsedMajorVersion) ? null : parsedMajorVersion;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export async function readSkillDomainCompatibilityManifest(targetDirectoryPath, skillDomainName) {
|
|
44
|
+
const compatibilityManifestPath = path.join(
|
|
45
|
+
targetDirectoryPath,
|
|
46
|
+
'.agent-context',
|
|
47
|
+
'skills',
|
|
48
|
+
skillDomainName,
|
|
49
|
+
SKILL_COMPATIBILITY_MANIFEST_FILE_NAME
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
if (!(await pathExists(compatibilityManifestPath))) {
|
|
53
|
+
return {
|
|
54
|
+
exists: false,
|
|
55
|
+
compatibilityManifestPath,
|
|
56
|
+
parsedManifest: null,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
const compatibilityManifestContent = await fs.readFile(compatibilityManifestPath, 'utf8');
|
|
62
|
+
return {
|
|
63
|
+
exists: true,
|
|
64
|
+
compatibilityManifestPath,
|
|
65
|
+
parsedManifest: JSON.parse(compatibilityManifestContent),
|
|
66
|
+
};
|
|
67
|
+
} catch (error) {
|
|
68
|
+
return {
|
|
69
|
+
exists: true,
|
|
70
|
+
compatibilityManifestPath,
|
|
71
|
+
parsedManifest: null,
|
|
72
|
+
parseError: error instanceof Error ? error.message : String(error),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export async function evaluateSkillDomainCompatibility(targetDirectoryPath, skillDomainNames) {
|
|
78
|
+
const uniqueSkillDomainNames = Array.from(new Set(skillDomainNames || []));
|
|
79
|
+
const compatibilityWarnings = [];
|
|
80
|
+
|
|
81
|
+
const currentPlatformLabel = getCurrentPlatformLabel();
|
|
82
|
+
const currentNodeMajorVersion = parseNodeMajorVersion(version);
|
|
83
|
+
|
|
84
|
+
for (const skillDomainName of uniqueSkillDomainNames) {
|
|
85
|
+
const manifestResult = await readSkillDomainCompatibilityManifest(targetDirectoryPath, skillDomainName);
|
|
86
|
+
|
|
87
|
+
if (!manifestResult.exists) {
|
|
88
|
+
compatibilityWarnings.push(
|
|
89
|
+
`Domain ${skillDomainName} has no ${SKILL_COMPATIBILITY_MANIFEST_FILE_NAME}; compatibility cannot be verified.`
|
|
90
|
+
);
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (!manifestResult.parsedManifest) {
|
|
95
|
+
compatibilityWarnings.push(
|
|
96
|
+
`Domain ${skillDomainName} has invalid ${SKILL_COMPATIBILITY_MANIFEST_FILE_NAME}: ${manifestResult.parseError || 'Unknown parse error'}.`
|
|
97
|
+
);
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const manifestPlatforms = Array.isArray(manifestResult.parsedManifest.platforms)
|
|
102
|
+
? manifestResult.parsedManifest.platforms
|
|
103
|
+
: [];
|
|
104
|
+
|
|
105
|
+
if (manifestPlatforms.length > 0 && !manifestPlatforms.includes(currentPlatformLabel)) {
|
|
106
|
+
compatibilityWarnings.push(
|
|
107
|
+
`Domain ${skillDomainName} does not list platform ${currentPlatformLabel} in ${SKILL_COMPATIBILITY_MANIFEST_FILE_NAME}.`
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const minimumNodeMajorVersion = parseNodeMinimumMajor(manifestResult.parsedManifest.nodeMin);
|
|
112
|
+
if (
|
|
113
|
+
typeof minimumNodeMajorVersion === 'number'
|
|
114
|
+
&& typeof currentNodeMajorVersion === 'number'
|
|
115
|
+
&& currentNodeMajorVersion < minimumNodeMajorVersion
|
|
116
|
+
) {
|
|
117
|
+
compatibilityWarnings.push(
|
|
118
|
+
`Domain ${skillDomainName} requires Node.js >= ${minimumNodeMajorVersion}, current major version is ${currentNodeMajorVersion}.`
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return compatibilityWarnings;
|
|
124
|
+
}
|
package/lib/cli/constants.mjs
CHANGED
|
@@ -93,6 +93,41 @@ export const INIT_PRESETS = {
|
|
|
93
93
|
ci: true,
|
|
94
94
|
description: 'Observability and platform starter',
|
|
95
95
|
},
|
|
96
|
+
'typescript-nestjs-service': {
|
|
97
|
+
profile: 'balanced',
|
|
98
|
+
stack: 'typescript.md',
|
|
99
|
+
blueprint: 'nestjs-logic.md',
|
|
100
|
+
ci: true,
|
|
101
|
+
description: 'TypeScript service starter with NestJS module blueprint',
|
|
102
|
+
},
|
|
103
|
+
'java-enterprise-api': {
|
|
104
|
+
profile: 'strict',
|
|
105
|
+
stack: 'java.md',
|
|
106
|
+
blueprint: 'spring-boot-api.md',
|
|
107
|
+
ci: true,
|
|
108
|
+
description: 'Enterprise API starter for JVM teams',
|
|
109
|
+
},
|
|
110
|
+
'dotnet-enterprise-api': {
|
|
111
|
+
profile: 'strict',
|
|
112
|
+
stack: 'csharp.md',
|
|
113
|
+
blueprint: 'aspnet-api.md',
|
|
114
|
+
ci: true,
|
|
115
|
+
description: '.NET API starter with strict governance defaults',
|
|
116
|
+
},
|
|
117
|
+
'php-laravel-api': {
|
|
118
|
+
profile: 'balanced',
|
|
119
|
+
stack: 'php.md',
|
|
120
|
+
blueprint: 'laravel-api.md',
|
|
121
|
+
ci: true,
|
|
122
|
+
description: 'Laravel API starter with balanced guardrails',
|
|
123
|
+
},
|
|
124
|
+
'kubernetes-platform': {
|
|
125
|
+
profile: 'strict',
|
|
126
|
+
stack: 'go.md',
|
|
127
|
+
blueprint: 'kubernetes-manifests.md',
|
|
128
|
+
ci: true,
|
|
129
|
+
description: 'Platform starter focused on Kubernetes delivery assets',
|
|
130
|
+
},
|
|
96
131
|
};
|
|
97
132
|
|
|
98
133
|
export const PROFILE_PRESETS = {
|