@ryuenn3123/agentic-senior-core 3.0.14 → 3.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/.agent-context/prompts/bootstrap-design.md +30 -16
  2. package/.agent-context/prompts/init-project.md +4 -0
  3. package/.agent-context/rules/architecture.md +13 -0
  4. package/.agent-context/rules/docker-runtime.md +12 -0
  5. package/.agent-context/rules/efficiency-vs-hype.md +17 -6
  6. package/.agent-context/rules/frontend-architecture.md +5 -0
  7. package/.agent-context/state/memory-continuity-benchmark.json +1 -1
  8. package/.agent-context/state/onboarding-report.json +0 -1
  9. package/.cursorrules +66 -29
  10. package/.gemini/instructions.md +1 -1
  11. package/.github/copilot-instructions.md +1 -1
  12. package/.instructions.md +4 -3
  13. package/.windsurfrules +66 -29
  14. package/AGENTS.md +1 -1
  15. package/lib/cli/architect.mjs +71 -784
  16. package/lib/cli/commands/init.mjs +32 -98
  17. package/lib/cli/commands/optimize.mjs +0 -4
  18. package/lib/cli/commands/upgrade.mjs +2 -5
  19. package/lib/cli/compiler.mjs +3 -11
  20. package/lib/cli/constants.mjs +3 -73
  21. package/lib/cli/detector/design-evidence.mjs +427 -0
  22. package/lib/cli/detector.mjs +13 -116
  23. package/lib/cli/init-options.mjs +0 -118
  24. package/lib/cli/project-scaffolder/constants.mjs +67 -0
  25. package/lib/cli/project-scaffolder/design-contract.mjs +554 -0
  26. package/lib/cli/project-scaffolder/discovery.mjs +315 -0
  27. package/lib/cli/project-scaffolder/prompt-builders.mjs +196 -0
  28. package/lib/cli/project-scaffolder/storage.mjs +154 -0
  29. package/lib/cli/project-scaffolder.mjs +32 -1160
  30. package/lib/cli/utils.mjs +2 -11
  31. package/package.json +1 -1
  32. package/scripts/frontend-usability-audit.mjs +53 -0
  33. package/scripts/validate/config.mjs +401 -0
  34. package/scripts/validate/coverage-checks.mjs +429 -0
  35. package/scripts/validate.mjs +44 -754
  36. package/lib/cli/init-architecture-flow.mjs +0 -233
  37. package/lib/cli/profile-packs.mjs +0 -108
