@ryuenn3123/agentic-senior-core 3.0.47 → 3.0.49
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/prompts/bootstrap-design.md +8 -10
- package/.agent-context/prompts/init-project.md +2 -2
- package/.agent-context/rules/architecture.md +2 -2
- package/.agent-context/rules/frontend-architecture.md +9 -13
- package/.agent-context/state/architecture-map.md +3 -3
- package/.agent-context/state/dependency-map.md +2 -2
- package/AGENTS.md +170 -35
- package/CLAUDE.md +1 -44
- package/CONTRIBUTING.md +2 -3
- package/GEMINI.md +1 -44
- package/README.md +24 -22
- package/lib/cli/commands/init.mjs +10 -28
- package/lib/cli/commands/optimize.mjs +2 -48
- package/lib/cli/commands/upgrade.mjs +9 -51
- package/lib/cli/compiler.mjs +8 -93
- package/lib/cli/constants.mjs +1 -9
- package/lib/cli/detector.mjs +0 -1
- package/lib/cli/init-options.mjs +1 -1
- package/lib/cli/project-scaffolder/design-contract/validation.mjs +4 -0
- package/lib/cli/project-scaffolder/design-contract.mjs +4 -0
- package/lib/cli/project-scaffolder/prompt-builders.mjs +5 -1
- package/lib/cli/utils/filesystem.mjs +2 -0
- package/lib/cli/utils/managed-surface.mjs +45 -2
- package/lib/cli/utils.mjs +19 -4
- package/package.json +1 -10
- package/scripts/bump-version.mjs +1 -16
- package/scripts/docs-quality-drift-report.mjs +0 -6
- package/scripts/frontend-usability-audit.mjs +6 -2
- package/scripts/governance-weekly-report.mjs +2 -2
- package/scripts/single-source-lazy-loading-audit.mjs +13 -126
- package/scripts/sync-thin-adapters.mjs +13 -121
- package/scripts/validate/config.mjs +14 -25
- package/scripts/validate/coverage-checks.mjs +9 -76
- package/scripts/validate.mjs +12 -97
- package/.agent-override.md +0 -36
- package/.agents/workflows/init-project.md +0 -12
- package/.agents/workflows/refactor.md +0 -12
- package/.agents/workflows/review-code.md +0 -11
- package/.cursor/mcp.json +0 -10
- package/.cursor/rules/agentic-senior-core.mdc +0 -49
- package/.cursorrules +0 -26
- package/.gemini/instructions.md +0 -44
- package/.github/copilot-instructions.md +0 -44
- package/.github/instructions/agentic-senior-core.instructions.md +0 -48
- package/.github/workflows/benchmark-detection.yml +0 -45
- package/.github/workflows/benchmark-intelligence.yml +0 -50
- package/.github/workflows/docs-quality-drift-report.yml +0 -37
- package/.github/workflows/frontend-usability-gate.yml +0 -36
- package/.github/workflows/governance-weekly-report.yml +0 -43
- package/.github/workflows/publish.yml +0 -32
- package/.github/workflows/release-gate.yml +0 -32
- package/.github/workflows/sbom-compliance.yml +0 -32
- package/.instructions.md +0 -187
- package/.windsurf/rules/agentic-senior-core.md +0 -44
- package/.windsurfrules +0 -26
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
formatDetectionCandidates,
|
|
35
35
|
detectUiScopeSignals,
|
|
36
36
|
} from '../detector.mjs';
|
|
37
|
-
import {
|
|
37
|
+
import { writeSelectedPolicy, writeOnboardingReport } from '../compiler.mjs';
|
|
38
38
|
import {
|
|
39
39
|
normalizeAdditionalStackSelection,
|
|
40
40
|
normalizeAdditionalBlueprintSelection,
|
|
@@ -153,7 +153,7 @@ export async function runInitCommand(targetDirectoryArgument, initOptions = {})
|
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
console.log(`\nAgentic-Senior-Core CLI v${CLI_VERSION}`);
|
|
156
|
-
console.log('I will copy the project guidance pack into your target folder and
|
|
156
|
+
console.log('I will copy the project guidance pack into your target folder with AGENTS.md and native import bridges for your AI tools.');
|
|
157
157
|
|
|
158
158
|
if (selectedPreset) {
|
|
159
159
|
console.log(`Using preset: ${initOptions.preset} (${selectedPreset.description}).`);
|
|
@@ -198,19 +198,10 @@ export async function runInitCommand(targetDirectoryArgument, initOptions = {})
|
|
|
198
198
|
? buildDetectionSummary(projectDetection)
|
|
199
199
|
: 'No existing project markers were detected.',
|
|
200
200
|
activeRulesSummary: {
|
|
201
|
-
canonicalSource: '.
|
|
202
|
-
compiledRulebook:
|
|
203
|
-
legacyThinAdapters: [
|
|
204
|
-
generatedBridgeAdapters: [
|
|
205
|
-
'AGENTS.md',
|
|
206
|
-
'CLAUDE.md',
|
|
207
|
-
'GEMINI.md',
|
|
208
|
-
'.cursor/rules/agentic-senior-core.mdc',
|
|
209
|
-
'.windsurf/rules/agentic-senior-core.md',
|
|
210
|
-
'.github/copilot-instructions.md',
|
|
211
|
-
'.github/instructions/agentic-senior-core.instructions.md',
|
|
212
|
-
'.gemini/instructions.md',
|
|
213
|
-
],
|
|
201
|
+
canonicalSource: 'AGENTS.md',
|
|
202
|
+
compiledRulebook: null,
|
|
203
|
+
legacyThinAdapters: [],
|
|
204
|
+
generatedBridgeAdapters: ['CLAUDE.md', 'GEMINI.md'],
|
|
214
205
|
stackLoadingMode: 'lazy',
|
|
215
206
|
domainRuleLoadingMode: 'lazy',
|
|
216
207
|
selectedProfile: selectedPolicyProfileName,
|
|
@@ -249,7 +240,7 @@ export async function runInitCommand(targetDirectoryArgument, initOptions = {})
|
|
|
249
240
|
console.log('- Detected stack: unresolved (insufficient markers).');
|
|
250
241
|
}
|
|
251
242
|
|
|
252
|
-
console.log('- Active rules baseline: canonical .
|
|
243
|
+
console.log('- Active rules baseline: canonical AGENTS.md + .agent-context/ lazy rule library');
|
|
253
244
|
console.log(
|
|
254
245
|
`- Active review thresholds: ${formatBlockingSeverities(selectedPolicyProfile.blockingSeverities)}`
|
|
255
246
|
);
|
|
@@ -493,15 +484,6 @@ export async function runInitCommand(targetDirectoryArgument, initOptions = {})
|
|
|
493
484
|
console.log('\nExisting UI/frontend scope detected. Seeded docs/design-intent.json so the machine-readable design contract exists before UI implementation work continues.');
|
|
494
485
|
}
|
|
495
486
|
|
|
496
|
-
await compileDynamicContext({
|
|
497
|
-
targetDirectoryPath: resolvedTargetDirectoryPath,
|
|
498
|
-
selectedStackFileName: selectedResolvedStackFileName,
|
|
499
|
-
selectedAdditionalStackFileNames,
|
|
500
|
-
selectedBlueprintFileName: selectedResolvedBlueprintFileName,
|
|
501
|
-
selectedAdditionalBlueprintFileNames,
|
|
502
|
-
includeCiGuardrails,
|
|
503
|
-
});
|
|
504
|
-
|
|
505
487
|
await writeSelectedPolicy(resolvedTargetDirectoryPath, selectedPolicyProfileName);
|
|
506
488
|
|
|
507
489
|
const setupDurationMs = Date.now() - setupStartedAt;
|
|
@@ -570,7 +552,7 @@ export async function runInitCommand(targetDirectoryArgument, initOptions = {})
|
|
|
570
552
|
console.log(`- CI/CD quality checks (guardrails): ${includeCiGuardrails ? 'enabled' : 'disabled'}`);
|
|
571
553
|
console.log(`- Review thresholds: ${formatBlockingSeverities(selectedPolicyProfile.blockingSeverities)}`);
|
|
572
554
|
console.log(`- Setup time: ${formatDuration(setupDurationMs)}`);
|
|
573
|
-
console.log('- Generated files: .
|
|
555
|
+
console.log('- Generated files: AGENTS.md, CLAUDE.md, GEMINI.md, .agent-context/, and .agent-context/state/onboarding-report.json');
|
|
574
556
|
if (scaffoldingResult?.bootstrapMode === 'ai-synthesis') {
|
|
575
557
|
console.log(`- Bootstrap prompts: ${(scaffoldingResult.generatedPromptFileNames || []).length} files generated in .agent-context/prompts/`);
|
|
576
558
|
if ((scaffoldingResult.materializedFileNames || []).length > 0) {
|
|
@@ -586,7 +568,7 @@ export async function runInitCommand(targetDirectoryArgument, initOptions = {})
|
|
|
586
568
|
console.log(`- Design seed docs: ${supplementalMaterializedDocFileNames.length} files generated in docs/`);
|
|
587
569
|
}
|
|
588
570
|
console.log(`- Repository workflows copied: no (workflows remain source-repo assets)`);
|
|
589
|
-
console.log(`- MCP configuration: ${shouldIncludeMcpTemplate ? 'auto-configured for your IDEs (VS Code, Cursor, Zed, Gemini)' : 'disabled (--
|
|
571
|
+
console.log(`- MCP configuration: ${shouldIncludeMcpTemplate ? 'auto-configured for your IDEs (VS Code, Cursor, Zed, Gemini)' : 'disabled (use --mcp-template to enable)'}`);
|
|
590
572
|
if (isMemoryContinuityEnabled) {
|
|
591
573
|
console.log('- Memory continuity policy: enabled (index + selective hydration; host support required)');
|
|
592
574
|
} else {
|
|
@@ -634,7 +616,7 @@ export async function runInitCommand(targetDirectoryArgument, initOptions = {})
|
|
|
634
616
|
console.log('- If docs/DESIGN.md is missing, execute .agent-context/prompts/bootstrap-design.md now and refine docs/design-intent.json into a complete design contract before building UI components.');
|
|
635
617
|
console.log('- Keep docs/design-intent.json and docs/DESIGN.md synchronized whenever the UI direction changes.');
|
|
636
618
|
}
|
|
637
|
-
console.log('Your AI tools will now receive
|
|
619
|
+
console.log('Your AI tools will now receive AGENTS.md, native import bridges, and the lazy-loaded .agent-context rule library. Your review threshold is stored in .agent-context/policies/llm-judge-threshold.json.');
|
|
638
620
|
console.log('MCP server registration is manual inside your IDE settings, even when mcp.json exists.');
|
|
639
621
|
} catch (error) {
|
|
640
622
|
console.error('\n[FATAL] An error occurred during initialization. Attempting automatic rollback...');
|
|
@@ -2,11 +2,7 @@ import fs from 'node:fs/promises';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
|
|
4
4
|
import { ensureDirectory, formatDuration } from '../utils.mjs';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
AGENT_DECISION_STACK_FILE_NAME,
|
|
8
|
-
AGENT_DECISION_BLUEPRINT_FILE_NAME,
|
|
9
|
-
} from '../constants.mjs';
|
|
5
|
+
import { loadOnboardingReportIfExists } from '../compiler.mjs';
|
|
10
6
|
import {
|
|
11
7
|
TOKEN_OPTIMIZATION_REPORT_FILE_NAME,
|
|
12
8
|
normalizeAgentName,
|
|
@@ -18,17 +14,6 @@ import {
|
|
|
18
14
|
writeTokenOptimizationState,
|
|
19
15
|
} from '../token-optimization.mjs';
|
|
20
16
|
|
|
21
|
-
function normalizeMarkdownFileName(rawFileName, fallbackFileName) {
|
|
22
|
-
if (typeof rawFileName !== 'string' || rawFileName.trim().length === 0) {
|
|
23
|
-
return fallbackFileName;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const normalizedFileName = rawFileName.trim();
|
|
27
|
-
return normalizedFileName.endsWith('.md')
|
|
28
|
-
? normalizedFileName
|
|
29
|
-
: `${normalizedFileName}.md`;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
17
|
export function parseOptimizeArguments(commandArguments) {
|
|
33
18
|
const parsedOptimizeOptions = {
|
|
34
19
|
targetDirectory: '.',
|
|
@@ -119,37 +104,6 @@ export async function runOptimizeCommand(targetDirectoryArgument, optimizeOption
|
|
|
119
104
|
|
|
120
105
|
await writeTokenOptimizationState(resolvedTargetDirectoryPath, tokenOptimizationState);
|
|
121
106
|
|
|
122
|
-
const hasExplicitRuntimeConstraint = onboardingReport?.runtimeDecision?.mode === 'explicit-constraint';
|
|
123
|
-
const hasExplicitArchitectureConstraint = onboardingReport?.architectureDecision?.mode === 'explicit-constraint';
|
|
124
|
-
const selectedStackFileName = hasExplicitRuntimeConstraint
|
|
125
|
-
? normalizeMarkdownFileName(onboardingReport.selectedStack, AGENT_DECISION_STACK_FILE_NAME)
|
|
126
|
-
: AGENT_DECISION_STACK_FILE_NAME;
|
|
127
|
-
const selectedAdditionalStackFileNames = hasExplicitRuntimeConstraint && Array.isArray(onboardingReport.selectedAdditionalStacks)
|
|
128
|
-
? onboardingReport.selectedAdditionalStacks
|
|
129
|
-
.map((stackFileName) => normalizeMarkdownFileName(stackFileName, ''))
|
|
130
|
-
.filter((stackFileName) => stackFileName && stackFileName !== selectedStackFileName)
|
|
131
|
-
: [];
|
|
132
|
-
const selectedBlueprintFileName = hasExplicitArchitectureConstraint
|
|
133
|
-
? normalizeMarkdownFileName(onboardingReport.selectedBlueprint, AGENT_DECISION_BLUEPRINT_FILE_NAME)
|
|
134
|
-
: AGENT_DECISION_BLUEPRINT_FILE_NAME;
|
|
135
|
-
const selectedAdditionalBlueprintFileNames = hasExplicitArchitectureConstraint && Array.isArray(onboardingReport.selectedAdditionalBlueprints)
|
|
136
|
-
? onboardingReport.selectedAdditionalBlueprints
|
|
137
|
-
.map((blueprintFileName) => normalizeMarkdownFileName(blueprintFileName, ''))
|
|
138
|
-
.filter((blueprintFileName) => blueprintFileName && blueprintFileName !== selectedBlueprintFileName)
|
|
139
|
-
: [];
|
|
140
|
-
const includeCiGuardrails = typeof onboardingReport.ciGuardrailsEnabled === 'boolean'
|
|
141
|
-
? onboardingReport.ciGuardrailsEnabled
|
|
142
|
-
: true;
|
|
143
|
-
|
|
144
|
-
await compileDynamicContext({
|
|
145
|
-
targetDirectoryPath: resolvedTargetDirectoryPath,
|
|
146
|
-
selectedStackFileName,
|
|
147
|
-
selectedAdditionalStackFileNames,
|
|
148
|
-
selectedBlueprintFileName,
|
|
149
|
-
selectedAdditionalBlueprintFileNames,
|
|
150
|
-
includeCiGuardrails,
|
|
151
|
-
});
|
|
152
|
-
|
|
153
107
|
const optimizationDurationMs = Date.now() - optimizationStartedAt;
|
|
154
108
|
const tokenOptimizationReport = {
|
|
155
109
|
generatedAt: new Date().toISOString(),
|
|
@@ -174,7 +128,7 @@ export async function runOptimizeCommand(targetDirectoryArgument, optimizeOption
|
|
|
174
128
|
console.log(`- Agent profile: ${tokenOptimizationState.selectedAgent}`);
|
|
175
129
|
console.log(`- Preferred shell proxy: ${tokenOptimizationState.preferredShellProxy}`);
|
|
176
130
|
console.log(`- Setup time: ${formatDuration(optimizationDurationMs)}`);
|
|
177
|
-
console.log('- Updated files: .agent-
|
|
131
|
+
console.log('- Updated files: .agent-context/state/token-optimization.json and .agent-context/state/token-optimization-report.json');
|
|
178
132
|
|
|
179
133
|
if (tokenOptimizationState.enabled) {
|
|
180
134
|
if (rtkDetection.isAvailable) {
|
|
@@ -33,8 +33,6 @@ import {
|
|
|
33
33
|
detectUiScopeSignals,
|
|
34
34
|
} from '../detector.mjs';
|
|
35
35
|
import {
|
|
36
|
-
buildCompiledRulesContent,
|
|
37
|
-
compileDynamicContext,
|
|
38
36
|
writeSelectedPolicy,
|
|
39
37
|
writeOnboardingReport,
|
|
40
38
|
loadOnboardingReportIfExists,
|
|
@@ -55,7 +53,7 @@ export function parseUpgradeArguments(commandArguments) {
|
|
|
55
53
|
targetDirectory: '.',
|
|
56
54
|
dryRun: false,
|
|
57
55
|
skipConfirmation: false,
|
|
58
|
-
includeMcpTemplate:
|
|
56
|
+
includeMcpTemplate: false,
|
|
59
57
|
pruneManagedSurface: true,
|
|
60
58
|
};
|
|
61
59
|
|
|
@@ -243,19 +241,10 @@ export async function runUpgradeCommand(targetDirectoryArgument, upgradeOptions
|
|
|
243
241
|
declarationShown: true,
|
|
244
242
|
detectionSummary: buildDetectionSummary(projectDetection),
|
|
245
243
|
activeRulesSummary: {
|
|
246
|
-
canonicalSource: '.
|
|
247
|
-
compiledRulebook:
|
|
248
|
-
legacyThinAdapters: [
|
|
249
|
-
generatedBridgeAdapters: [
|
|
250
|
-
'AGENTS.md',
|
|
251
|
-
'CLAUDE.md',
|
|
252
|
-
'GEMINI.md',
|
|
253
|
-
'.cursor/rules/agentic-senior-core.mdc',
|
|
254
|
-
'.windsurf/rules/agentic-senior-core.md',
|
|
255
|
-
'.github/copilot-instructions.md',
|
|
256
|
-
'.github/instructions/agentic-senior-core.instructions.md',
|
|
257
|
-
'.gemini/instructions.md',
|
|
258
|
-
],
|
|
244
|
+
canonicalSource: 'AGENTS.md',
|
|
245
|
+
compiledRulebook: null,
|
|
246
|
+
legacyThinAdapters: [],
|
|
247
|
+
generatedBridgeAdapters: ['CLAUDE.md', 'GEMINI.md'],
|
|
259
248
|
stackLoadingMode: 'lazy',
|
|
260
249
|
domainRuleLoadingMode: 'lazy',
|
|
261
250
|
selectedProfile: selectedProfileName,
|
|
@@ -285,7 +274,7 @@ export async function runUpgradeCommand(targetDirectoryArgument, upgradeOptions
|
|
|
285
274
|
} else {
|
|
286
275
|
console.log('- Detected stack: unresolved (insufficient markers).');
|
|
287
276
|
}
|
|
288
|
-
console.log('- Active rules baseline: canonical .
|
|
277
|
+
console.log('- Active rules baseline: canonical AGENTS.md + .agent-context/ lazy rule library');
|
|
289
278
|
console.log(
|
|
290
279
|
`- Active review thresholds: ${(
|
|
291
280
|
PROFILE_PRESETS[selectedProfileName]?.blockingSeverities || []
|
|
@@ -300,24 +289,6 @@ export async function runUpgradeCommand(targetDirectoryArgument, upgradeOptions
|
|
|
300
289
|
|
|
301
290
|
const projectDocStalenessReport = await detectProjectDocTemplateStaleness(resolvedTargetDirectoryPath);
|
|
302
291
|
|
|
303
|
-
const currentRulesPath = path.join(resolvedTargetDirectoryPath, '.agent-instructions.md');
|
|
304
|
-
const currentRulesContent = await pathExists(currentRulesPath)
|
|
305
|
-
? await fs.readFile(currentRulesPath, 'utf8')
|
|
306
|
-
: '';
|
|
307
|
-
|
|
308
|
-
const plannedRulesContent = await buildCompiledRulesContent({
|
|
309
|
-
targetDirectoryPath: resolvedTargetDirectoryPath,
|
|
310
|
-
selectedStackFileName,
|
|
311
|
-
selectedAdditionalStackFileNames,
|
|
312
|
-
selectedBlueprintFileName,
|
|
313
|
-
selectedAdditionalBlueprintFileNames,
|
|
314
|
-
includeCiGuardrails,
|
|
315
|
-
});
|
|
316
|
-
|
|
317
|
-
const isRulesContentChanged = currentRulesContent !== plannedRulesContent;
|
|
318
|
-
const currentRuleLineCount = currentRulesContent ? currentRulesContent.split(/\r?\n/).length : 0;
|
|
319
|
-
const plannedRuleLineCount = plannedRulesContent.split(/\r?\n/).length;
|
|
320
|
-
|
|
321
292
|
console.log('\nUpgrade preview:');
|
|
322
293
|
console.log(`- Target directory: ${resolvedTargetDirectoryPath}`);
|
|
323
294
|
console.log(`- Runtime decision: ${selectedStackFileName === AGENT_DECISION_STACK_FILE_NAME ? 'agent recommendation required from repo evidence' : toTitleCase(selectedStackFileName)}`);
|
|
@@ -329,14 +300,12 @@ export async function runUpgradeCommand(targetDirectoryArgument, upgradeOptions
|
|
|
329
300
|
console.log(`- Additional blueprints: ${selectedAdditionalBlueprintFileNames.map((blueprintFileName) => toTitleCase(blueprintFileName)).join(', ')}`);
|
|
330
301
|
}
|
|
331
302
|
console.log(`- CI/CD quality checks (guardrails): ${includeCiGuardrails ? 'enabled' : 'disabled'}`);
|
|
332
|
-
console.log(
|
|
333
|
-
console.log(`- Planned rules lines: ${plannedRuleLineCount}`);
|
|
334
|
-
console.log(`- Rules changed: ${isRulesContentChanged ? 'yes' : 'no'}`);
|
|
303
|
+
console.log('- Instruction surface: AGENTS.md canonical with CLAUDE.md and GEMINI.md import bridges');
|
|
335
304
|
console.log(`- Managed surface stale files: ${managedSurfacePlan.staleFiles.length}`);
|
|
336
305
|
console.log(`- Managed surface stale directories: ${managedSurfacePlan.staleDirectories.length}`);
|
|
337
306
|
console.log(`- Managed surface sync mode: 1:1 (prune enabled)`);
|
|
338
307
|
console.log(`- Managed surface prune mode: ${upgradeOptions.pruneManagedSurface === true ? 'enabled (default)' : 'disabled (--no-prune)'}`);
|
|
339
|
-
console.log(`- MCP config write mode: ${upgradeOptions.includeMcpTemplate === true ? 'enabled (
|
|
308
|
+
console.log(`- MCP config write mode: ${upgradeOptions.includeMcpTemplate === true ? 'enabled (--mcp-template)' : 'disabled (default)'}`);
|
|
340
309
|
if (projectDocStalenessReport.hasProjectDocs) {
|
|
341
310
|
console.log(`- Project docs detected: ${projectDocStalenessReport.checkedFileNames.length}`);
|
|
342
311
|
console.log(`- Project docs expected template version: ${projectDocStalenessReport.expectedTemplateVersion}`);
|
|
@@ -431,15 +400,6 @@ export async function runUpgradeCommand(targetDirectoryArgument, upgradeOptions
|
|
|
431
400
|
}
|
|
432
401
|
}
|
|
433
402
|
|
|
434
|
-
const compileResult = await compileDynamicContext({
|
|
435
|
-
targetDirectoryPath: resolvedTargetDirectoryPath,
|
|
436
|
-
selectedStackFileName,
|
|
437
|
-
selectedAdditionalStackFileNames,
|
|
438
|
-
selectedBlueprintFileName,
|
|
439
|
-
selectedAdditionalBlueprintFileNames,
|
|
440
|
-
includeCiGuardrails,
|
|
441
|
-
preserveUserOwnedEntrypoints: true,
|
|
442
|
-
});
|
|
443
403
|
await writeSelectedPolicy(resolvedTargetDirectoryPath, selectedProfileName);
|
|
444
404
|
|
|
445
405
|
const setupDurationMs = Date.now() - setupStartedAt;
|
|
@@ -462,10 +422,8 @@ export async function runUpgradeCommand(targetDirectoryArgument, upgradeOptions
|
|
|
462
422
|
|
|
463
423
|
console.log('\nUpgrade complete.');
|
|
464
424
|
console.log(`- Governance surface sync: 1:1 (${governanceSyncResult.updatedFiles.length} updated, ${governanceSyncResult.createdFiles.length} new, ${governanceSyncResult.deletedManagedFiles.length} deleted, ${governanceSyncResult.unchangedFiles.length} unchanged)`);
|
|
465
|
-
console.log(`- Rules rewritten: ${isRulesContentChanged ? 'yes' : 'no (metadata refreshed)'}`);
|
|
466
425
|
const preservedInstructionEntrypoints = Array.from(new Set([
|
|
467
426
|
...(governanceSyncResult.preservedFiles || []),
|
|
468
|
-
...(compileResult.preservedEntrypoints || []),
|
|
469
427
|
])).sort();
|
|
470
428
|
if (preservedInstructionEntrypoints.length > 0) {
|
|
471
429
|
console.log(`- User-owned instruction entrypoints preserved: ${preservedInstructionEntrypoints.length}`);
|
|
@@ -494,7 +452,7 @@ export async function runUpgradeCommand(targetDirectoryArgument, upgradeOptions
|
|
|
494
452
|
supplementalCreatedFileNames.forEach((fileName) => console.log(` [NEW] ${fileName} (seed)`));
|
|
495
453
|
}
|
|
496
454
|
|
|
497
|
-
console.log('\nRefreshed files: .
|
|
455
|
+
console.log('\nRefreshed files: AGENTS.md, CLAUDE.md, GEMINI.md, .agent-context/, and .agent-context/state/onboarding-report.json');
|
|
498
456
|
} catch (error) {
|
|
499
457
|
console.error('\n[FATAL] An error occurred during upgrade. Attempting automatic rollback...');
|
|
500
458
|
try {
|
package/lib/cli/compiler.mjs
CHANGED
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
import {
|
|
16
16
|
pathExists,
|
|
17
17
|
collectFileNames,
|
|
18
|
-
isAgenticManagedContent,
|
|
19
18
|
} from './utils.mjs';
|
|
20
19
|
|
|
21
20
|
import {
|
|
@@ -106,38 +105,6 @@ function buildAnchorCommitmentHeader(designIntent) {
|
|
|
106
105
|
].join('\n');
|
|
107
106
|
}
|
|
108
107
|
|
|
109
|
-
function buildLegacyRootAdapterContent(adapterFileName, toolLabel) {
|
|
110
|
-
return [
|
|
111
|
-
`# ${adapterFileName} - Legacy Thin Adapter`,
|
|
112
|
-
'',
|
|
113
|
-
`Generated by Agentic-Senior-Core CLI v${CLI_VERSION}`,
|
|
114
|
-
'Adapter Mode: legacy-thin',
|
|
115
|
-
'Adapter Source: .agent-instructions.md when present; fallback .instructions.md',
|
|
116
|
-
'Canonical baseline: .instructions.md',
|
|
117
|
-
'',
|
|
118
|
-
`This file is kept only for older ${toolLabel} discovery.`,
|
|
119
|
-
'Read .agent-instructions.md for the compiled rulebook when present.',
|
|
120
|
-
'Use .instructions.md as the canonical policy source.',
|
|
121
|
-
'',
|
|
122
|
-
'Mandatory load floor:',
|
|
123
|
-
'1. Read .agent-instructions.md when present; otherwise read .instructions.md.',
|
|
124
|
-
'2. Load only relevant .agent-context/rules/ by task scope.',
|
|
125
|
-
'3. Apply matching .agent-context/prompts/ contracts.',
|
|
126
|
-
'4. Enforce .agent-context/review-checklists/ before completion.',
|
|
127
|
-
'5. Use .agent-context/state/ and .agent-context/policies/ only when relevant.',
|
|
128
|
-
'6. Resolve Runtime Decision Signals from repo evidence and live official docs.',
|
|
129
|
-
'7. Resolve Structural Planning Signals from constraints and architecture boundaries.',
|
|
130
|
-
'',
|
|
131
|
-
'Current bridges:',
|
|
132
|
-
'- Cursor: .cursor/rules/agentic-senior-core.mdc',
|
|
133
|
-
'- Windsurf: .windsurf/rules/agentic-senior-core.md',
|
|
134
|
-
'- Claude: CLAUDE.md',
|
|
135
|
-
'- Gemini: GEMINI.md and .gemini/instructions.md',
|
|
136
|
-
'- Copilot: .github/copilot-instructions.md and .github/instructions/agentic-senior-core.instructions.md',
|
|
137
|
-
'',
|
|
138
|
-
].join('\n');
|
|
139
|
-
}
|
|
140
|
-
|
|
141
108
|
function buildContainerizationStrategySnapshot(dockerStrategy) {
|
|
142
109
|
const selectedDockerStrategy = String(dockerStrategy || '').trim();
|
|
143
110
|
const normalizedDockerStrategy = selectedDockerStrategy.toLowerCase();
|
|
@@ -220,7 +187,7 @@ export async function writeOnboardingReport({
|
|
|
220
187
|
selectedBlueprint: hasExplicitArchitectureDecision ? selectedBlueprintFileName : null,
|
|
221
188
|
selectedAdditionalBlueprints: hasExplicitArchitectureDecision ? selectedAdditionalBlueprintFileNames : [],
|
|
222
189
|
ruleLoadingPolicy: {
|
|
223
|
-
canonicalSource: '.
|
|
190
|
+
canonicalSource: 'AGENTS.md',
|
|
224
191
|
stackLoadingMode: 'lazy',
|
|
225
192
|
domainRuleLoadingMode: 'lazy',
|
|
226
193
|
loadedOnDemand: true,
|
|
@@ -330,11 +297,10 @@ export async function buildCompiledRulesContent({
|
|
|
330
297
|
`6. .agent-context/policies/${POLICY_FILE_NAME}`,
|
|
331
298
|
'7. docs/ project context (or bootstrap prompts when docs are not materialized)',
|
|
332
299
|
'',
|
|
333
|
-
'
|
|
334
|
-
'
|
|
335
|
-
'
|
|
336
|
-
'
|
|
337
|
-
'Canonical baseline: .instructions.md',
|
|
300
|
+
'Canonical instruction source: AGENTS.md',
|
|
301
|
+
'Native import bridges: CLAUDE.md, GEMINI.md',
|
|
302
|
+
'Managed rule library: .agent-context/',
|
|
303
|
+
'Project decisions and dynamic state: .agent-context/state/onboarding-report.json',
|
|
338
304
|
].join('\n')
|
|
339
305
|
);
|
|
340
306
|
|
|
@@ -659,62 +625,11 @@ export async function buildCompiledRulesContent({
|
|
|
659
625
|
`Selected policy file: .agent-context/policies/${POLICY_FILE_NAME}`,
|
|
660
626
|
'',
|
|
661
627
|
'## GOVERNANCE PRECEDENCE',
|
|
662
|
-
'1. Follow
|
|
663
|
-
'2.
|
|
664
|
-
'3.
|
|
665
|
-
'4. Enforce pr-checklist.md before declaring completion.',
|
|
666
|
-
'',
|
|
667
|
-
'## OVERRIDE PROTOCOL',
|
|
668
|
-
'- Default: strict compliance with this file.',
|
|
669
|
-
'- Exception path: .agent-override.md may explicitly allow narrow deviations.',
|
|
670
|
-
'- Scope policy: every override must include module scope, rationale, and expiry date.',
|
|
628
|
+
'1. Follow AGENTS.md as the primary source.',
|
|
629
|
+
'2. Use architecture-map.md and dependency-map.md as change safety boundaries.',
|
|
630
|
+
'3. Enforce pr-checklist.md before declaring completion.',
|
|
671
631
|
'',
|
|
672
632
|
...contextBlocks,
|
|
673
633
|
'',
|
|
674
634
|
].join('\n');
|
|
675
635
|
}
|
|
676
|
-
|
|
677
|
-
export async function compileDynamicContext({
|
|
678
|
-
targetDirectoryPath,
|
|
679
|
-
selectedStackFileName,
|
|
680
|
-
selectedAdditionalStackFileNames = [],
|
|
681
|
-
selectedBlueprintFileName,
|
|
682
|
-
selectedAdditionalBlueprintFileNames = [],
|
|
683
|
-
includeCiGuardrails,
|
|
684
|
-
preserveUserOwnedEntrypoints = true,
|
|
685
|
-
}) {
|
|
686
|
-
const resolvedTargetDirectoryPath = path.resolve(targetDirectoryPath);
|
|
687
|
-
const compiledRules = await buildCompiledRulesContent({
|
|
688
|
-
targetDirectoryPath: resolvedTargetDirectoryPath,
|
|
689
|
-
selectedStackFileName,
|
|
690
|
-
selectedAdditionalStackFileNames,
|
|
691
|
-
selectedBlueprintFileName,
|
|
692
|
-
selectedAdditionalBlueprintFileNames,
|
|
693
|
-
includeCiGuardrails,
|
|
694
|
-
});
|
|
695
|
-
const preservedEntrypoints = [];
|
|
696
|
-
|
|
697
|
-
async function writeGeneratedEntrypointFile(relativeFilePath, content) {
|
|
698
|
-
const targetFilePath = path.join(resolvedTargetDirectoryPath, relativeFilePath);
|
|
699
|
-
|
|
700
|
-
if (preserveUserOwnedEntrypoints && await pathExists(targetFilePath)) {
|
|
701
|
-
const existingContent = await fs.readFile(targetFilePath, 'utf8');
|
|
702
|
-
if (!isAgenticManagedContent(existingContent)) {
|
|
703
|
-
preservedEntrypoints.push(relativeFilePath);
|
|
704
|
-
return;
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
await fs.mkdir(path.dirname(targetFilePath), { recursive: true });
|
|
709
|
-
await fs.writeFile(targetFilePath, content, 'utf8');
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
await fs.writeFile(path.join(resolvedTargetDirectoryPath, '.agent-instructions.md'), compiledRules, 'utf8');
|
|
713
|
-
await writeGeneratedEntrypointFile('.cursorrules', buildLegacyRootAdapterContent('.cursorrules', 'Cursor'));
|
|
714
|
-
await writeGeneratedEntrypointFile('.windsurfrules', buildLegacyRootAdapterContent('.windsurfrules', 'Windsurf'));
|
|
715
|
-
await writeGeneratedEntrypointFile('.clauderc', buildLegacyRootAdapterContent('.clauderc', 'Claude'));
|
|
716
|
-
|
|
717
|
-
return {
|
|
718
|
-
preservedEntrypoints,
|
|
719
|
-
};
|
|
720
|
-
}
|
package/lib/cli/constants.mjs
CHANGED
|
@@ -126,19 +126,11 @@ export const RUNTIME_ENVIRONMENT_CHOICES = [
|
|
|
126
126
|
];
|
|
127
127
|
|
|
128
128
|
export const entryPointFiles = [
|
|
129
|
-
'.instructions.md',
|
|
130
|
-
'.cursorrules',
|
|
131
|
-
'.windsurfrules',
|
|
132
129
|
'AGENTS.md',
|
|
133
130
|
'CLAUDE.md',
|
|
134
131
|
'GEMINI.md',
|
|
135
|
-
'.cursor/rules/agentic-senior-core.mdc',
|
|
136
|
-
'.github/copilot-instructions.md',
|
|
137
|
-
'.github/instructions/agentic-senior-core.instructions.md',
|
|
138
|
-
'.windsurf/rules/agentic-senior-core.md',
|
|
139
|
-
'.agent-override.md',
|
|
140
132
|
];
|
|
141
133
|
|
|
142
|
-
export const directoryCopies = ['.agent-context'
|
|
134
|
+
export const directoryCopies = ['.agent-context'];
|
|
143
135
|
|
|
144
136
|
export const BACKUP_DIR_NAME = '.agentic-backup';
|
package/lib/cli/detector.mjs
CHANGED
package/lib/cli/init-options.mjs
CHANGED
|
@@ -23,7 +23,7 @@ export function parseInitArguments(commandArguments) {
|
|
|
23
23
|
tokenOptimize: true,
|
|
24
24
|
memoryContinuity: true,
|
|
25
25
|
tokenAgent: 'copilot',
|
|
26
|
-
includeMcpTemplate:
|
|
26
|
+
includeMcpTemplate: false,
|
|
27
27
|
scaffoldDocs: undefined,
|
|
28
28
|
docsLang: 'en',
|
|
29
29
|
docsLangProvided: false,
|
|
@@ -27,6 +27,10 @@ export function validateDesignContractCompleteness(designIntentContract) {
|
|
|
27
27
|
'spacingDerivationSource',
|
|
28
28
|
'typographyDerivationSource',
|
|
29
29
|
'motionDerivationSource',
|
|
30
|
+
'colorSpace',
|
|
31
|
+
'spatialBaseUnit',
|
|
32
|
+
'typeScaleMethod',
|
|
33
|
+
'motionBudget',
|
|
30
34
|
'validationRule',
|
|
31
35
|
]) {
|
|
32
36
|
if (!hasNonEmptyString(derivedTokenLogic[requiredFieldName])) {
|
|
@@ -334,6 +334,10 @@ function buildDesignIntentContractObject({
|
|
|
334
334
|
spacingDerivationSource: 'Explain spacing rhythm, density, and exceptions from anchorReference. Spacing grids are layout math, not decorative background lines.',
|
|
335
335
|
typographyDerivationSource: 'Explain display, body, metadata, and data roles from anchorReference.',
|
|
336
336
|
motionDerivationSource: 'Explain duration, easing, choreography, and reduced-motion from anchorReference.',
|
|
337
|
+
colorSpace: 'Prefer OKLCH for newly generated CSS tokens when supported; preserve existing design-system token formats and document fallback color space.',
|
|
338
|
+
spatialBaseUnit: 'Name the base spacing unit, major multiples, density exceptions, and optical exceptions before writing spacing values.',
|
|
339
|
+
typeScaleMethod: 'Prefer fluid clamp() type scales when supported; name ratio, role contrast, balance/wrap behavior, and numeric typography needs.',
|
|
340
|
+
motionBudget: 'Name micro, layout, entrance, easing, stagger, and reduced-motion budgets; prefer transform/opacity for high-frequency motion.',
|
|
337
341
|
validationRule: 'Every semantic token role must trace to anchorReference; keep exact primitive values flexible unless locked by repo evidence, accessibility validation, implementation constraints, or explicit user approval.',
|
|
338
342
|
},
|
|
339
343
|
motionPaletteDecision: {
|
|
@@ -245,10 +245,14 @@ export function buildDesignBootstrapPrompt({
|
|
|
245
245
|
'Use reduced-motion fallbacks instead of suppressing motion.',
|
|
246
246
|
'',
|
|
247
247
|
'## Token Derivation Audit',
|
|
248
|
-
'Before implementation, docs/design-intent.json must include derivedTokenLogic.anchorReference plus colorDerivationSource, spacingDerivationSource, typographyDerivationSource, motionDerivationSource, and validationRule.',
|
|
248
|
+
'Before implementation, docs/design-intent.json must include derivedTokenLogic.anchorReference plus colorDerivationSource, spacingDerivationSource, typographyDerivationSource, motionDerivationSource, colorSpace, spatialBaseUnit, typeScaleMethod, motionBudget, and validationRule.',
|
|
249
249
|
'Every semantic token role must be explainable from anchorReference. If the rationale is only looks good, common practice, modern default, or framework default, derive the token again before UI code.',
|
|
250
250
|
'Keep exact primitive values flexible until repo evidence, accessibility validation, implementation constraints, or explicit user approval locks them.',
|
|
251
251
|
'',
|
|
252
|
+
'## Implementation Craft Layer',
|
|
253
|
+
'Record explicit CSS craft decisions before UI code: color space and commitment level, fluid typography method, spacing base unit, motion budget, and the default CSS reflex this project rejects.',
|
|
254
|
+
'Prefer OKLCH, tinted neutrals, clamp() type scales, transform/opacity motion, and responsive recomposition when supported by the stack; preserve existing design-system tokens and document fallbacks instead of forcing rewrites.',
|
|
255
|
+
'',
|
|
252
256
|
'## Library Research Protocol',
|
|
253
257
|
'If web search is available, verify every new UI, animation, scroll, 3D, canvas, chart, icon, styling, or primitive library against current official docs and record source URL, fetched date, stable compatible version, purpose, risk, and fallback.',
|
|
254
258
|
'If web search is unavailable or fails, set libraryResearchStatus to pending-verification, record LIBRARY_TO_VERIFY notes, and use native CSS, browser APIs, or already-present project dependencies only when they can preserve the intended ambition until verification is possible.',
|
|
@@ -51,6 +51,8 @@ export function isAgenticManagedContent(content) {
|
|
|
51
51
|
'Adapter Mode: legacy-thin',
|
|
52
52
|
'Canonical Snapshot SHA256',
|
|
53
53
|
'Canonical baseline: .instructions.md',
|
|
54
|
+
'canonical instruction source for this repository',
|
|
55
|
+
'@AGENTS.md',
|
|
54
56
|
].some((managedSignal) => normalizedContent.includes(managedSignal));
|
|
55
57
|
}
|
|
56
58
|
|
|
@@ -6,7 +6,10 @@ import {
|
|
|
6
6
|
entryPointFiles,
|
|
7
7
|
directoryCopies,
|
|
8
8
|
} from '../constants.mjs';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
isAgenticManagedContent,
|
|
11
|
+
pathExists,
|
|
12
|
+
} from './filesystem.mjs';
|
|
10
13
|
|
|
11
14
|
function toPosixRelativePath(relativePath) {
|
|
12
15
|
return relativePath.split(path.sep).join('/');
|
|
@@ -29,6 +32,34 @@ const localOnlyGovernanceFiles = new Set([
|
|
|
29
32
|
'.agent-context/state/v3-purge-audit.json',
|
|
30
33
|
]);
|
|
31
34
|
|
|
35
|
+
const legacyManagedInstructionFiles = [
|
|
36
|
+
'.instructions.md',
|
|
37
|
+
'.agent-instructions.md',
|
|
38
|
+
'.cursorrules',
|
|
39
|
+
'.windsurfrules',
|
|
40
|
+
'.clauderc',
|
|
41
|
+
'.cursor/rules/agentic-senior-core.mdc',
|
|
42
|
+
'.windsurf/rules/agentic-senior-core.md',
|
|
43
|
+
'.github/copilot-instructions.md',
|
|
44
|
+
'.github/instructions/agentic-senior-core.instructions.md',
|
|
45
|
+
'.gemini/instructions.md',
|
|
46
|
+
'.agents/workflows/init-project.md',
|
|
47
|
+
'.agents/workflows/refactor.md',
|
|
48
|
+
'.agents/workflows/review-code.md',
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
export const legacyManagedInstructionDirectories = [
|
|
52
|
+
'.agents/workflows',
|
|
53
|
+
'.agents',
|
|
54
|
+
'.cursor/rules',
|
|
55
|
+
'.cursor',
|
|
56
|
+
'.windsurf/rules',
|
|
57
|
+
'.windsurf',
|
|
58
|
+
'.github/instructions',
|
|
59
|
+
'.github',
|
|
60
|
+
'.gemini',
|
|
61
|
+
];
|
|
62
|
+
|
|
32
63
|
function isLocalOnlyGovernanceFile(relativePath) {
|
|
33
64
|
return localOnlyGovernanceFiles.has(toPosixRelativePath(relativePath));
|
|
34
65
|
}
|
|
@@ -171,6 +202,18 @@ async function collectManagedTargetManifest(resolvedTargetDirectoryPath, options
|
|
|
171
202
|
targetDirectories.add(targetDirectoryPath);
|
|
172
203
|
}
|
|
173
204
|
|
|
205
|
+
for (const legacyManagedFile of legacyManagedInstructionFiles) {
|
|
206
|
+
const targetFilePath = path.join(resolvedTargetDirectoryPath, ...legacyManagedFile.split('/'));
|
|
207
|
+
if (!(await pathExists(targetFilePath))) {
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
const targetFileContent = await fs.readFile(targetFilePath);
|
|
212
|
+
if (isAgenticManagedContent(targetFileContent)) {
|
|
213
|
+
targetFiles.add(legacyManagedFile);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
174
217
|
return {
|
|
175
218
|
files: targetFiles,
|
|
176
219
|
directories: targetDirectories,
|
|
@@ -183,7 +226,7 @@ export async function analyzeManagedGovernanceSurface(
|
|
|
183
226
|
) {
|
|
184
227
|
const preservePathPrefixes = Array.isArray(options.preservePathPrefixes)
|
|
185
228
|
? options.preservePathPrefixes
|
|
186
|
-
: ['.agent-context/state'
|
|
229
|
+
: ['.agent-context/state'];
|
|
187
230
|
|
|
188
231
|
const sourceManifest = await buildManagedSourceManifest(options);
|
|
189
232
|
const targetManifest = await collectManagedTargetManifest(resolvedTargetDirectoryPath, options);
|