@ryuenn3123/agentic-senior-core 4.3.15 → 5.1.0
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/.agents/plugins/marketplace.json +21 -0
- package/.agents/rules/agentic-senior-core.md +126 -0
- package/.claude-plugin/marketplace.json +17 -0
- package/.claude-plugin/plugin.json +17 -0
- package/.clinerules/agentic-senior-core.md +94 -0
- package/.codex-plugin/plugin.json +24 -0
- package/.cursor/rules/agentic-senior-core.mdc +99 -0
- package/.devin-plugin/plugin.json +13 -0
- package/.github/copilot-instructions.md +94 -0
- package/.github/plugin/marketplace.json +20 -0
- package/.github/plugin/plugin.json +16 -0
- package/.kiro/steering/agentic-senior-core.md +94 -0
- package/.openclaw/skills/asc/SKILL.md +23 -0
- package/.openclaw/skills/asc-audit/SKILL.md +28 -0
- package/.openclaw/skills/asc-review/SKILL.md +54 -0
- package/.opencode/plugins/agentic-senior-core.mjs +31 -0
- package/.windsurf/rules/agentic-senior-core.md +94 -0
- package/AGENTS.md +126 -179
- package/CONTRIBUTING.md +93 -63
- package/README.md +160 -111
- package/__init__.py +61 -0
- package/bin/agentic-senior-core.js +41 -43
- package/commands/asc-audit.md +1 -0
- package/commands/asc-audit.toml +2 -0
- package/commands/asc-help.md +9 -0
- package/commands/asc-help.toml +2 -0
- package/commands/asc-refactor.md +1 -0
- package/commands/asc-refactor.toml +2 -0
- package/commands/asc-review.md +1 -0
- package/commands/asc-review.toml +2 -0
- package/gemini-extension.json +10 -0
- package/hooks/copilot-hooks.json +21 -0
- package/hooks/hooks.json +31 -0
- package/hooks/session-start.js +36 -0
- package/hooks/subagent-start.js +38 -0
- package/lib/cli/commands/adapter.mjs +109 -0
- package/lib/cli/commands/clean.mjs +63 -0
- package/lib/cli/commands/status.mjs +94 -0
- package/package.json +43 -67
- package/plugin.yaml +16 -0
- package/scripts/uninstall.js +38 -0
- package/skills/asc/SKILL.md +16 -0
- package/skills/asc-audit/SKILL.md +28 -0
- package/skills/asc-refactor/SKILL.md +35 -0
- package/skills/asc-review/SKILL.md +54 -0
- package/.agent-context/policies/llm-judge-threshold.json +0 -29
- package/.agent-context/prompts/bootstrap-design.md +0 -63
- package/.agent-context/prompts/compact-natural-mode.md +0 -100
- package/.agent-context/prompts/init-project.md +0 -60
- package/.agent-context/prompts/refactor.md +0 -38
- package/.agent-context/prompts/review-code.md +0 -31
- package/.agent-context/review-checklists/architecture-review.md +0 -57
- package/.agent-context/review-checklists/pr-checklist.md +0 -136
- package/.agent-context/rules/api-docs.md +0 -24
- package/.agent-context/rules/api-versioning.md +0 -16
- package/.agent-context/rules/architecture.md +0 -33
- package/.agent-context/rules/background-jobs.md +0 -17
- package/.agent-context/rules/config-and-flags.md +0 -16
- package/.agent-context/rules/database-design.md +0 -18
- package/.agent-context/rules/docker-runtime.md +0 -17
- package/.agent-context/rules/error-handling.md +0 -16
- package/.agent-context/rules/event-driven.md +0 -16
- package/.agent-context/rules/frontend-architecture.md +0 -54
- package/.agent-context/rules/microservices.md +0 -16
- package/.agent-context/rules/migrations.md +0 -16
- package/.agent-context/rules/observability.md +0 -16
- package/.agent-context/rules/performance.md +0 -16
- package/.agent-context/rules/realtime.md +0 -16
- package/.agent-context/rules/resilience.md +0 -18
- package/.agent-context/rules/security.md +0 -18
- package/.agent-context/rules/testing.md +0 -16
- package/.agent-context/state/README.md +0 -25
- package/.agent-context/state/architecture-map.md +0 -40
- package/.agent-context/state/benchmark-comparison-schema.json +0 -181
- package/.agent-context/state/benchmark-reproducibility.json +0 -87
- package/.agent-context/state/benchmark-thresholds.json +0 -10
- package/.agent-context/state/benchmark-writer-judge-config.json +0 -58
- package/.agent-context/state/dependency-map.md +0 -41
- package/.agent-context/state/memory-adapter-contract.json +0 -52
- package/.agent-context/state/memory-schema-v1.json +0 -88
- package/GEMINI.md +0 -1
- package/benchmarks/README.md +0 -60
- package/benchmarks/compact-natural-mode/fixtures.mjs +0 -359
- package/benchmarks/compact-natural-mode/scorer.mjs +0 -331
- package/benchmarks/runtime-token-saver/fixtures.mjs +0 -836
- package/lib/cli/adaptive-context/catalog.mjs +0 -390
- package/lib/cli/adaptive-context/file-signals.mjs +0 -100
- package/lib/cli/adaptive-context/implications.mjs +0 -44
- package/lib/cli/adaptive-context.mjs +0 -365
- package/lib/cli/audits/typography-palette-anti-repeat/color-utils.mjs +0 -156
- package/lib/cli/audits/typography-palette-anti-repeat/file-scanner.mjs +0 -103
- package/lib/cli/audits/typography-palette-anti-repeat/typography-utils.mjs +0 -70
- package/lib/cli/audits/typography-palette-anti-repeat-audit.mjs +0 -239
- package/lib/cli/backup.mjs +0 -210
- package/lib/cli/commands/audit-design-anti-repeat.mjs +0 -39
- package/lib/cli/commands/context.mjs +0 -140
- package/lib/cli/commands/init/project-context.mjs +0 -60
- package/lib/cli/commands/init/runtime-environment.mjs +0 -59
- package/lib/cli/commands/init/setup-decisions.mjs +0 -83
- package/lib/cli/commands/init.mjs +0 -654
- package/lib/cli/commands/launch.mjs +0 -76
- package/lib/cli/commands/optimize.mjs +0 -284
- package/lib/cli/commands/rollback.mjs +0 -64
- package/lib/cli/commands/upgrade/token-optimization-state.mjs +0 -51
- package/lib/cli/commands/upgrade.mjs +0 -451
- package/lib/cli/compiler.mjs +0 -570
- package/lib/cli/constants.mjs +0 -136
- package/lib/cli/detector/constants.mjs +0 -135
- package/lib/cli/detector/design-evidence/collector.mjs +0 -256
- package/lib/cli/detector/design-evidence/constants.mjs +0 -39
- package/lib/cli/detector/design-evidence/file-traversal.mjs +0 -83
- package/lib/cli/detector/design-evidence/structured-attribute-evidence.mjs +0 -117
- package/lib/cli/detector/design-evidence/summary.mjs +0 -109
- package/lib/cli/detector/design-evidence/utility-helpers.mjs +0 -122
- package/lib/cli/detector/design-evidence.mjs +0 -25
- package/lib/cli/detector/stack-detection.mjs +0 -243
- package/lib/cli/detector/ui-signals.mjs +0 -150
- package/lib/cli/detector/workspace-scan.mjs +0 -177
- package/lib/cli/detector.mjs +0 -23
- package/lib/cli/init-detection-flow.mjs +0 -48
- package/lib/cli/init-options.mjs +0 -237
- package/lib/cli/init-selection.mjs +0 -29
- package/lib/cli/memory-continuity.mjs +0 -537
- package/lib/cli/preflight.mjs +0 -76
- package/lib/cli/project-scaffolder/constants.mjs +0 -69
- package/lib/cli/project-scaffolder/discovery.mjs +0 -272
- package/lib/cli/project-scaffolder/prompt-builders.mjs +0 -171
- package/lib/cli/project-scaffolder/storage.mjs +0 -144
- package/lib/cli/project-scaffolder/ui-scope-detection.mjs +0 -36
- package/lib/cli/project-scaffolder.mjs +0 -29
- package/lib/cli/rollback.mjs +0 -66
- package/lib/cli/token-optimization.mjs +0 -486
- package/lib/cli/utils/filesystem.mjs +0 -81
- package/lib/cli/utils/managed-surface.mjs +0 -280
- package/lib/cli/utils/prompting.mjs +0 -44
- package/lib/cli/utils.mjs +0 -479
- package/mcp.json +0 -134
- package/scripts/adaptive-context/fixtures.mjs +0 -183
- package/scripts/adaptive-context-benchmark.mjs +0 -9
- package/scripts/ascx-runtime-token-saver-benchmark.mjs +0 -9
- package/scripts/audit-cache-layer-contract.mjs +0 -263
- package/scripts/audit-caching-scope-hygiene.mjs +0 -268
- package/scripts/audit-file-size.mjs +0 -219
- package/scripts/audit-reflection-citations.mjs +0 -163
- package/scripts/audit-release-bundle.mjs +0 -170
- package/scripts/audit-rule-id-uniqueness.mjs +0 -313
- package/scripts/audit-typography-palette-anti-repeat.mjs +0 -120
- package/scripts/benchmark-evidence-bundle.mjs +0 -645
- package/scripts/benchmark-gate.mjs +0 -121
- package/scripts/benchmark-intelligence.mjs +0 -33
- package/scripts/benchmark-writer-judge-matrix.mjs +0 -379
- package/scripts/build-release-benchmark-bundle.mjs +0 -202
- package/scripts/bump-version.mjs +0 -103
- package/scripts/clean-local-artifacts.mjs +0 -78
- package/scripts/compact-natural-mode-benchmark.mjs +0 -9
- package/scripts/context-triggered-audit.mjs +0 -391
- package/scripts/detection-benchmark.mjs +0 -127
- package/scripts/docs-quality-drift-report.mjs +0 -358
- package/scripts/documentation-boundary-audit.mjs +0 -305
- package/scripts/explain-on-demand-audit.mjs +0 -427
- package/scripts/forbidden-content-check.mjs +0 -123
- package/scripts/frontend-usability-audit.mjs +0 -243
- package/scripts/generate-sbom.mjs +0 -61
- package/scripts/governance-weekly-report.mjs +0 -466
- package/scripts/llm-judge/checklist-loader.mjs +0 -45
- package/scripts/llm-judge/constants.mjs +0 -66
- package/scripts/llm-judge/diff-collection.mjs +0 -74
- package/scripts/llm-judge/prompting.mjs +0 -78
- package/scripts/llm-judge/providers.mjs +0 -111
- package/scripts/llm-judge/verdict.mjs +0 -134
- package/scripts/llm-judge.mjs +0 -200
- package/scripts/memory-continuity-benchmark.mjs +0 -322
- package/scripts/quality-trend-report.mjs +0 -289
- package/scripts/release-gate/audit-checks.mjs +0 -441
- package/scripts/release-gate/constants.mjs +0 -53
- package/scripts/release-gate/runtime.mjs +0 -63
- package/scripts/release-gate/static-checks.mjs +0 -182
- package/scripts/release-gate.mjs +0 -42
- package/scripts/rules-guardian-audit.mjs +0 -580
- package/scripts/single-source-lazy-loading-audit.mjs +0 -449
- package/scripts/sync-thin-adapters.mjs +0 -72
- package/scripts/token-optimization-benchmark.mjs +0 -252
- package/scripts/ui-design-judge/constants.mjs +0 -13
- package/scripts/ui-design-judge/design-execution-summary.mjs +0 -81
- package/scripts/ui-design-judge/git-input.mjs +0 -134
- package/scripts/ui-design-judge/prompting.mjs +0 -52
- package/scripts/ui-design-judge/providers.mjs +0 -102
- package/scripts/ui-design-judge/reporting.mjs +0 -183
- package/scripts/ui-design-judge/rubric-calibration.mjs +0 -214
- package/scripts/ui-design-judge/rubric-goldset.json +0 -188
- package/scripts/ui-design-judge.mjs +0 -319
- package/scripts/ui-rubric-calibration.mjs +0 -35
- package/scripts/validate/config.mjs +0 -519
- package/scripts/validate/coverage-checks.mjs +0 -446
- package/scripts/validate/file-structure.mjs +0 -162
- package/scripts/validate/markdown-content.mjs +0 -109
- package/scripts/validate/project-metadata.mjs +0 -166
- package/scripts/validate.mjs +0 -338
|
@@ -1,654 +0,0 @@
|
|
|
1
|
-
// @file-size-exception: Interactive CLI flow with sequential prompts; planned for split in Phase 1 commands refactor.
|
|
2
|
-
/**
|
|
3
|
-
* Init Command — Interactive project initialization.
|
|
4
|
-
* Depends on: constants, utils, detector, compiler
|
|
5
|
-
*/
|
|
6
|
-
import { createInterface } from 'node:readline/promises';
|
|
7
|
-
import { stdin, stdout } from 'node:process';
|
|
8
|
-
import fs from 'node:fs/promises';
|
|
9
|
-
import path from 'node:path';
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
CLI_VERSION,
|
|
13
|
-
AGENT_CONTEXT_DIR,
|
|
14
|
-
INIT_PRESETS,
|
|
15
|
-
PROFILE_PRESETS,
|
|
16
|
-
GOLDEN_STANDARD_PROFILE_NAME,
|
|
17
|
-
AGENT_DECISION_STACK_FILE_NAME,
|
|
18
|
-
AGENT_DECISION_BLUEPRINT_FILE_NAME,
|
|
19
|
-
} from '../constants.mjs';
|
|
20
|
-
|
|
21
|
-
import {
|
|
22
|
-
ensureDirectory,
|
|
23
|
-
askYesNo,
|
|
24
|
-
toTitleCase,
|
|
25
|
-
collectFileNames,
|
|
26
|
-
formatBlockingSeverities,
|
|
27
|
-
formatDuration,
|
|
28
|
-
copyGovernanceAssetsToTarget,
|
|
29
|
-
pathExists,
|
|
30
|
-
} from '../utils.mjs';
|
|
31
|
-
|
|
32
|
-
import {
|
|
33
|
-
detectProjectContext,
|
|
34
|
-
buildDetectionSummary,
|
|
35
|
-
formatDetectionCandidates,
|
|
36
|
-
detectUiScopeSignals,
|
|
37
|
-
} from '../detector.mjs';
|
|
38
|
-
import { writeSelectedPolicy, writeOnboardingReport } from '../compiler.mjs';
|
|
39
|
-
import {
|
|
40
|
-
normalizeAdditionalStackSelection,
|
|
41
|
-
normalizeAdditionalBlueprintSelection,
|
|
42
|
-
} from '../init-selection.mjs';
|
|
43
|
-
import {
|
|
44
|
-
buildExistingProjectMajorConstraints,
|
|
45
|
-
resolveDetectedSetupDecision,
|
|
46
|
-
} from '../init-detection-flow.mjs';
|
|
47
|
-
import { runPreflightChecks } from '../preflight.mjs';
|
|
48
|
-
import {
|
|
49
|
-
createBackup,
|
|
50
|
-
ensureBackupGitignoreEntry,
|
|
51
|
-
ensureRuntimeArtifactGitignoreEntries,
|
|
52
|
-
ensureLocalGovernanceGitignoreEntries,
|
|
53
|
-
} from '../backup.mjs';
|
|
54
|
-
import {
|
|
55
|
-
runProjectDiscovery,
|
|
56
|
-
generateProjectDocumentation,
|
|
57
|
-
isDirectoryEffectivelyEmpty,
|
|
58
|
-
hasExistingProjectDocs,
|
|
59
|
-
loadProjectConfig,
|
|
60
|
-
normalizeDocsLanguage,
|
|
61
|
-
} from '../project-scaffolder.mjs';
|
|
62
|
-
import { performRollback } from '../rollback.mjs';
|
|
63
|
-
import {
|
|
64
|
-
createTokenOptimizationState,
|
|
65
|
-
detectRtkBinary,
|
|
66
|
-
normalizeAgentName,
|
|
67
|
-
writeTokenOptimizationState,
|
|
68
|
-
} from '../token-optimization.mjs';
|
|
69
|
-
import {
|
|
70
|
-
createMemoryContinuityState,
|
|
71
|
-
ensureActiveMemorySnapshot,
|
|
72
|
-
writeMemoryContinuityState,
|
|
73
|
-
} from '../memory-continuity.mjs';
|
|
74
|
-
|
|
75
|
-
import {
|
|
76
|
-
detectRuntimeEnvironment,
|
|
77
|
-
resolveRuntimeEnvironmentKeyFromLabel,
|
|
78
|
-
resolveRuntimeEnvironmentLabelFromKey,
|
|
79
|
-
} from './init/runtime-environment.mjs';
|
|
80
|
-
import {
|
|
81
|
-
inferProjectScopeFromDiscoveryAnswers,
|
|
82
|
-
normalizeExplicitProfileFileName,
|
|
83
|
-
resolveProjectScopeLabelFromKey,
|
|
84
|
-
resolveSilentCiGuardrailsDefault,
|
|
85
|
-
} from './init/setup-decisions.mjs';
|
|
86
|
-
import { inferExistingProjectDescriptionHint } from './init/project-context.mjs';
|
|
87
|
-
|
|
88
|
-
export { REPOSITORY_ROOT } from '../constants.mjs';
|
|
89
|
-
export {
|
|
90
|
-
parseInitArguments,
|
|
91
|
-
normalizeRuntimeEnvironmentKey,
|
|
92
|
-
} from '../init-options.mjs';
|
|
93
|
-
export {
|
|
94
|
-
resolveProjectScopeKeyFromLabel,
|
|
95
|
-
normalizeAdditionalStackSelection,
|
|
96
|
-
normalizeAdditionalBlueprintSelection,
|
|
97
|
-
} from '../init-selection.mjs';
|
|
98
|
-
export {
|
|
99
|
-
detectRuntimeEnvironment,
|
|
100
|
-
resolveRuntimeEnvironmentKeyFromLabel,
|
|
101
|
-
resolveRuntimeEnvironmentLabelFromKey,
|
|
102
|
-
} from './init/runtime-environment.mjs';
|
|
103
|
-
|
|
104
|
-
export async function runInitCommand(targetDirectoryArgument, initOptions = {}) {
|
|
105
|
-
const resolvedTargetDirectoryPath = path.resolve(targetDirectoryArgument || '.');
|
|
106
|
-
const isTokenOptimizationEnabled = typeof initOptions.tokenOptimize === 'boolean'
|
|
107
|
-
? initOptions.tokenOptimize
|
|
108
|
-
: true;
|
|
109
|
-
const isMemoryContinuityEnabled = typeof initOptions.memoryContinuity === 'boolean'
|
|
110
|
-
? initOptions.memoryContinuity
|
|
111
|
-
: true;
|
|
112
|
-
const shouldIncludeMcpTemplate = initOptions.includeMcpTemplate === true;
|
|
113
|
-
const selectedTokenAgentName = normalizeAgentName(initOptions.tokenAgent || 'copilot');
|
|
114
|
-
const isInteractiveSession = Boolean(stdin.isTTY && stdout.isTTY);
|
|
115
|
-
|
|
116
|
-
if (resolvedTargetDirectoryPath.toLowerCase() === 'c:\\windows' || resolvedTargetDirectoryPath.toLowerCase() === 'c:\\windows\\system32') {
|
|
117
|
-
console.error('\n[FATAL] Target directory resolved to a Windows system folder (C:\\Windows).');
|
|
118
|
-
console.error('If you are running Windows npm from inside WSL, this is caused by cmd.exe lacking UNC path support.');
|
|
119
|
-
console.error('Please install and use a native Linux Node.js/npm directly inside WSL to setup your project.');
|
|
120
|
-
process.exit(1);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
const setupStartedAt = Date.now();
|
|
124
|
-
await ensureDirectory(resolvedTargetDirectoryPath);
|
|
125
|
-
|
|
126
|
-
const preflightResult = await runPreflightChecks(resolvedTargetDirectoryPath, 'init');
|
|
127
|
-
if (!preflightResult.passed) {
|
|
128
|
-
console.error('\n[FATAL] Preflight checks failed. Initializing here would cause errors or data loss:');
|
|
129
|
-
console.error(JSON.stringify(preflightResult, null, 2));
|
|
130
|
-
throw new Error('Preflight checks failed.');
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
const wasDirectoryEffectivelyEmpty = await isDirectoryEffectivelyEmpty(resolvedTargetDirectoryPath);
|
|
134
|
-
const hadExistingProjectDocsBeforeInit = await hasExistingProjectDocs(resolvedTargetDirectoryPath);
|
|
135
|
-
|
|
136
|
-
const userInterface = createInterface({ input: stdin, output: stdout });
|
|
137
|
-
|
|
138
|
-
try {
|
|
139
|
-
const discoveredStackFileNames = await collectFileNames(path.join(AGENT_CONTEXT_DIR, 'stacks'));
|
|
140
|
-
const discoveredBlueprintFileNames = await collectFileNames(path.join(AGENT_CONTEXT_DIR, 'blueprints'));
|
|
141
|
-
|
|
142
|
-
if (discoveredStackFileNames.length === 0 || discoveredBlueprintFileNames.length === 0) {
|
|
143
|
-
console.log('[INFO] Static stack/blueprint profiles are not fully present. Using compatibility labels for dynamic reasoning mode.');
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
const selectedPreset = initOptions.preset ? INIT_PRESETS[initOptions.preset] || null : null;
|
|
147
|
-
|
|
148
|
-
const selectedStackFileNameFromOption = initOptions.stack
|
|
149
|
-
? normalizeExplicitProfileFileName(initOptions.stack, discoveredStackFileNames)
|
|
150
|
-
: null;
|
|
151
|
-
const selectedBlueprintFileNameFromOption = initOptions.blueprint
|
|
152
|
-
? normalizeExplicitProfileFileName(initOptions.blueprint, discoveredBlueprintFileNames)
|
|
153
|
-
: null;
|
|
154
|
-
|
|
155
|
-
if (initOptions.preset && !selectedPreset) {
|
|
156
|
-
throw new Error(`Unknown preset: ${initOptions.preset}`);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
console.log(`\nAgentic-Senior-Core CLI v${CLI_VERSION}`);
|
|
160
|
-
console.log('I will copy the project guidance pack into your target folder with AGENTS.md and native import bridges for your AI tools.');
|
|
161
|
-
|
|
162
|
-
if (selectedPreset) {
|
|
163
|
-
console.log(`Using preset: ${initOptions.preset} (${selectedPreset.description}).`);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
const projectDetection = await detectProjectContext(resolvedTargetDirectoryPath);
|
|
167
|
-
if (projectDetection.hasExistingProjectFiles) {
|
|
168
|
-
console.log('I found files in the target directory, so I checked whether this already looks like an existing project.');
|
|
169
|
-
console.log(buildDetectionSummary(projectDetection));
|
|
170
|
-
console.log('Detection reasoning:');
|
|
171
|
-
console.log(projectDetection.detectionReasoning);
|
|
172
|
-
console.log('Top candidates:');
|
|
173
|
-
console.log(formatDetectionCandidates(projectDetection.rankedCandidates));
|
|
174
|
-
} else {
|
|
175
|
-
console.log('The target directory is empty, so I will guide you through a fresh setup.');
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
const detectedRuntimeEnvironment = detectRuntimeEnvironment();
|
|
179
|
-
let selectedRuntimeEnvironmentKey = initOptions.runtimeEnv === 'auto'
|
|
180
|
-
? detectedRuntimeEnvironment.key
|
|
181
|
-
: initOptions.runtimeEnv;
|
|
182
|
-
|
|
183
|
-
const selectedPolicyProfileName = initOptions.profile
|
|
184
|
-
? initOptions.profile
|
|
185
|
-
: initOptions.newbie
|
|
186
|
-
? 'beginner'
|
|
187
|
-
: GOLDEN_STANDARD_PROFILE_NAME;
|
|
188
|
-
|
|
189
|
-
const selectedPolicyProfile = PROFILE_PRESETS[selectedPolicyProfileName];
|
|
190
|
-
if (!selectedPolicyProfile) {
|
|
191
|
-
throw new Error(`Unknown internal policy profile: ${selectedPolicyProfileName}`);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
console.log(`\nReview thresholds: ${formatBlockingSeverities(selectedPolicyProfile.blockingSeverities)}.`);
|
|
195
|
-
|
|
196
|
-
const detectionMajorConstraints = buildExistingProjectMajorConstraints();
|
|
197
|
-
const detectionTransparency = {
|
|
198
|
-
declaredAt: new Date().toISOString(),
|
|
199
|
-
declarationType: projectDetection.hasExistingProjectFiles ? 'existing-project' : 'fresh-project',
|
|
200
|
-
declarationShown: projectDetection.hasExistingProjectFiles,
|
|
201
|
-
detectionSummary: projectDetection.hasExistingProjectFiles
|
|
202
|
-
? buildDetectionSummary(projectDetection)
|
|
203
|
-
: 'No existing project markers were detected.',
|
|
204
|
-
activeRulesSummary: {
|
|
205
|
-
canonicalSource: 'AGENTS.md',
|
|
206
|
-
compiledRulebook: null,
|
|
207
|
-
legacyThinAdapters: [],
|
|
208
|
-
generatedBridgeAdapters: ['CLAUDE.md', 'GEMINI.md'],
|
|
209
|
-
stackLoadingMode: 'lazy',
|
|
210
|
-
domainRuleLoadingMode: 'lazy',
|
|
211
|
-
selectedProfile: selectedPolicyProfileName,
|
|
212
|
-
selectedProfileDisplayName: selectedPolicyProfile.displayName,
|
|
213
|
-
blockingSeverities: selectedPolicyProfile.blockingSeverities,
|
|
214
|
-
ciGuardrailsEnabled: null,
|
|
215
|
-
},
|
|
216
|
-
majorConstraints: detectionMajorConstraints,
|
|
217
|
-
quickConfirmation: {
|
|
218
|
-
offered: false,
|
|
219
|
-
response: projectDetection.hasExistingProjectFiles ? 'pending' : 'not-applicable',
|
|
220
|
-
source: 'existing-project-detection',
|
|
221
|
-
},
|
|
222
|
-
decision: {
|
|
223
|
-
mode: projectDetection.hasExistingProjectFiles ? 'pending' : 'fresh-directory',
|
|
224
|
-
selectedStackFileName: null,
|
|
225
|
-
selectedBlueprintFileName: null,
|
|
226
|
-
},
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
if (projectDetection.hasExistingProjectFiles) {
|
|
230
|
-
console.log('\nExisting project detection transparency:');
|
|
231
|
-
|
|
232
|
-
if (projectDetection.detectedStackFileName) {
|
|
233
|
-
const confidenceScoreLabel = Number(projectDetection.confidenceScore || 0).toFixed(2);
|
|
234
|
-
console.log(
|
|
235
|
-
`- Detected stack: ${toTitleCase(projectDetection.detectedStackFileName)} (${projectDetection.confidenceLabel}, score ${confidenceScoreLabel})`
|
|
236
|
-
);
|
|
237
|
-
|
|
238
|
-
if (projectDetection.secondaryStackFileNames?.length) {
|
|
239
|
-
console.log(
|
|
240
|
-
`- Secondary stack signals: ${projectDetection.secondaryStackFileNames.map((stackFileName) => toTitleCase(stackFileName)).join(', ')}`
|
|
241
|
-
);
|
|
242
|
-
}
|
|
243
|
-
} else {
|
|
244
|
-
console.log('- Detected stack: unresolved (insufficient markers).');
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
console.log('- Active rules baseline: canonical AGENTS.md + .agent-context/ lazy rule library');
|
|
248
|
-
console.log(
|
|
249
|
-
`- Active review thresholds: ${formatBlockingSeverities(selectedPolicyProfile.blockingSeverities)}`
|
|
250
|
-
);
|
|
251
|
-
console.log('- Major constraints:');
|
|
252
|
-
for (const majorConstraint of detectionMajorConstraints) {
|
|
253
|
-
console.log(` - ${majorConstraint}`);
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
const hasReliableDetectedStack = projectDetection.hasExistingProjectFiles
|
|
258
|
-
&& projectDetection.detectedStackFileName
|
|
259
|
-
&& (projectDetection.confidenceLabel === 'high' || projectDetection.confidenceLabel === 'medium');
|
|
260
|
-
|
|
261
|
-
const shouldAutoApplyDetectedStack = false;
|
|
262
|
-
let selectedManualStackFileName = null;
|
|
263
|
-
let selectedManualBlueprintFileName = null;
|
|
264
|
-
let selectedAdditionalStackFileNames = [];
|
|
265
|
-
let selectedAdditionalBlueprintFileNames = [];
|
|
266
|
-
let detectedSetupWasApplied = false;
|
|
267
|
-
let selectedProjectScopeKey = 'both';
|
|
268
|
-
let selectedProjectScopeLabel = resolveProjectScopeLabelFromKey('both');
|
|
269
|
-
let projectDescriptionHint = String(initOptions.projectDescription || '').trim();
|
|
270
|
-
let discoveryAnswers = null;
|
|
271
|
-
const ciGuardrailsSelection = resolveSilentCiGuardrailsDefault({
|
|
272
|
-
initOptions,
|
|
273
|
-
selectedPreset,
|
|
274
|
-
selectedPolicyProfile,
|
|
275
|
-
});
|
|
276
|
-
const isFreshProjectTarget = !projectDetection.hasExistingProjectFiles
|
|
277
|
-
&& wasDirectoryEffectivelyEmpty
|
|
278
|
-
&& !hadExistingProjectDocsBeforeInit;
|
|
279
|
-
const shouldRunInteractiveScaffolding = isInteractiveSession
|
|
280
|
-
&& (initOptions.scaffoldDocs === true || (initOptions.scaffoldDocs !== false && isFreshProjectTarget));
|
|
281
|
-
|
|
282
|
-
if (projectDetection.hasExistingProjectFiles && !projectDescriptionHint) {
|
|
283
|
-
projectDescriptionHint = await inferExistingProjectDescriptionHint(resolvedTargetDirectoryPath);
|
|
284
|
-
if (projectDescriptionHint) {
|
|
285
|
-
console.log(`- Project context evidence: ${projectDescriptionHint}`);
|
|
286
|
-
} else {
|
|
287
|
-
console.log('- Project context evidence: unresolved from lightweight file scan; agent must inspect project files before coding.');
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
detectionTransparency.projectContextEvidence = projectDescriptionHint || null;
|
|
291
|
-
|
|
292
|
-
const detectedSetupDecision = await resolveDetectedSetupDecision({
|
|
293
|
-
shouldAutoApplyDetectedStack,
|
|
294
|
-
projectDetection,
|
|
295
|
-
detectionTransparency,
|
|
296
|
-
initialSelectedManualStackFileName: selectedManualStackFileName,
|
|
297
|
-
initialSelectedManualBlueprintFileName: selectedManualBlueprintFileName,
|
|
298
|
-
initialSelectedAdditionalStackFileNames: selectedAdditionalStackFileNames,
|
|
299
|
-
});
|
|
300
|
-
|
|
301
|
-
detectedSetupWasApplied = detectedSetupDecision.detectedSetupWasApplied;
|
|
302
|
-
selectedManualStackFileName = detectedSetupDecision.selectedManualStackFileName;
|
|
303
|
-
selectedManualBlueprintFileName = detectedSetupDecision.selectedManualBlueprintFileName;
|
|
304
|
-
selectedAdditionalStackFileNames = detectedSetupDecision.selectedAdditionalStackFileNames;
|
|
305
|
-
if (initOptions.projectConfig) {
|
|
306
|
-
discoveryAnswers = await loadProjectConfig(initOptions.projectConfig);
|
|
307
|
-
console.log(`\nLoaded project configuration from: ${initOptions.projectConfig}`);
|
|
308
|
-
} else if (shouldRunInteractiveScaffolding) {
|
|
309
|
-
discoveryAnswers = await runProjectDiscovery(userInterface, {
|
|
310
|
-
defaultProjectName: path.basename(resolvedTargetDirectoryPath),
|
|
311
|
-
defaultProjectDescription: projectDescriptionHint,
|
|
312
|
-
defaultIncludeCiGuardrails: ciGuardrailsSelection.value,
|
|
313
|
-
askForCiGuardrails: ciGuardrailsSelection.shouldAsk,
|
|
314
|
-
});
|
|
315
|
-
} else if (initOptions.scaffoldDocs === true && !isInteractiveSession) {
|
|
316
|
-
throw new Error('Non-interactive scaffolding requires --project-config when --scaffold-docs is enabled.');
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
if (discoveryAnswers?.projectDescription) {
|
|
320
|
-
projectDescriptionHint = discoveryAnswers.projectDescription;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
if (discoveryAnswers) {
|
|
324
|
-
selectedProjectScopeKey = inferProjectScopeFromDiscoveryAnswers(discoveryAnswers);
|
|
325
|
-
selectedProjectScopeLabel = resolveProjectScopeLabelFromKey(selectedProjectScopeKey);
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
const selectedResolvedStackFileName = selectedStackFileNameFromOption
|
|
329
|
-
|| selectedManualStackFileName
|
|
330
|
-
|| selectedPolicyProfile.defaultStackFileName
|
|
331
|
-
|| AGENT_DECISION_STACK_FILE_NAME;
|
|
332
|
-
|
|
333
|
-
selectedAdditionalStackFileNames = normalizeAdditionalStackSelection(
|
|
334
|
-
selectedResolvedStackFileName,
|
|
335
|
-
selectedAdditionalStackFileNames
|
|
336
|
-
);
|
|
337
|
-
|
|
338
|
-
const selectedResolvedBlueprintFileName = selectedBlueprintFileNameFromOption
|
|
339
|
-
|| selectedManualBlueprintFileName
|
|
340
|
-
|| selectedPolicyProfile.defaultBlueprintFileName
|
|
341
|
-
|| AGENT_DECISION_BLUEPRINT_FILE_NAME;
|
|
342
|
-
|
|
343
|
-
selectedAdditionalBlueprintFileNames = normalizeAdditionalBlueprintSelection(
|
|
344
|
-
selectedResolvedBlueprintFileName,
|
|
345
|
-
selectedAdditionalBlueprintFileNames.length > 0
|
|
346
|
-
? selectedAdditionalBlueprintFileNames
|
|
347
|
-
: []
|
|
348
|
-
);
|
|
349
|
-
|
|
350
|
-
detectionTransparency.decision.selectedStackFileName = selectedResolvedStackFileName;
|
|
351
|
-
detectionTransparency.decision.selectedBlueprintFileName = selectedResolvedBlueprintFileName;
|
|
352
|
-
detectionTransparency.decision.selectedAdditionalStackFileNames = selectedAdditionalStackFileNames;
|
|
353
|
-
detectionTransparency.decision.selectedAdditionalBlueprintFileNames = selectedAdditionalBlueprintFileNames;
|
|
354
|
-
detectionTransparency.decision.usedDetectedSetup = detectedSetupWasApplied;
|
|
355
|
-
|
|
356
|
-
const includeCiGuardrails = typeof discoveryAnswers?.includeCiGuardrails === 'boolean'
|
|
357
|
-
? discoveryAnswers.includeCiGuardrails
|
|
358
|
-
: ciGuardrailsSelection.shouldAsk
|
|
359
|
-
? (!isInteractiveSession
|
|
360
|
-
? ciGuardrailsSelection.value
|
|
361
|
-
: await askYesNo(
|
|
362
|
-
'Enable CI/CD quality checks (guardrails) and the LLM Judge policy?',
|
|
363
|
-
userInterface,
|
|
364
|
-
ciGuardrailsSelection.value
|
|
365
|
-
))
|
|
366
|
-
: ciGuardrailsSelection.value;
|
|
367
|
-
|
|
368
|
-
detectionTransparency.activeRulesSummary.ciGuardrailsEnabled = includeCiGuardrails;
|
|
369
|
-
|
|
370
|
-
detectionTransparency.decision.selectedProjectScopeKey = selectedProjectScopeKey;
|
|
371
|
-
detectionTransparency.decision.selectedProjectScopeLabel = selectedProjectScopeLabel;
|
|
372
|
-
|
|
373
|
-
await createBackup(resolvedTargetDirectoryPath);
|
|
374
|
-
const backupGitignoreResult = await ensureBackupGitignoreEntry(resolvedTargetDirectoryPath);
|
|
375
|
-
if (backupGitignoreResult.status !== 'unchanged') {
|
|
376
|
-
console.log(`Local backup artifacts ignored in .gitignore (${backupGitignoreResult.entry}).`);
|
|
377
|
-
}
|
|
378
|
-
const runtimeArtifactGitignoreResult = await ensureRuntimeArtifactGitignoreEntries(resolvedTargetDirectoryPath);
|
|
379
|
-
if (runtimeArtifactGitignoreResult.status !== 'unchanged') {
|
|
380
|
-
console.log(
|
|
381
|
-
`Local runtime artifacts ignored in .gitignore (${runtimeArtifactGitignoreResult.addedEntries.join(', ')}).`
|
|
382
|
-
);
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
const shouldKeepLocalOnly = typeof initOptions.localOnly === 'boolean'
|
|
386
|
-
? initOptions.localOnly
|
|
387
|
-
: isInteractiveSession
|
|
388
|
-
? await askYesNo(
|
|
389
|
-
'Add AI instructions and governance files to .gitignore? (Prevents pushing them to GitHub/Git)',
|
|
390
|
-
userInterface,
|
|
391
|
-
false
|
|
392
|
-
)
|
|
393
|
-
: false;
|
|
394
|
-
|
|
395
|
-
if (shouldKeepLocalOnly) {
|
|
396
|
-
const localGovernanceGitignoreResult = await ensureLocalGovernanceGitignoreEntries(resolvedTargetDirectoryPath);
|
|
397
|
-
if (localGovernanceGitignoreResult.status !== 'unchanged') {
|
|
398
|
-
console.log(
|
|
399
|
-
`AI governance files ignored in .gitignore (${localGovernanceGitignoreResult.addedEntries.join(', ')}).`
|
|
400
|
-
);
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
await copyGovernanceAssetsToTarget(resolvedTargetDirectoryPath, {
|
|
405
|
-
includeMcpTemplate: shouldIncludeMcpTemplate,
|
|
406
|
-
});
|
|
407
|
-
|
|
408
|
-
let memoryContinuityState = null;
|
|
409
|
-
if (isMemoryContinuityEnabled) {
|
|
410
|
-
memoryContinuityState = createMemoryContinuityState({
|
|
411
|
-
isEnabled: true,
|
|
412
|
-
});
|
|
413
|
-
|
|
414
|
-
await writeMemoryContinuityState(resolvedTargetDirectoryPath, memoryContinuityState);
|
|
415
|
-
await ensureActiveMemorySnapshot(resolvedTargetDirectoryPath, {
|
|
416
|
-
projectName: path.basename(resolvedTargetDirectoryPath),
|
|
417
|
-
});
|
|
418
|
-
console.log(`Project memory continuity metadata enabled (${memoryContinuityState.hydrationMode}, host-supported).`);
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
let tokenOptimizationState = null;
|
|
422
|
-
if (isTokenOptimizationEnabled) {
|
|
423
|
-
const detectedExternalProxy = detectRtkBinary();
|
|
424
|
-
tokenOptimizationState = createTokenOptimizationState({
|
|
425
|
-
isEnabled: true,
|
|
426
|
-
selectedAgentName: selectedTokenAgentName,
|
|
427
|
-
rtkDetection: detectedExternalProxy,
|
|
428
|
-
});
|
|
429
|
-
|
|
430
|
-
await writeTokenOptimizationState(resolvedTargetDirectoryPath, tokenOptimizationState);
|
|
431
|
-
console.log(
|
|
432
|
-
`Token optimization policy enabled for agent ${tokenOptimizationState.selectedAgent} (${tokenOptimizationState.preferredShellProxy}).`
|
|
433
|
-
);
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
// --- Project Documentation Scaffolding ---
|
|
437
|
-
let scaffoldingResult = null;
|
|
438
|
-
const supplementalMaterializedDocFileNames = [];
|
|
439
|
-
if (discoveryAnswers) {
|
|
440
|
-
const normalizedConfigDocsLanguage = normalizeDocsLanguage(discoveryAnswers.docsLang || '');
|
|
441
|
-
if (discoveryAnswers.docsLang && !normalizedConfigDocsLanguage) {
|
|
442
|
-
throw new Error(`Unsupported docs language in project config: ${discoveryAnswers.docsLang}. Supported values: en, id`);
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
// Keep generated docs in English by default to align with the writing scope.
|
|
446
|
-
// A different output language is only used when explicitly requested via --docs-lang.
|
|
447
|
-
const selectedDocsLanguage = initOptions.docsLang;
|
|
448
|
-
|
|
449
|
-
if (!initOptions.docsLangProvided && normalizedConfigDocsLanguage && normalizedConfigDocsLanguage !== 'en') {
|
|
450
|
-
console.log('[INFO] Project config docsLang is set, but output defaults to English. Use --docs-lang to override.');
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
scaffoldingResult = await generateProjectDocumentation(
|
|
454
|
-
resolvedTargetDirectoryPath,
|
|
455
|
-
discoveryAnswers,
|
|
456
|
-
{
|
|
457
|
-
stackFileName: selectedResolvedStackFileName,
|
|
458
|
-
additionalStackFileNames: selectedAdditionalStackFileNames,
|
|
459
|
-
blueprintFileName: selectedResolvedBlueprintFileName,
|
|
460
|
-
additionalBlueprintFileNames: selectedAdditionalBlueprintFileNames,
|
|
461
|
-
runtimeEnvironmentKey: selectedRuntimeEnvironmentKey,
|
|
462
|
-
runtimeEnvironmentLabel: resolveRuntimeEnvironmentLabelFromKey(selectedRuntimeEnvironmentKey),
|
|
463
|
-
},
|
|
464
|
-
{
|
|
465
|
-
docsLanguage: selectedDocsLanguage,
|
|
466
|
-
}
|
|
467
|
-
);
|
|
468
|
-
|
|
469
|
-
if (scaffoldingResult.bootstrapMode === 'ai-synthesis') {
|
|
470
|
-
console.log(`\nAI synthesis bootstrap prompts generated in .agent-context/prompts/:`);
|
|
471
|
-
for (const generatedPromptFileName of scaffoldingResult.generatedPromptFileNames || []) {
|
|
472
|
-
console.log(` - .agent-context/prompts/${generatedPromptFileName}`);
|
|
473
|
-
}
|
|
474
|
-
for (const materializedFileName of scaffoldingResult.materializedFileNames || []) {
|
|
475
|
-
console.log(` - docs/${materializedFileName}`);
|
|
476
|
-
}
|
|
477
|
-
console.log('Project docs will be authored dynamically by your IDE assistant from these prompts.');
|
|
478
|
-
} else {
|
|
479
|
-
console.log(`\nProject documentation generated in docs/:`);
|
|
480
|
-
for (const generatedFileName of scaffoldingResult.generatedFileNames) {
|
|
481
|
-
console.log(` - docs/${generatedFileName}`);
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
const existingProjectUiScopeSignals = projectDetection.hasExistingProjectFiles
|
|
487
|
-
? await detectUiScopeSignals({
|
|
488
|
-
targetDirectoryPath: resolvedTargetDirectoryPath,
|
|
489
|
-
selectedStackFileName: selectedResolvedStackFileName,
|
|
490
|
-
selectedBlueprintFileName: selectedResolvedBlueprintFileName,
|
|
491
|
-
})
|
|
492
|
-
: null;
|
|
493
|
-
const obsoleteDesignIntentPath = path.join(resolvedTargetDirectoryPath, 'docs', 'design-intent.json');
|
|
494
|
-
if (await pathExists(obsoleteDesignIntentPath)) {
|
|
495
|
-
try {
|
|
496
|
-
await fs.unlink(obsoleteDesignIntentPath);
|
|
497
|
-
supplementalMaterializedDocFileNames.push('design-intent.json (DELETED - Obsolete Compliance Theater)');
|
|
498
|
-
console.log('\n[CLEANUP] Removed obsolete docs/design-intent.json. The 2026 Context Ops Paradigm uses plain-text DESIGN.md only.');
|
|
499
|
-
} catch (err) {
|
|
500
|
-
// ignore error
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
await writeSelectedPolicy(resolvedTargetDirectoryPath, selectedPolicyProfileName);
|
|
505
|
-
|
|
506
|
-
const setupDurationMs = Date.now() - setupStartedAt;
|
|
507
|
-
await writeOnboardingReport({
|
|
508
|
-
targetDirectoryPath: resolvedTargetDirectoryPath,
|
|
509
|
-
selectedProfileName: selectedPolicyProfileName,
|
|
510
|
-
selectedPreset: initOptions.preset || null,
|
|
511
|
-
projectScope: {
|
|
512
|
-
key: selectedProjectScopeKey,
|
|
513
|
-
label: selectedProjectScopeLabel,
|
|
514
|
-
},
|
|
515
|
-
projectTopology: discoveryAnswers?.architectureStyle || null,
|
|
516
|
-
selectedStackFileName: selectedResolvedStackFileName,
|
|
517
|
-
selectedAdditionalStackFileNames,
|
|
518
|
-
selectedBlueprintFileName: selectedResolvedBlueprintFileName,
|
|
519
|
-
selectedAdditionalBlueprintFileNames,
|
|
520
|
-
includeCiGuardrails,
|
|
521
|
-
localOnly: shouldKeepLocalOnly,
|
|
522
|
-
setupDurationMs,
|
|
523
|
-
projectDetection,
|
|
524
|
-
runtimeEnvironment: {
|
|
525
|
-
selected: selectedRuntimeEnvironmentKey,
|
|
526
|
-
selectedLabel: resolveRuntimeEnvironmentLabelFromKey(selectedRuntimeEnvironmentKey),
|
|
527
|
-
detected: detectedRuntimeEnvironment.key,
|
|
528
|
-
detectedLabel: detectedRuntimeEnvironment.label,
|
|
529
|
-
detectionSource: detectedRuntimeEnvironment.source,
|
|
530
|
-
},
|
|
531
|
-
dockerStrategy: discoveryAnswers?.dockerStrategy || null,
|
|
532
|
-
operationMode: 'init',
|
|
533
|
-
tokenOptimization: {
|
|
534
|
-
enabled: isTokenOptimizationEnabled,
|
|
535
|
-
selectedAgent: selectedTokenAgentName,
|
|
536
|
-
preferredShellProxy: tokenOptimizationState?.preferredShellProxy || null,
|
|
537
|
-
stateFile: isTokenOptimizationEnabled ? '.agent-context/state/token-optimization.json' : null,
|
|
538
|
-
},
|
|
539
|
-
memoryContinuity: {
|
|
540
|
-
enabled: isMemoryContinuityEnabled,
|
|
541
|
-
hydrationMode: memoryContinuityState?.hydrationMode || null,
|
|
542
|
-
adapters: memoryContinuityState?.adapters || [],
|
|
543
|
-
stateFile: isMemoryContinuityEnabled ? '.agent-context/state/memory-continuity.json' : null,
|
|
544
|
-
activeSnapshotFile: isMemoryContinuityEnabled ? '.agent-context/state/active-memory.json' : null,
|
|
545
|
-
},
|
|
546
|
-
detectionTransparency,
|
|
547
|
-
uiScopeSignals: existingProjectUiScopeSignals,
|
|
548
|
-
});
|
|
549
|
-
|
|
550
|
-
console.log('\nInitialization complete.');
|
|
551
|
-
console.log(`- Target directory: ${resolvedTargetDirectoryPath}`);
|
|
552
|
-
if (initOptions.preset) {
|
|
553
|
-
console.log(`- Preset: ${initOptions.preset}`);
|
|
554
|
-
}
|
|
555
|
-
if (!projectDetection.hasExistingProjectFiles) {
|
|
556
|
-
console.log(`- Project domain: ${selectedProjectScopeLabel}`);
|
|
557
|
-
if (discoveryAnswers?.architectureStyle) {
|
|
558
|
-
console.log(`- Project topology: ${discoveryAnswers.architectureStyle}`);
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
console.log(`- Runtime decision: ${selectedResolvedStackFileName === AGENT_DECISION_STACK_FILE_NAME ? 'agent recommendation required from current repo/brief evidence' : toTitleCase(selectedResolvedStackFileName)}`);
|
|
562
|
-
if (selectedAdditionalStackFileNames.length > 0) {
|
|
563
|
-
console.log(`- Additional stacks: ${selectedAdditionalStackFileNames.map((stackFileName) => toTitleCase(stackFileName)).join(', ')}`);
|
|
564
|
-
}
|
|
565
|
-
console.log(`- Architecture decision: ${selectedResolvedBlueprintFileName === AGENT_DECISION_BLUEPRINT_FILE_NAME ? 'agent recommendation required from current repo/brief evidence' : toTitleCase(selectedResolvedBlueprintFileName)}`);
|
|
566
|
-
if (selectedAdditionalBlueprintFileNames.length > 0) {
|
|
567
|
-
console.log(`- Additional blueprints: ${selectedAdditionalBlueprintFileNames.map((blueprintFileName) => toTitleCase(blueprintFileName)).join(', ')}`);
|
|
568
|
-
}
|
|
569
|
-
console.log(`- Runtime environment: ${resolveRuntimeEnvironmentLabelFromKey(selectedRuntimeEnvironmentKey)} (detected: ${detectedRuntimeEnvironment.label})`);
|
|
570
|
-
console.log(`- CI/CD quality checks (guardrails): ${includeCiGuardrails ? 'enabled' : 'disabled'}`);
|
|
571
|
-
console.log(`- Review thresholds: ${formatBlockingSeverities(selectedPolicyProfile.blockingSeverities)}`);
|
|
572
|
-
console.log(`- Setup time: ${formatDuration(setupDurationMs)}`);
|
|
573
|
-
console.log('- Generated files: AGENTS.md, CLAUDE.md, GEMINI.md, .agent-context/, and .agent-context/state/onboarding-report.json');
|
|
574
|
-
console.log('- Default activation cues: Adaptive Context bootstrap, ASCX command wrappers, Compact Natural final replies');
|
|
575
|
-
console.log('- Default response mode: Compact Natural Mode enabled (.agent-context/prompts/compact-natural-mode.md)');
|
|
576
|
-
console.log('- CLI Usage: Install globally (`npm i -g @ryuenn3123/agentic-senior-core`) to use `ascx` directly, or prefix commands with `npx`.');
|
|
577
|
-
if (scaffoldingResult?.bootstrapMode === 'ai-synthesis') {
|
|
578
|
-
console.log(`- Bootstrap prompts: ${(scaffoldingResult.generatedPromptFileNames || []).length} files generated in .agent-context/prompts/`);
|
|
579
|
-
if ((scaffoldingResult.materializedFileNames || []).length > 0) {
|
|
580
|
-
console.log(`- Seed docs: ${(scaffoldingResult.materializedFileNames || []).length} files generated in docs/`);
|
|
581
|
-
}
|
|
582
|
-
console.log(`- Bootstrap docs language: ${scaffoldingResult.docsLanguage}`);
|
|
583
|
-
console.log(`- Expected project docs after synthesis: ${scaffoldingResult.generatedFileNames.length} files in docs/`);
|
|
584
|
-
} else if (scaffoldingResult) {
|
|
585
|
-
console.log(`- Project docs: ${scaffoldingResult.generatedFileNames.length} files generated in docs/`);
|
|
586
|
-
console.log(`- Project docs language: ${scaffoldingResult.docsLanguage}`);
|
|
587
|
-
}
|
|
588
|
-
if (supplementalMaterializedDocFileNames.length > 0) {
|
|
589
|
-
console.log(`- Design seed docs: ${supplementalMaterializedDocFileNames.length} files generated in docs/`);
|
|
590
|
-
}
|
|
591
|
-
console.log(`- Repository workflows copied: no (workflows remain source-repo assets)`);
|
|
592
|
-
console.log(`- MCP configuration: ${shouldIncludeMcpTemplate ? 'auto-configured for your IDEs (VS Code, Cursor, Zed, Gemini)' : 'disabled (use --mcp-template to enable)'}`);
|
|
593
|
-
if (isMemoryContinuityEnabled) {
|
|
594
|
-
console.log('- Memory continuity policy: enabled (index + selective hydration; host support required)');
|
|
595
|
-
} else {
|
|
596
|
-
console.log('- Memory continuity policy: disabled (--no-memory-continuity)');
|
|
597
|
-
}
|
|
598
|
-
if (isTokenOptimizationEnabled) {
|
|
599
|
-
console.log(`- Token optimization policy: enabled for ${selectedTokenAgentName} (ASCX command guidance on)`);
|
|
600
|
-
} else {
|
|
601
|
-
console.log('- Token optimization policy: disabled (--no-token-optimize)');
|
|
602
|
-
}
|
|
603
|
-
console.log('\nPlain-language summary:');
|
|
604
|
-
if (selectedResolvedStackFileName === AGENT_DECISION_STACK_FILE_NAME || selectedResolvedBlueprintFileName === AGENT_DECISION_BLUEPRINT_FILE_NAME) {
|
|
605
|
-
console.log('I prepared a repo-grounded guidance pack that asks your AI agent to recommend runtime and architecture choices from the current brief, repo evidence, and live research before coding.');
|
|
606
|
-
} else {
|
|
607
|
-
console.log(`I prepared a repo-grounded guidance pack using your explicit runtime constraint (${toTitleCase(selectedResolvedStackFileName)}) and architecture constraint (${toTitleCase(selectedResolvedBlueprintFileName)}).`);
|
|
608
|
-
}
|
|
609
|
-
if (selectedAdditionalStackFileNames.length > 0) {
|
|
610
|
-
console.log(`I also included additional stack context for ${selectedAdditionalStackFileNames.map((stackFileName) => toTitleCase(stackFileName)).join(', ')}.`);
|
|
611
|
-
}
|
|
612
|
-
if (selectedAdditionalBlueprintFileNames.length > 0) {
|
|
613
|
-
console.log(`I also included additional blueprint context for ${selectedAdditionalBlueprintFileNames.map((blueprintFileName) => toTitleCase(blueprintFileName)).join(', ')}.`);
|
|
614
|
-
}
|
|
615
|
-
if (scaffoldingResult?.bootstrapMode === 'ai-synthesis') {
|
|
616
|
-
console.log(`I prepared dynamic synthesis bootstrap prompts (${scaffoldingResult.docsLanguage}) so your IDE assistant can author project docs from scratch on first chat.`);
|
|
617
|
-
|
|
618
|
-
const promptProjectName = scaffoldingResult.discoveryAnswers?.projectName || 'this project';
|
|
619
|
-
console.log('\nPrompt starter examples (copy and adapt in your IDE):');
|
|
620
|
-
console.log('- If docs/project-brief.md is missing, execute .agent-context/prompts/bootstrap-project-context.md now and create all required docs files.');
|
|
621
|
-
if ((scaffoldingResult.generatedPromptFileNames || []).includes('bootstrap-design.md')) {
|
|
622
|
-
console.log('- If docs/DESIGN.md is missing, execute .agent-context/prompts/bootstrap-design.md now before building UI components.');
|
|
623
|
-
}
|
|
624
|
-
console.log(`- Build an MVP for ${promptProjectName} using the newly synthesized docs as strict project context.`);
|
|
625
|
-
console.log('- When scope changes, update docs/* in the same change so future prompts stay aligned.');
|
|
626
|
-
} else if (scaffoldingResult) {
|
|
627
|
-
console.log(`I also generated project documentation (${scaffoldingResult.docsLanguage}) based on your project description. AI agents will use docs/ as project context.`);
|
|
628
|
-
|
|
629
|
-
const promptProjectName = scaffoldingResult.discoveryAnswers?.projectName || 'this project';
|
|
630
|
-
console.log('\nPrompt starter examples (copy and adapt in your IDE):');
|
|
631
|
-
console.log(`- Build an MVP for ${promptProjectName}. Follow Layer 9 docs and keep the current stack, database, and auth constraints.`);
|
|
632
|
-
console.log('- Add [new feature] and update docs/project-brief.md plus docs/flow-overview.md in the same change.');
|
|
633
|
-
console.log('- If this change needs architecture migration, propose a migration plan first, then implement after approval.');
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
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.');
|
|
637
|
-
console.log('MCP server registration is manual inside your IDE settings, even when mcp.json exists.');
|
|
638
|
-
} catch (error) {
|
|
639
|
-
console.error('\n[FATAL] An error occurred during initialization. Attempting automatic rollback...');
|
|
640
|
-
try {
|
|
641
|
-
const rollbackReport = await performRollback(resolvedTargetDirectoryPath);
|
|
642
|
-
if (rollbackReport.success) {
|
|
643
|
-
console.error('[OK] Automatic rollback successful. The directory has been restored.');
|
|
644
|
-
} else {
|
|
645
|
-
console.error('[WARN] Automatic rollback completed with errors. You may need to manually clean up.');
|
|
646
|
-
}
|
|
647
|
-
} catch (rbError) {
|
|
648
|
-
console.error(`[FATAL] Automatic rollback failed: ${rbError.message}`);
|
|
649
|
-
}
|
|
650
|
-
throw error;
|
|
651
|
-
} finally {
|
|
652
|
-
userInterface.close();
|
|
653
|
-
}
|
|
654
|
-
}
|