@@ -0,0 +1,429 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { join, relative } from 'node:path';
3
+ import {
4
+ COMPLIANCE_ALIAS_TERMS,
5
+ COMPLIANCE_TERMINOLOGY_BOUNDARY_PATHS,
6
+ FORMAL_ARTIFACT_PATHS,
7
+ FORBIDDEN_TEMPLATE_BOOTSTRAP_SNIPPETS,
8
+ REQUIRED_COMPLIANCE_CANONICAL_SNIPPETS,
9
+ REQUIRED_DEPENDENCY_FRESHNESS_AUTOMATION_SNIPPETS,
10
+ REQUIRED_DETECTION_TRANSPARENCY_SNIPPETS,
11
+ REQUIRED_DETERMINISTIC_BOUNDARY_ENFORCEMENT_SNIPPETS,
12
+ REQUIRED_DEVELOPER_FIRST_MENTION_PATTERNS,
13
+ REQUIRED_DOCKER_RUNTIME_AUTOMATION_SNIPPETS,
14
+ REQUIRED_HUMAN_WRITING_SNIPPETS,
15
+ REQUIRED_STACK_RESEARCH_ENGINE_SNIPPETS,
16
+ REQUIRED_TEMPLATE_FREE_BOOTSTRAP_SNIPPETS,
17
+ REQUIRED_TERMINOLOGY_ROW_PATTERNS,
18
+ REQUIRED_TERMINOLOGY_RULE_SNIPPET,
19
+ REQUIRED_UI_DESIGN_AUTOMATION_SNIPPETS,
20
+ REQUIRED_UNIVERSAL_SOP_SNIPPETS,
21
+ REQUIRED_UPGRADE_UI_CONTRACT_WARNING_SNIPPETS,
22
+ TERMINOLOGY_REFERENCE_DOCUMENT_PATH,
23
+ TERMINOLOGY_REFERENCE_PATHS,
24
+ THIN_ADAPTER_PATHS,
25
+ } from './config.mjs';
26
+
27
+ async function validateSnippetCoverage({
28
+ heading,
29
+ coverageRules,
30
+ missingLabel,
31
+ snippetLabel,
32
+ context,
33
+ }) {
34
+ const { ROOT_DIR, fileExists, readTextFile, pass, fail } = context;
35
+
36
+ console.log(`\n${heading}`);
37
+
38
+ for (const coverageRule of coverageRules) {
39
+ const absoluteCoveragePath = join(ROOT_DIR, coverageRule.path);
40
+
41
+ if (!(await fileExists(absoluteCoveragePath))) {
42
+ fail(`Missing ${missingLabel}: ${coverageRule.path}`);
43
+ continue;
44
+ }
45
+
46
+ const coverageContent = await readTextFile(absoluteCoveragePath);
47
+ for (const requiredSnippet of coverageRule.snippets) {
48
+ if (coverageContent.includes(requiredSnippet)) {
49
+ pass(`${coverageRule.path} includes ${snippetLabel}: ${requiredSnippet}`);
50
+ } else {
51
+ fail(`${coverageRule.path} is missing ${snippetLabel}: ${requiredSnippet}`);
52
+ }
53
+ }
54
+ }
55
+ }
56
+
57
+ export async function validateTerminologyMapping(context) {
58
+ const { ROOT_DIR, fileExists, readTextFile, pass, fail } = context;
59
+
60
+ console.log('\nChecking terminology mapping consistency...');
61
+
62
+ const terminologyReferenceDocumentPath = join(ROOT_DIR, TERMINOLOGY_REFERENCE_DOCUMENT_PATH);
63
+
64
+ if (!(await fileExists(terminologyReferenceDocumentPath))) {
65
+ fail(`Missing terminology reference document: ${TERMINOLOGY_REFERENCE_DOCUMENT_PATH}`);
66
+ } else {
67
+ const terminologyReferenceContent = await readTextFile(terminologyReferenceDocumentPath);
68
+
69
+ if (terminologyReferenceContent.includes('Dual-Term Mapping')) {
70
+ pass(`${TERMINOLOGY_REFERENCE_DOCUMENT_PATH} includes Dual-Term Mapping section`);
71
+ } else {
72
+ fail(`${TERMINOLOGY_REFERENCE_DOCUMENT_PATH} must include Dual-Term Mapping section`);
73
+ }
74
+
75
+ for (const terminologyRowRule of REQUIRED_TERMINOLOGY_ROW_PATTERNS) {
76
+ if (terminologyRowRule.pattern.test(terminologyReferenceContent)) {
77
+ pass(`${TERMINOLOGY_REFERENCE_DOCUMENT_PATH} includes mapping row: ${terminologyRowRule.label}`);
78
+ } else {
79
+ fail(`${TERMINOLOGY_REFERENCE_DOCUMENT_PATH} is missing mapping row: ${terminologyRowRule.label}`);
80
+ }
81
+ }
82
+
83
+ if (terminologyReferenceContent.includes('first mention must include canonical term in parentheses')) {
84
+ pass(`${TERMINOLOGY_REFERENCE_DOCUMENT_PATH} defines first-mention canonical term rule`);
85
+ } else {
86
+ fail(`${TERMINOLOGY_REFERENCE_DOCUMENT_PATH} must define first-mention canonical term rule`);
87
+ }
88
+
89
+ if (terminologyReferenceContent.includes('Compliance and audit artifacts must keep canonical enterprise terminology')) {
90
+ pass(`${TERMINOLOGY_REFERENCE_DOCUMENT_PATH} defines compliance terminology boundary`);
91
+ } else {
92
+ fail(`${TERMINOLOGY_REFERENCE_DOCUMENT_PATH} must define compliance terminology boundary`);
93
+ }
94
+ }
95
+
96
+ for (const terminologyReferencePath of TERMINOLOGY_REFERENCE_PATHS) {
97
+ const absoluteReferencePath = join(ROOT_DIR, terminologyReferencePath);
98
+
99
+ if (!(await fileExists(absoluteReferencePath))) {
100
+ fail(`Missing terminology reference source: ${terminologyReferencePath}`);
101
+ continue;
102
+ }
103
+
104
+ const referenceContent = await readTextFile(absoluteReferencePath);
105
+
106
+ if (referenceContent.includes('Terminology Mapping (Final)')) {
107
+ pass(`${terminologyReferencePath} includes Terminology Mapping (Final)`);
108
+ } else {
109
+ fail(`${terminologyReferencePath} must include Terminology Mapping (Final)`);
110
+ }
111
+
112
+ for (const terminologyRowRule of REQUIRED_TERMINOLOGY_ROW_PATTERNS) {
113
+ if (terminologyRowRule.pattern.test(referenceContent)) {
114
+ pass(`${terminologyReferencePath} includes mapping row: ${terminologyRowRule.label}`);
115
+ } else {
116
+ fail(`${terminologyReferencePath} is missing mapping row: ${terminologyRowRule.label}`);
117
+ }
118
+ }
119
+
120
+ if (referenceContent.includes(REQUIRED_TERMINOLOGY_RULE_SNIPPET)) {
121
+ pass(`${terminologyReferencePath} includes first-mention canonical term rule`);
122
+ } else {
123
+ fail(`${terminologyReferencePath} must include first-mention canonical term rule`);
124
+ }
125
+
126
+ if (referenceContent.includes(TERMINOLOGY_REFERENCE_DOCUMENT_PATH)) {
127
+ pass(`${terminologyReferencePath} links to ${TERMINOLOGY_REFERENCE_DOCUMENT_PATH}`);
128
+ } else {
129
+ fail(`${terminologyReferencePath} must link to ${TERMINOLOGY_REFERENCE_DOCUMENT_PATH}`);
130
+ }
131
+ }
132
+
133
+ for (const firstMentionRule of REQUIRED_DEVELOPER_FIRST_MENTION_PATTERNS) {
134
+ const absoluteFirstMentionPath = join(ROOT_DIR, firstMentionRule.path);
135
+
136
+ if (!(await fileExists(absoluteFirstMentionPath))) {
137
+ fail(`Missing developer-facing first-mention source: ${firstMentionRule.path}`);
138
+ continue;
139
+ }
140
+
141
+ const firstMentionContent = await readTextFile(absoluteFirstMentionPath);
142
+ if (firstMentionRule.pattern.test(firstMentionContent)) {
143
+ pass(`${firstMentionRule.path} keeps first-mention rule: ${firstMentionRule.label}`);
144
+ } else {
145
+ fail(`${firstMentionRule.path} must keep first-mention rule: ${firstMentionRule.label}`);
146
+ }
147
+ }
148
+
149
+ for (const compliancePath of COMPLIANCE_TERMINOLOGY_BOUNDARY_PATHS) {
150
+ const absoluteCompliancePath = join(ROOT_DIR, compliancePath);
151
+
152
+ if (!(await fileExists(absoluteCompliancePath))) {
153
+ fail(`Missing compliance/audit artifact for terminology boundary: ${compliancePath}`);
154
+ continue;
155
+ }
156
+
157
+ const complianceContent = await readTextFile(absoluteCompliancePath);
158
+ for (const aliasTerm of COMPLIANCE_ALIAS_TERMS) {
159
+ if (complianceContent.includes(aliasTerm)) {
160
+ fail(`${compliancePath} must not use developer-facing alias in compliance context: ${aliasTerm}`);
161
+ } else {
162
+ pass(`${compliancePath} keeps canonical terminology boundary for alias: ${aliasTerm}`);
163
+ }
164
+ }
165
+ }
166
+
167
+ for (const complianceRule of REQUIRED_COMPLIANCE_CANONICAL_SNIPPETS) {
168
+ const absoluteComplianceRulePath = join(ROOT_DIR, complianceRule.path);
169
+
170
+ if (!(await fileExists(absoluteComplianceRulePath))) {
171
+ fail(`Missing compliance canonical source: ${complianceRule.path}`);
172
+ continue;
173
+ }
174
+
175
+ const complianceRuleContent = await readTextFile(absoluteComplianceRulePath);
176
+ if (complianceRuleContent.includes(complianceRule.snippet)) {
177
+ pass(`${complianceRule.path} keeps canonical terminology rule: ${complianceRule.label}`);
178
+ } else {
179
+ fail(`${complianceRule.path} must keep canonical terminology rule: ${complianceRule.label}`);
180
+ }
181
+ }
182
+ }
183
+
184
+ export async function validateDetectionTransparencyCoverage(context) {
185
+ await validateSnippetCoverage({
186
+ heading: 'Checking existing-project detection transparency coverage...',
187
+ coverageRules: REQUIRED_DETECTION_TRANSPARENCY_SNIPPETS,
188
+ missingLabel: 'detection transparency source',
189
+ snippetLabel: 'detection transparency snippet',
190
+ context,
191
+ });
192
+ }
193
+
194
+ export async function validateStackResearchEngineCoverage(context) {
195
+ await validateSnippetCoverage({
196
+ heading: 'Checking stack research engine coverage...',
197
+ coverageRules: REQUIRED_STACK_RESEARCH_ENGINE_SNIPPETS,
198
+ missingLabel: 'stack research source',
199
+ snippetLabel: 'stack research snippet',
200
+ context,
201
+ });
202
+ }
203
+
204
+ export async function validateUniversalSopConsolidationCoverage(context) {
205
+ await validateSnippetCoverage({
206
+ heading: 'Checking Universal SOP consolidation coverage...',
207
+ coverageRules: REQUIRED_UNIVERSAL_SOP_SNIPPETS,
208
+ missingLabel: 'Universal SOP source',
209
+ snippetLabel: 'Universal SOP snippet',
210
+ context,
211
+ });
212
+ }
213
+
214
+ export async function validateTemplateFreeBootstrapCoverage(context) {
215
+ const { ROOT_DIR, fileExists, readTextFile, pass, fail } = context;
216
+
217
+ console.log('\nChecking template-free dynamic bootstrap coverage...');
218
+
219
+ for (const coverageRule of REQUIRED_TEMPLATE_FREE_BOOTSTRAP_SNIPPETS) {
220
+ const absoluteCoveragePath = join(ROOT_DIR, coverageRule.path);
221
+
222
+ if (!(await fileExists(absoluteCoveragePath))) {
223
+ fail(`Missing template-free bootstrap source: ${coverageRule.path}`);
224
+ continue;
225
+ }
226
+
227
+ const coverageContent = await readTextFile(absoluteCoveragePath);
228
+ for (const requiredSnippet of coverageRule.snippets) {
229
+ if (coverageContent.includes(requiredSnippet)) {
230
+ pass(`${coverageRule.path} includes template-free bootstrap snippet: ${requiredSnippet}`);
231
+ } else {
232
+ fail(`${coverageRule.path} is missing template-free bootstrap snippet: ${requiredSnippet}`);
233
+ }
234
+ }
235
+ }
236
+
237
+ for (const forbiddenRule of FORBIDDEN_TEMPLATE_BOOTSTRAP_SNIPPETS) {
238
+ const absoluteForbiddenPath = join(ROOT_DIR, forbiddenRule.path);
239
+
240
+ if (!(await fileExists(absoluteForbiddenPath))) {
241
+ fail(`Missing template-free bootstrap source: ${forbiddenRule.path}`);
242
+ continue;
243
+ }
244
+
245
+ const forbiddenContent = await readTextFile(absoluteForbiddenPath);
246
+ for (const forbiddenSnippet of forbiddenRule.snippets) {
247
+ if (forbiddenContent.includes(forbiddenSnippet)) {
248
+ fail(`${forbiddenRule.path} must not include active template snippet: ${forbiddenSnippet}`);
249
+ } else {
250
+ pass(`${forbiddenRule.path} excludes active template snippet: ${forbiddenSnippet}`);
251
+ }
252
+ }
253
+ }
254
+ }
255
+
256
+ export async function validateUpgradeUiContractWarningCoverage(context) {
257
+ await validateSnippetCoverage({
258
+ heading: 'Checking upgrade UI contract warning coverage...',
259
+ coverageRules: REQUIRED_UPGRADE_UI_CONTRACT_WARNING_SNIPPETS,
260
+ missingLabel: 'upgrade UI contract warning source',
261
+ snippetLabel: 'upgrade UI contract warning snippet',
262
+ context,
263
+ });
264
+ }
265
+
266
+ export async function validateUiDesignAutomationCoverage(context) {
267
+ await validateSnippetCoverage({
268
+ heading: 'Checking UI design automation coverage...',
269
+ coverageRules: REQUIRED_UI_DESIGN_AUTOMATION_SNIPPETS,
270
+ missingLabel: 'UI design automation source',
271
+ snippetLabel: 'UI design automation snippet',
272
+ context,
273
+ });
274
+ }
275
+
276
+ export async function validateDockerRuntimeAutomationCoverage(context) {
277
+ await validateSnippetCoverage({
278
+ heading: 'Checking Docker runtime automation coverage...',
279
+ coverageRules: REQUIRED_DOCKER_RUNTIME_AUTOMATION_SNIPPETS,
280
+ missingLabel: 'Docker runtime automation source',
281
+ snippetLabel: 'Docker runtime automation snippet',
282
+ context,
283
+ });
284
+ }
285
+
286
+ export async function validateDependencyFreshnessAutomationCoverage(context) {
287
+ await validateSnippetCoverage({
288
+ heading: 'Checking dependency freshness automation coverage...',
289
+ coverageRules: REQUIRED_DEPENDENCY_FRESHNESS_AUTOMATION_SNIPPETS,
290
+ missingLabel: 'dependency freshness automation source',
291
+ snippetLabel: 'dependency freshness automation snippet',
292
+ context,
293
+ });
294
+ }
295
+
296
+ export async function validateDeterministicBoundaryEnforcementCoverage(context) {
297
+ await validateSnippetCoverage({
298
+ heading: 'Checking deterministic boundary enforcement coverage...',
299
+ coverageRules: REQUIRED_DETERMINISTIC_BOUNDARY_ENFORCEMENT_SNIPPETS,
300
+ missingLabel: 'deterministic boundary source',
301
+ snippetLabel: 'deterministic boundary snippet',
302
+ context,
303
+ });
304
+ }
305
+
306
+ export async function validateHumanWritingGovernance(context) {
307
+ const { ROOT_DIR, fileExists, readTextFile, pass, fail } = context;
308
+
309
+ console.log('\nChecking human writing governance...');
310
+
311
+ const disallowedEmojiPattern = /[\u2705\u274C\u26A0\u{1F4CC}\u{1F536}\u{1F4CE}\u{1F534}\u{1F7E0}\u{1F7E1}\u{1F7E2}]/u;
312
+
313
+ for (const formalArtifactPath of FORMAL_ARTIFACT_PATHS) {
314
+ const absoluteFormalArtifactPath = join(ROOT_DIR, formalArtifactPath);
315
+
316
+ if (!(await fileExists(absoluteFormalArtifactPath))) {
317
+ fail(`Missing formal artifact for writing governance: ${formalArtifactPath}`);
318
+ continue;
319
+ }
320
+
321
+ const formalArtifactContent = await readTextFile(absoluteFormalArtifactPath);
322
+ if (disallowedEmojiPattern.test(formalArtifactContent)) {
323
+ fail(`${formalArtifactPath} contains disallowed emoji symbols in formal text`);
324
+ } else {
325
+ pass(`${formalArtifactPath} has no disallowed emoji symbols`);
326
+ }
327
+ }
328
+
329
+ for (const snippetRule of REQUIRED_HUMAN_WRITING_SNIPPETS) {
330
+ const absoluteRulePath = join(ROOT_DIR, snippetRule.path);
331
+ if (!(await fileExists(absoluteRulePath))) {
332
+ fail(`Missing writing governance source: ${snippetRule.path}`);
333
+ continue;
334
+ }
335
+
336
+ const writingRuleContent = await readTextFile(absoluteRulePath);
337
+ for (const requiredSnippet of snippetRule.snippets) {
338
+ if (writingRuleContent.includes(requiredSnippet)) {
339
+ pass(`${snippetRule.path} includes writing governance snippet: ${requiredSnippet}`);
340
+ } else {
341
+ fail(`${snippetRule.path} is missing writing governance snippet: ${requiredSnippet}`);
342
+ }
343
+ }
344
+ }
345
+ }
346
+
347
+ export async function validateInstructionAdapters(context) {
348
+ const {
349
+ ROOT_DIR,
350
+ CANONICAL_INSTRUCTION_PATH,
351
+ fileExists,
352
+ readTextFile,
353
+ normalizeLineEndings,
354
+ pass,
355
+ fail,
356
+ } = context;
357
+
358
+ console.log('\nChecking instruction adapter consolidation...');
359
+
360
+ const canonicalInstructionContent = normalizeLineEndings(await readTextFile(CANONICAL_INSTRUCTION_PATH));
361
+ const canonicalSnapshotHash = createHash('sha256').update(canonicalInstructionContent).digest('hex');
362
+
363
+ for (const thinAdapterPath of THIN_ADAPTER_PATHS) {
364
+ const absoluteAdapterPath = join(ROOT_DIR, thinAdapterPath);
365
+
366
+ if (!(await fileExists(absoluteAdapterPath))) {
367
+ fail(`Missing thin adapter file: ${thinAdapterPath}`);
368
+ continue;
369
+ }
370
+
371
+ const thinAdapterContent = await readTextFile(absoluteAdapterPath);
372
+
373
+ if (
374
+ thinAdapterContent.includes('Adapter Mode: thin')
375
+ && thinAdapterContent.includes('Adapter Source: .instructions.md')
376
+ ) {
377
+ pass(`${thinAdapterPath} declares thin adapter metadata`);
378
+ } else {
379
+ fail(`${thinAdapterPath} must declare Adapter Mode: thin and Adapter Source: .instructions.md`);
380
+ }
381
+
382
+ const hashMatch = thinAdapterContent.match(/Canonical Snapshot SHA256:\s*([a-f0-9]{64})/);
383
+ if (!hashMatch) {
384
+ fail(`${thinAdapterPath} must declare Canonical Snapshot SHA256`);
385
+ continue;
386
+ }
387
+
388
+ if (hashMatch[1] === canonicalSnapshotHash) {
389
+ pass(`${thinAdapterPath} canonical hash matches .instructions.md`);
390
+ } else {
391
+ fail(`${thinAdapterPath} canonical hash drift detected (expected ${canonicalSnapshotHash})`);
392
+ }
393
+
394
+ const thinAdapterLineCount = thinAdapterContent.split(/\r?\n/u).length;
395
+ if (thinAdapterLineCount <= 80) {
396
+ pass(`${thinAdapterPath} remains thin (${thinAdapterLineCount} lines)`);
397
+ } else {
398
+ fail(`${thinAdapterPath} is too large for thin-adapter mode (${thinAdapterLineCount} lines)`);
399
+ }
400
+ }
401
+ }
402
+
403
+ export async function validateSkillPurgeSurface(context) {
404
+ const { ROOT_DIR, AGENT_CONTEXT_DIR, fileExists, pass, fail } = context;
405
+
406
+ console.log('\nChecking skill and tier purge surface...');
407
+
408
+ const skillDirectoryPath = join(AGENT_CONTEXT_DIR, 'skills');
409
+ if (await fileExists(skillDirectoryPath)) {
410
+ fail('Skills directory must be removed: .agent-context/skills');
411
+ } else {
412
+ pass('Skills directory removed: .agent-context/skills');
413
+ }
414
+
415
+ const retiredFiles = [
416
+ join(ROOT_DIR, 'lib', 'cli', 'skill-selector.mjs'),
417
+ join(ROOT_DIR, 'scripts', 'skill-tier-policy.mjs'),
418
+ join(ROOT_DIR, 'scripts', 'trust-scorer.mjs'),
419
+ ];
420
+
421
+ for (const retiredFilePath of retiredFiles) {
422
+ const relativeRetiredPath = relative(ROOT_DIR, retiredFilePath).replace(/\\/g, '/');
423
+ if (await fileExists(retiredFilePath)) {
424
+ fail(`Retired file still present: ${relativeRetiredPath}`);
425
+ } else {
426
+ pass(`Retired file removed: ${relativeRetiredPath}`);
427
+ }
428
+ }
429
+ }