@aisdlc/core 4.5.1 → 4.6.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/dist/index.cjs CHANGED
@@ -1198,30 +1198,61 @@ var DEFAULT_TEST_ARTIFACT_PATTERNS = [
1198
1198
  "**/*.feature",
1199
1199
  ...DEFAULT_UNIT_TEST_PATTERNS
1200
1200
  ];
1201
- var DEFAULT_UI_COMPONENT_PATTERNS = [
1202
- "**/components/**",
1203
- "**/views/**",
1204
- "**/pages/**",
1205
- "**/screens/**",
1206
- "**/windows/**",
1207
- "**/dialogs/**",
1208
- "**/tui/**",
1209
- "**/widgets/**",
1201
+ var WEB_UI_COMPONENT_PATTERNS = [
1210
1202
  "**/*.tsx",
1211
1203
  "**/*.jsx",
1212
1204
  "**/*.vue",
1213
1205
  "**/*.svelte",
1206
+ "**/*.component.ts",
1207
+ "**/*.razor",
1208
+ "**/*.cshtml",
1209
+ "**/components/**",
1210
+ "**/views/**",
1211
+ "**/pages/**",
1212
+ "**/widgets/**"
1213
+ ];
1214
+ var DESKTOP_UI_COMPONENT_PATTERNS = [
1214
1215
  "**/*Window.cs",
1215
1216
  "**/*View.cs",
1216
1217
  "**/*Form.cs",
1217
1218
  "**/*Dialog.cs",
1218
1219
  "**/*Page.cs",
1219
1220
  "**/*UserControl.cs",
1221
+ "**/*.xaml",
1222
+ "**/*.axaml",
1223
+ "**/*.xaml.cs",
1224
+ "**/*.axaml.cs",
1225
+ "**/windows/**",
1226
+ "**/dialogs/**"
1227
+ ];
1228
+ var CONSOLE_UI_COMPONENT_PATTERNS = [
1229
+ "**/tui/**",
1230
+ "**/cli/**",
1231
+ "**/commands/**",
1232
+ "**/console/**",
1233
+ "**/*Command.ts",
1234
+ "**/*Command.js",
1235
+ "**/*Command.cs",
1236
+ "**/*Command.py",
1237
+ "**/*Cli.ts",
1238
+ "**/*Cli.cs"
1239
+ ];
1240
+ var MOBILE_UI_COMPONENT_PATTERNS = [
1220
1241
  "**/*Screen.kt",
1221
1242
  "**/*Activity.kt",
1222
1243
  "**/*Fragment.kt",
1223
1244
  "**/*ViewController.swift",
1224
- "**/*Screen.dart"
1245
+ "**/*View.swift",
1246
+ "**/*Screen.dart",
1247
+ "**/*Page.dart",
1248
+ "**/*Widget.dart",
1249
+ "**/screens/**"
1250
+ ];
1251
+ var DEFAULT_UI_COMPONENT_PATTERNS = [
1252
+ ...WEB_UI_COMPONENT_PATTERNS,
1253
+ ...DESKTOP_UI_COMPONENT_PATTERNS,
1254
+ ...CONSOLE_UI_COMPONENT_PATTERNS,
1255
+ ...MOBILE_UI_COMPONENT_PATTERNS
1225
1256
  ];
1226
1257
  var DEFAULT_UI_TEST_PATTERNS = [
1227
1258
  "tests/e2e/**",
@@ -1229,19 +1260,39 @@ var DEFAULT_UI_TEST_PATTERNS = [
1229
1260
  "tests/desktop/**",
1230
1261
  "tests/mobile/**",
1231
1262
  "tests/cli/**",
1263
+ "tests/console/**",
1264
+ "**/tests/e2e/**",
1265
+ "**/tests/ui/**",
1266
+ "**/tests/desktop/**",
1267
+ "**/tests/mobile/**",
1268
+ "**/tests/cli/**",
1269
+ "**/tests/console/**",
1270
+ "**/cli/tests/**",
1271
+ "**/*.e2e.*",
1232
1272
  "**/*.e2e.ts",
1233
1273
  "**/*.e2e.js",
1234
- "**/*.ui.spec.ts",
1235
- "**/*.ui.test.ts",
1236
- "**/*UiTest.cs",
1237
- "**/*UITest.cs",
1274
+ "**/*.ui.spec.*",
1275
+ "**/*.ui.test.*",
1276
+ "**/*.cli.spec.*",
1277
+ "**/*.cli.test.*",
1278
+ "**/*-cli.spec.*",
1279
+ "**/*-cli.test.*",
1280
+ "**/*Playwright*.*",
1281
+ "**/*FlaUI*.cs",
1282
+ "**/*UiTest*.cs",
1283
+ "**/*UITest*.cs",
1238
1284
  "**/*UiTests.cs",
1239
1285
  "**/*UITests.cs",
1240
- "**/*FlaUI*.cs",
1286
+ "**/*CliTest*.*",
1287
+ "**/*ConsoleTest*.*",
1288
+ "**/*MobileTest*.*",
1289
+ "**/*WidgetTest*.dart",
1241
1290
  "**/*E2ETest.java",
1242
1291
  "**/*UITest.swift",
1292
+ "**/*_ui_test.py",
1243
1293
  "**/test_ui_*.py",
1244
- "**/*_ui_test.py"
1294
+ "**/test_cli_*.py",
1295
+ "**/*_cli_test.py"
1245
1296
  ];
1246
1297
  function escapeRegexChars(raw) {
1247
1298
  return raw.replace(/[.+^${}()|[\]\\]/g, "\\$&");
@@ -1286,18 +1337,138 @@ function compilePatternList(patterns) {
1286
1337
  }
1287
1338
  };
1288
1339
  }
1289
- var NON_COMPONENT_UI_FILES = /(?:^|\/)(?:index|types|constants|styles|main|app|setup)\.[jt]sx?$/i;
1340
+ var NON_COMPONENT_UI_FILES = /(?:^|\/)(?:index|types|constants|styles|main|app|setup|cli)\.[jt]sx?$/i;
1341
+ var MODALITY_PRECEDENCE_RULES = [
1342
+ // Tier 1A: Unambiguous Web extensions/suffixes
1343
+ {
1344
+ modality: "web",
1345
+ matcher: compilePatternList([
1346
+ "**/*.tsx",
1347
+ "**/*.jsx",
1348
+ "**/*.vue",
1349
+ "**/*.svelte",
1350
+ "**/*.component.ts",
1351
+ "**/*.razor",
1352
+ "**/*.cshtml"
1353
+ ])
1354
+ },
1355
+ // Tier 1B: Unambiguous Desktop extensions/suffixes
1356
+ {
1357
+ modality: "desktop",
1358
+ matcher: compilePatternList([
1359
+ "**/*.xaml",
1360
+ "**/*.axaml",
1361
+ "**/*.xaml.cs",
1362
+ "**/*.axaml.cs",
1363
+ "**/*Window.cs",
1364
+ "**/*View.cs",
1365
+ "**/*Form.cs",
1366
+ "**/*Dialog.cs",
1367
+ "**/*Page.cs",
1368
+ "**/*UserControl.cs"
1369
+ ])
1370
+ },
1371
+ // Tier 1C: Unambiguous Mobile extensions
1372
+ {
1373
+ modality: "mobile",
1374
+ matcher: compilePatternList(["**/*.kt", "**/*.swift", "**/*.dart"])
1375
+ },
1376
+ // Tier 1D: Unambiguous Console suffixes
1377
+ {
1378
+ modality: "console",
1379
+ matcher: compilePatternList([
1380
+ "**/*Command.ts",
1381
+ "**/*Command.js",
1382
+ "**/*Command.cs",
1383
+ "**/*Command.py",
1384
+ "**/*Cli.ts",
1385
+ "**/*Cli.cs"
1386
+ ])
1387
+ },
1388
+ // Tier 2: Directory globs for generic extensions
1389
+ {
1390
+ modality: "console",
1391
+ matcher: compilePatternList(["**/tui/**", "**/cli/**", "**/commands/**", "**/console/**"])
1392
+ },
1393
+ {
1394
+ modality: "desktop",
1395
+ matcher: compilePatternList(["**/windows/**", "**/dialogs/**"])
1396
+ },
1397
+ {
1398
+ modality: "mobile",
1399
+ matcher: compilePatternList(["**/screens/**"])
1400
+ },
1401
+ {
1402
+ modality: "web",
1403
+ matcher: compilePatternList(["**/components/**", "**/views/**", "**/pages/**", "**/widgets/**"])
1404
+ }
1405
+ ];
1406
+ var MODALITY_DRIVER_SIGNATURES = {
1407
+ web: /(?:@playwright\/test|\bplaywright\b|\bpage\.(?:goto|locator|getByRole|getByText|getByTestId|getByLabel|click|fill|waitForSelector)\b|\bexpect\(\s*(?:page|locator)\b|\bcypress\b|\bcy\.(?:visit|get|contains|intercept)\b|\brender\s*\(|\bscreen\.(?:getBy|findBy|queryBy)\w*|\bfireEvent\b|\buserEvent\b|\bTestBed\b|\bbUnit\b|\bRenderComponent\b)/,
1408
+ desktop: /(?:\bFlaUI\b|\bUIA3Automation\b|\bUIA2Automation\b|\bApplication\.Launch\b|\bFindFirstDescendant\b|\bAsButton\b|\bAsTextBox\b|\bMainWindowHandle\b|\bWinAppDriver\b|\bWindowsDriver\b|\bAvalonia\.Headless\b|\bAutomationElement\b)/,
1409
+ console: /(?:\bspawn\b|\bspawnSync\b|\bexecFile\b|\bexecFileSync\b|\bexecSync\b|(?<!\.)\bexec\s*\(|\bchild_process\b|\bSpectre\.Console\.Testing\b|\bCommandAppTester\b|\bCliRunner\b|\bclick\.testing\b|\bnode-pty\b|\bpty\b|\bprocess\.stdout\b|\bprocess\.stderr\b|\bConsole\.SetOut\b|\bspyOn\(\s*console\s*,|\bconsole\.(?:log|error|warn)\s*=|\b(?:run|execute)[A-Z]\w*\s*\()/,
1410
+ mobile: /(?:\bWidgetTester\b|\btestWidgets\b|\bfind\.by\w+\b|\btester\.(?:tap|pump|pumpWidget|enterText)\b|\bXCUIApplication\b|\bEspresso\b|\bonView\s*\(|\bcomposeTestRule\b|\bAppium\b|\bMaestro\b|\bappId\s*:|\btapOn\s*:|\bassertVisible\s*:|\bDetox\b|\bdevice\.(?:launchApp|reloadReactNative)\b|\belement\(\s*by\.)/
1411
+ };
1412
+ var DEFAULT_UI_COMPONENT_MATCHER = compilePatternList(DEFAULT_UI_COMPONENT_PATTERNS);
1413
+ var DEFAULT_UI_TEST_MATCHER = compilePatternList(DEFAULT_UI_TEST_PATTERNS);
1414
+ var QUOTE_CHARS = /* @__PURE__ */ new Set(["'", '"', "`"]);
1415
+ function isHashCommentStart(line, idx) {
1416
+ if (line[idx] !== "#") return false;
1417
+ return idx === 0 || line[idx - 1] === " " || line[idx - 1] === " ";
1418
+ }
1419
+ function stripLineHashComment(line) {
1420
+ let quote = "";
1421
+ for (let i = 0; i < line.length; i++) {
1422
+ const ch = line[i];
1423
+ if (quote) {
1424
+ if (ch === "\\") {
1425
+ i++;
1426
+ } else if (ch === quote) {
1427
+ quote = "";
1428
+ }
1429
+ continue;
1430
+ }
1431
+ if (QUOTE_CHARS.has(ch)) {
1432
+ quote = ch;
1433
+ continue;
1434
+ }
1435
+ if (isHashCommentStart(line, i)) return line.slice(0, i);
1436
+ }
1437
+ return line;
1438
+ }
1439
+ function detectUiComponentModality(filePath) {
1440
+ const norm = filePath.replace(/\\/g, "/").replace(/^\.\//, "");
1441
+ for (const rule of MODALITY_PRECEDENCE_RULES) {
1442
+ if (rule.matcher.matches(norm)) return rule.modality;
1443
+ }
1444
+ return null;
1445
+ }
1446
+ function inferFallbackUiModality(filePath) {
1447
+ const lower = filePath.replace(/\\/g, "/").toLowerCase();
1448
+ if (/\.(?:a?xaml(?:\.cs)?|cs)$/.test(lower)) return "desktop";
1449
+ if (/\.(?:py|go|rs)$/.test(lower)) return "console";
1450
+ if (/\.(?:kt|swift|dart)$/.test(lower)) return "mobile";
1451
+ return "web";
1452
+ }
1453
+ function stripTestComments(content) {
1454
+ const withoutBlockAndSlash = content.replace(/\/\*[\s\S]*?\*\//g, " ").replace(/<!--[\s\S]*?-->/g, " ").replace(/(?<!:)\/\/[^\r\n]*/g, " ");
1455
+ return withoutBlockAndSlash.split("\n").map(stripLineHashComment).join("\n");
1456
+ }
1457
+ function hasModalityDriverSignature(content, modality) {
1458
+ const cleaned = stripTestComments(content);
1459
+ return MODALITY_DRIVER_SIGNATURES[modality].test(cleaned);
1460
+ }
1290
1461
  function isUiComponentFile(filePath, customPatterns) {
1291
1462
  const norm = filePath.replace(/\\/g, "/").replace(/^\.\//, "");
1292
1463
  if (isPolyglotUnitTestFile(norm) || norm.endsWith(".d.ts") || NON_COMPONENT_UI_FILES.test(norm)) {
1293
1464
  return false;
1294
1465
  }
1295
- const patterns = customPatterns && customPatterns.length > 0 ? customPatterns : DEFAULT_UI_COMPONENT_PATTERNS;
1296
- return compilePatternList(patterns).matches(norm);
1466
+ const matcher = customPatterns && customPatterns.length > 0 ? compilePatternList(customPatterns) : DEFAULT_UI_COMPONENT_MATCHER;
1467
+ return matcher.matches(norm);
1297
1468
  }
1298
1469
  function isUiTestFile(filePath, customPatterns) {
1299
- const patterns = customPatterns && customPatterns.length > 0 ? [...DEFAULT_UI_TEST_PATTERNS, ...customPatterns] : DEFAULT_UI_TEST_PATTERNS;
1300
- return compilePatternList(patterns).matches(filePath);
1470
+ const matcher = customPatterns && customPatterns.length > 0 ? compilePatternList([...DEFAULT_UI_TEST_PATTERNS, ...customPatterns]) : DEFAULT_UI_TEST_MATCHER;
1471
+ return matcher.matches(filePath);
1301
1472
  }
1302
1473
  var BddStepRegistry = class {
1303
1474
  definitions = [];
@@ -2809,7 +2980,9 @@ function createDefaultQualityPolicy() {
2809
2980
  enforce_mode: "STRICT",
2810
2981
  target_directories: ["src", "lib"],
2811
2982
  supported_extensions: [...DEFAULT_EXTENSIONS],
2812
- exclude_patterns: [...DEFAULT_EXCLUDES]
2983
+ exclude_patterns: [...DEFAULT_EXCLUDES],
2984
+ require_ui_component_tests: true,
2985
+ verify_ui_driver_signatures: true
2813
2986
  };
2814
2987
  }
2815
2988
  function appendUniqueStrings(target, raw) {
@@ -2858,6 +3031,9 @@ function applyTestEnforcement(policy, raw) {
2858
3031
  if (typeof enf.require_ui_component_tests === "boolean") {
2859
3032
  policy.require_ui_component_tests = enf.require_ui_component_tests;
2860
3033
  }
3034
+ if (typeof enf.verify_ui_driver_signatures === "boolean") {
3035
+ policy.verify_ui_driver_signatures = enf.verify_ui_driver_signatures;
3036
+ }
2861
3037
  if (Array.isArray(enf.ui_component_patterns)) {
2862
3038
  policy.ui_component_patterns = enf.ui_component_patterns.map(String);
2863
3039
  }
@@ -3155,6 +3331,10 @@ function auditUnitTestsPerFunction(results, rootDir, testPatterns) {
3155
3331
  }
3156
3332
  var UI_COMPONENT_EXTENSIONS = [
3157
3333
  ...DEFAULT_EXTENSIONS,
3334
+ ".razor",
3335
+ ".cshtml",
3336
+ ".xaml",
3337
+ ".axaml",
3158
3338
  ".vue",
3159
3339
  ".svelte",
3160
3340
  ".kt",
@@ -3181,28 +3361,37 @@ function collectUiTestFiles(rootDir, customPatterns) {
3181
3361
  }
3182
3362
  function extractUiComponentName(relPath) {
3183
3363
  const base = path14__namespace.basename(relPath);
3184
- return base.replace(/\.(?:xaml\.cs|component\.ts|vue|svelte|tsx?|jsx?|py|cs|java|kt|swift|dart)$/i, "");
3364
+ return base.replace(/\.(?:a?xaml\.cs|component\.ts|razor|cshtml|a?xaml|vue|svelte|tsx?|jsx?|py|cs|java|kt|swift|dart)$/i, "");
3185
3365
  }
3186
3366
  function buildComponentNameVariants(componentName) {
3187
3367
  const kebab = componentName.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
3188
3368
  const snake = kebab.replace(/-/g, "_");
3189
3369
  return Array.from(/* @__PURE__ */ new Set([componentName, kebab, snake]));
3190
3370
  }
3191
- function isUiComponentTested(componentName, uiTests) {
3371
+ function isUiComponentTested(componentName, uiTests, modality, verifyDriverSignatures = true) {
3192
3372
  const variants = buildComponentNameVariants(componentName);
3193
3373
  const patterns = variants.map((v) => new RegExp(`\\b${v.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\b`, "i"));
3194
- return uiTests.some((t) => patterns.some((re) => re.test(t.relPath) || re.test(t.content)));
3374
+ return uiTests.some((t) => {
3375
+ const cleaned = stripTestComments(t.content);
3376
+ if (!patterns.some((re) => re.test(cleaned))) return false;
3377
+ if (verifyDriverSignatures && modality) {
3378
+ return hasModalityDriverSignature(cleaned, modality);
3379
+ }
3380
+ return true;
3381
+ });
3195
3382
  }
3196
- function auditUiComponents(rootDir, policy) {
3383
+ function auditUiComponents(rootDir, policy, verifyDriverOverride) {
3197
3384
  const uiPolicy = { ...policy, supported_extensions: [...UI_COMPONENT_EXTENSIONS] };
3198
3385
  const candidateFiles = collectFilesToScan(rootDir, uiPolicy);
3199
3386
  const uiTests = collectUiTestFiles(rootDir, policy.ui_test_patterns);
3387
+ const verifyDriver = verifyDriverOverride ?? policy.verify_ui_driver_signatures ?? true;
3200
3388
  const untested = [];
3201
3389
  for (const file of candidateFiles) {
3202
3390
  const relPath = path14__namespace.relative(rootDir, file).replace(/\\/g, "/");
3203
3391
  if (!isUiComponentFile(relPath, policy.ui_component_patterns)) continue;
3204
3392
  const componentName = extractUiComponentName(relPath);
3205
- if (!isUiComponentTested(componentName, uiTests)) {
3393
+ const modality = detectUiComponentModality(relPath) ?? inferFallbackUiModality(relPath);
3394
+ if (!isUiComponentTested(componentName, uiTests, modality, verifyDriver)) {
3206
3395
  untested.push({ file: relPath, componentName });
3207
3396
  }
3208
3397
  }
@@ -3393,7 +3582,7 @@ function verifyQualityGate(options = {}) {
3393
3582
  const requireUnitTests = Boolean(options.requireFunctionUnitTests ?? policy.require_function_unit_tests);
3394
3583
  const requireUiTests = Boolean(options.requireUiComponentTests ?? policy.require_ui_component_tests);
3395
3584
  const untestedFunctions = requireUnitTests ? auditUnitTestsPerFunction(results, rootDir, policy.test_patterns) : [];
3396
- const untestedUiComponents = requireUiTests ? auditUiComponents(rootDir, policy) : [];
3585
+ const untestedUiComponents = requireUiTests ? auditUiComponents(rootDir, policy, options.verifyUiDriverSignatures) : [];
3397
3586
  const requireCoverageReport = options.requireCoverageReport ?? policy.enforce_mode === "STRICT";
3398
3587
  const coverageViolations = evaluateCoverageThresholds(rootDir, policy, requireCoverageReport);
3399
3588
  const baselineFile = resolveBaselineFilePath(rootDir, options);
@@ -15201,9 +15390,9 @@ function checkoutTaskBranch(taskId, options = {}) {
15201
15390
  }
15202
15391
  }
15203
15392
  var AGENT_ENV_MAPPINGS = [
15204
- { envKey: "ANTIGRAVITY_AGENT", defaultModel: "gemini-3.8-flash", source: "antigravity" },
15205
- { envKey: "ANTIGRAVITY_CONVERSATION_ID", defaultModel: "gemini-3.8-flash", source: "antigravity" },
15206
- { envKey: "ANTIGRAVITY_AGENT_ID", defaultModel: "gemini-3.8-flash", source: "antigravity" },
15393
+ { envKey: "ANTIGRAVITY_AGENT", defaultModel: "antigravity-agent", source: "antigravity" },
15394
+ { envKey: "ANTIGRAVITY_CONVERSATION_ID", defaultModel: "antigravity-agent", source: "antigravity" },
15395
+ { envKey: "ANTIGRAVITY_AGENT_ID", defaultModel: "antigravity-agent", source: "antigravity" },
15207
15396
  { envKey: "CORTEX_SESSION_ID", defaultModel: "antigravity-agent", source: "cortex" },
15208
15397
  { envKey: "CLAUDE_CODE", defaultModel: "claude-3-7-sonnet", source: "claude-code" },
15209
15398
  { envKey: "CLAUDE_AGENT", defaultModel: "claude-3-7-sonnet", source: "claude-agent" },
@@ -18785,6 +18974,53 @@ function serializeSarifDocument(doc, pretty = true) {
18785
18974
  function writeSecuritySarifReport(outputPath, doc, pretty = true) {
18786
18975
  writeReportFileIfChanged(outputPath, serializeSarifDocument(doc, pretty));
18787
18976
  }
18977
+ var AISDLC_MANIFEST_FILENAME = ".aisdlc.json";
18978
+ function getAisdlcVersion() {
18979
+ try {
18980
+ const req = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
18981
+ const pkg = req("../package.json");
18982
+ if (pkg?.version) return pkg.version;
18983
+ } catch {
18984
+ }
18985
+ return "0.0.0";
18986
+ }
18987
+ function readAisdlcManifest(rootDir) {
18988
+ const manifestPath = path14__namespace.join(rootDir, AISDLC_MANIFEST_FILENAME);
18989
+ if (!fs12__namespace.existsSync(manifestPath)) return null;
18990
+ try {
18991
+ const raw = JSON.parse(fs12__namespace.readFileSync(manifestPath, "utf-8"));
18992
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) return null;
18993
+ const record = raw;
18994
+ if (typeof record.version !== "string" || !record.version.trim()) return null;
18995
+ return { ...record, version: record.version.trim() };
18996
+ } catch {
18997
+ return null;
18998
+ }
18999
+ }
19000
+ function writeAisdlcManifest(rootDir, version = getAisdlcVersion()) {
19001
+ const manifestPath = path14__namespace.join(rootDir, AISDLC_MANIFEST_FILENAME);
19002
+ let data = {};
19003
+ if (fs12__namespace.existsSync(manifestPath)) {
19004
+ try {
19005
+ const existing = JSON.parse(fs12__namespace.readFileSync(manifestPath, "utf-8"));
19006
+ if (existing && typeof existing === "object" && !Array.isArray(existing)) {
19007
+ data = existing;
19008
+ }
19009
+ } catch {
19010
+ }
19011
+ }
19012
+ data.version = version;
19013
+ fs12__namespace.writeFileSync(manifestPath, JSON.stringify(data, null, 2) + "\n", "utf-8");
19014
+ }
19015
+ function formatAisdlcVersionOutput(rootDir = process.cwd()) {
19016
+ const installed = getAisdlcVersion();
19017
+ const manifest = readAisdlcManifest(rootDir);
19018
+ if (!manifest) return installed;
19019
+ if (manifest.version === installed) {
19020
+ return `${installed} (repo: ${manifest.version})`;
19021
+ }
19022
+ return `${installed} (repo: ${manifest.version} \u2014 differs from installed CLI)`;
19023
+ }
18788
19024
 
18789
19025
  // src/init/agent-templates.ts
18790
19026
  var SPECIALIZED_AGENT_TEMPLATES = [
@@ -19326,10 +19562,10 @@ This file defines the operational rules and specialized role mappings for Google
19326
19562
 
19327
19563
  ## 3. Git 4-Tier Hierarchy and Commit Conventions
19328
19564
  - \`task/<PARENT-ID>/<TSK-ID>-<slug>\` $\\rightarrow$ \`feat/<FEAT-ID>-<slug>\` $\\rightarrow$ \`release/vX.Y.Z\` $\\rightarrow$ \`main\`.
19329
- - Mandatory commit trailers injection:
19565
+ - Mandatory commit trailers injection (always declare your actual active model in \`AI-Model:\` or via \`AI_MODEL=<active-model>\` when running \`git commit\`, so the hook does not fall back to a generic IDE identifier like \`antigravity-agent\`):
19330
19566
  \`\`\`text
19331
19567
  Author-Type: agent
19332
- AI-Model: gemini-1.5-pro / gemini-2.0-flash
19568
+ AI-Model: <active-model>
19333
19569
  Task-ID: TSK-XXX
19334
19570
  Change-ID: CHG-XXX
19335
19571
  \`\`\`
@@ -22435,6 +22671,7 @@ function collectArchitectureTemplateFiles(archGranularity) {
22435
22671
  }
22436
22672
  function collectStarterFiles(ciProvider, agentFiles = [], archGranularity = "minimal", stacks = []) {
22437
22673
  const files = [
22674
+ { relPath: AISDLC_MANIFEST_FILENAME, content: JSON.stringify({ version: getAisdlcVersion() }, null, 2) + "\n" },
22438
22675
  ...collectPolicyAndSchemaFiles(),
22439
22676
  ...getCodingRulesFilesForStacks(stacks),
22440
22677
  ...getCiWorkflowFiles(ciProvider),
@@ -23930,6 +24167,62 @@ var SecurityToolsHealthCheck = class {
23930
24167
  }
23931
24168
  }
23932
24169
  };
24170
+ var CATEGORY_TITLE = "AI-SDLC Repository Version (.aisdlc.json)";
24171
+ function makeFinding(id, status, message, details, remediation) {
24172
+ return { id, category: "aisdlc_version", status, message, remediation, details };
24173
+ }
24174
+ function compareManifestVersion(repoVersion, installedVersion) {
24175
+ if (repoVersion === installedVersion) {
24176
+ return makeFinding(
24177
+ "PASS_AISDLC_VERSION_MATCH",
24178
+ "pass",
24179
+ `Repository AI-SDLC version (${repoVersion}) matches installed CLI (${installedVersion}).`,
24180
+ { repoVersion, installedVersion }
24181
+ );
24182
+ }
24183
+ return makeFinding(
24184
+ "WARN_AISDLC_VERSION_MISMATCH",
24185
+ "warn",
24186
+ `Repository AI-SDLC version (${repoVersion}) differs from installed CLI (${installedVersion}).`,
24187
+ { repoVersion, installedVersion },
24188
+ `Run 'aisdlc migrate' to align repository templates/policies with v${installedVersion}, or run with @aisdlc/cli@${repoVersion}.`
24189
+ );
24190
+ }
24191
+ function evaluateVersionFinding(rootDir, installedVersion) {
24192
+ const manifestPath = path14__namespace.join(rootDir, AISDLC_MANIFEST_FILENAME);
24193
+ if (!fs12__namespace.existsSync(manifestPath)) {
24194
+ return makeFinding(
24195
+ "WARN_AISDLC_MANIFEST_MISSING",
24196
+ "warn",
24197
+ `Repository manifest '${AISDLC_MANIFEST_FILENAME}' not found (installed CLI: v${installedVersion}).`,
24198
+ { installedVersion },
24199
+ `Run 'aisdlc migrate' or 'aisdlc init' to record the repository's AI-SDLC version in '${AISDLC_MANIFEST_FILENAME}'.`
24200
+ );
24201
+ }
24202
+ const manifest = readAisdlcManifest(rootDir);
24203
+ if (!manifest) {
24204
+ return makeFinding(
24205
+ "WARN_AISDLC_MANIFEST_INVALID",
24206
+ "warn",
24207
+ `Repository manifest '${AISDLC_MANIFEST_FILENAME}' is missing a valid 'version' field (installed CLI: v${installedVersion}).`,
24208
+ { installedVersion },
24209
+ `Run 'aisdlc migrate' to repair '${AISDLC_MANIFEST_FILENAME}'.`
24210
+ );
24211
+ }
24212
+ return compareManifestVersion(manifest.version, installedVersion);
24213
+ }
24214
+ var AisdlcVersionCheck = class {
24215
+ async inspect(options) {
24216
+ const rootDir = options.rootDir || process.cwd();
24217
+ const finding = evaluateVersionFinding(rootDir, getAisdlcVersion());
24218
+ return {
24219
+ category: "aisdlc_version",
24220
+ title: CATEGORY_TITLE,
24221
+ status: finding.status,
24222
+ findings: [finding]
24223
+ };
24224
+ }
24225
+ };
23933
24226
 
23934
24227
  // src/doctor/reporter.ts
23935
24228
  function formatFinding(f) {
@@ -23987,6 +24280,7 @@ var DoctorOrchestrator = class {
23987
24280
  toolchainCheck = new ToolchainHealthCheck();
23988
24281
  signatureCheck = new SignatureReadinessCheck();
23989
24282
  securityToolsCheck = new SecurityToolsHealthCheck();
24283
+ versionCheck = new AisdlcVersionCheck();
23990
24284
  async runAll(options) {
23991
24285
  const categories = [];
23992
24286
  categories.push(await this.hooksCheck.inspect(options));
@@ -23995,6 +24289,7 @@ var DoctorOrchestrator = class {
23995
24289
  categories.push(await this.toolchainCheck.inspect(options));
23996
24290
  categories.push(await this.signatureCheck.inspect(options));
23997
24291
  categories.push(await this.securityToolsCheck.inspect(options));
24292
+ categories.push(await this.versionCheck.inspect(options));
23998
24293
  return categories;
23999
24294
  }
24000
24295
  };
@@ -24711,15 +25006,27 @@ var MigrationService = class {
24711
25006
  const targets = this.discoverGovernedFiles(root);
24712
25007
  const evaluation = evaluateGovernedTargets(targets, this.orchestrator, options.force);
24713
25008
  if (isDryRun || evaluation.filesToModify.length === 0) {
24714
- const exitCode2 = resolveExitCode2(evaluation.summary);
24715
- return { success: exitCode2 === 0, exitCode: exitCode2, summary: evaluation.summary, details: evaluation.details };
25009
+ return this.buildCompletedResult(root, evaluation, isDryRun);
24716
25010
  }
24717
25011
  const tx = await this.runMutationTransaction(root, evaluation, options.backup ?? true);
24718
25012
  if (!tx.success) {
24719
25013
  return createTransactionFailureResult(evaluation.summary, tx.backupPath, tx.error);
24720
25014
  }
25015
+ return this.buildCompletedResult(root, evaluation, isDryRun, tx.backupPath);
25016
+ }
25017
+ buildCompletedResult(root, evaluation, isDryRun, backupPath) {
24721
25018
  const exitCode = resolveExitCode2(evaluation.summary);
24722
- return { success: exitCode === 0, exitCode, summary: evaluation.summary, backupPath: tx.backupPath, details: evaluation.details };
25019
+ if (!isDryRun && exitCode !== 2) {
25020
+ this.syncManifestVersion(root);
25021
+ }
25022
+ return { success: exitCode === 0, exitCode, summary: evaluation.summary, backupPath, details: evaluation.details };
25023
+ }
25024
+ syncManifestVersion(root) {
25025
+ const installedVersion = getAisdlcVersion();
25026
+ const existing = readAisdlcManifest(root);
25027
+ if (!existing || existing.version !== installedVersion) {
25028
+ writeAisdlcManifest(root, installedVersion);
25029
+ }
24723
25030
  }
24724
25031
  discoverGovernedFiles(root) {
24725
25032
  const items = [];
@@ -24739,11 +25046,14 @@ var MigrationService = class {
24739
25046
  }
24740
25047
  };
24741
25048
 
25049
+ exports.AISDLC_MANIFEST_FILENAME = AISDLC_MANIFEST_FILENAME;
24742
25050
  exports.ALL_ARCHITECTURE_TEMPLATES = ALL_ARCHITECTURE_TEMPLATES;
24743
25051
  exports.ALL_QUALITY_GATES = ALL_QUALITY_GATES;
25052
+ exports.AisdlcVersionCheck = AisdlcVersionCheck;
24744
25053
  exports.BRANCH_PATTERNS = BRANCH_PATTERNS;
24745
25054
  exports.BddStepRegistry = BddStepRegistry;
24746
25055
  exports.BranchSafetyCheck = BranchSafetyCheck;
25056
+ exports.CONSOLE_UI_COMPONENT_PATTERNS = CONSOLE_UI_COMPONENT_PATTERNS;
24747
25057
  exports.CPP_CLANG_TIDY = CPP_CLANG_TIDY;
24748
25058
  exports.CPP_CMAKE_STRICT = CPP_CMAKE_STRICT;
24749
25059
  exports.DEFAULT_DLP_RULES = DEFAULT_DLP_RULES;
@@ -24757,6 +25067,7 @@ exports.DEFAULT_TEST_ARTIFACT_PATTERNS = DEFAULT_TEST_ARTIFACT_PATTERNS;
24757
25067
  exports.DEFAULT_UI_COMPONENT_PATTERNS = DEFAULT_UI_COMPONENT_PATTERNS;
24758
25068
  exports.DEFAULT_UI_TEST_PATTERNS = DEFAULT_UI_TEST_PATTERNS;
24759
25069
  exports.DEFAULT_UNIT_TEST_PATTERNS = DEFAULT_UNIT_TEST_PATTERNS;
25070
+ exports.DESKTOP_UI_COMPONENT_PATTERNS = DESKTOP_UI_COMPONENT_PATTERNS;
24760
25071
  exports.DOTNET_DIRECTORY_BUILD_PROPS = DOTNET_DIRECTORY_BUILD_PROPS;
24761
25072
  exports.DiffDetector = DiffDetector;
24762
25073
  exports.DlpSanitizer = DlpSanitizer;
@@ -24778,6 +25089,7 @@ exports.LIFECYCLE_SKILL_TEMPLATES = LIFECYCLE_SKILL_TEMPLATES;
24778
25089
  exports.MAX_SARIF_BYTES = MAX_SARIF_BYTES;
24779
25090
  exports.MAX_SARIF_JSON_DEPTH = MAX_SARIF_JSON_DEPTH;
24780
25091
  exports.MAX_SARIF_RESULTS = MAX_SARIF_RESULTS;
25092
+ exports.MOBILE_UI_COMPONENT_PATTERNS = MOBILE_UI_COMPONENT_PATTERNS;
24781
25093
  exports.MigrationOrchestrator = MigrationOrchestrator;
24782
25094
  exports.MigrationReporter = MigrationReporter;
24783
25095
  exports.MigrationService = MigrationService;
@@ -24945,6 +25257,7 @@ exports.VALID_AUTONOMY_MODES = VALID_AUTONOMY_MODES;
24945
25257
  exports.VALID_CHANGE_PROFILES = VALID_CHANGE_PROFILES;
24946
25258
  exports.VALID_CI_PROVIDERS = VALID_CI_PROVIDERS;
24947
25259
  exports.VALID_CODING_RULE_STACKS = VALID_CODING_RULE_STACKS;
25260
+ exports.WEB_UI_COMPONENT_PATTERNS = WEB_UI_COMPONENT_PATTERNS;
24948
25261
  exports.WIN_CMD_META_RE = WIN_CMD_META_RE;
24949
25262
  exports.accumulateTaskSummaries = accumulateTaskSummaries;
24950
25263
  exports.aggregateCommitKpiRecords = aggregateCommitKpiRecords;
@@ -24993,6 +25306,7 @@ exports.detectProfileFromChange = detectProfileFromChange;
24993
25306
  exports.detectProjectEcosystems = detectProjectEcosystems;
24994
25307
  exports.detectProjectStacks = detectProjectStacks;
24995
25308
  exports.detectPromptInjection = detectPromptInjection;
25309
+ exports.detectUiComponentModality = detectUiComponentModality;
24996
25310
  exports.emitCiOutput = emitCiOutput;
24997
25311
  exports.ensureToolAvailable = ensureToolAvailable;
24998
25312
  exports.ensureTrivyAvailable = ensureTrivyAvailable;
@@ -25018,9 +25332,11 @@ exports.extractGherkinFeatures = extractGherkinFeatures;
25018
25332
  exports.extractNormativeText = extractNormativeText;
25019
25333
  exports.extractPythonFunctionsPolyglot = extractPythonFunctionsPolyglot;
25020
25334
  exports.extractSemanticContent = extractSemanticContent;
25335
+ exports.extractUiComponentName = extractUiComponentName;
25021
25336
  exports.findChangeWorkspaceDir = findChangeWorkspaceDir;
25022
25337
  exports.findLicenseFile = findLicenseFile;
25023
25338
  exports.formatAgentKpisMarkdownSection = formatAgentKpisMarkdownSection;
25339
+ exports.formatAisdlcVersionOutput = formatAisdlcVersionOutput;
25024
25340
  exports.formatCommitTrailers = formatCommitTrailers;
25025
25341
  exports.formatInspectResultMarkdown = formatInspectResultMarkdown;
25026
25342
  exports.formatPrKpiMarkdown = formatPrKpiMarkdown;
@@ -25046,6 +25362,7 @@ exports.generateSuppressionsAuditReport = generateSuppressionsAuditReport;
25046
25362
  exports.generateTestingCoverageReportMarkdown = generateTestingCoverageReportMarkdown;
25047
25363
  exports.generateThirdPartyNotices = generateThirdPartyNotices;
25048
25364
  exports.generateTraceabilityReportMarkdown = generateTraceabilityReportMarkdown;
25365
+ exports.getAisdlcVersion = getAisdlcVersion;
25049
25366
  exports.getArchitectureTemplates = getArchitectureTemplates;
25050
25367
  exports.getCodingRulesFilesForStacks = getCodingRulesFilesForStacks;
25051
25368
  exports.getCytoscapeScript = getCytoscapeScript;
@@ -25054,7 +25371,9 @@ exports.getNextCorrelativeNumber = getNextCorrelativeNumber;
25054
25371
  exports.getReferenceCodingRulesTemplates = getReferenceCodingRulesTemplates;
25055
25372
  exports.getSddAdapter = getSddAdapter;
25056
25373
  exports.getToolInstallSpec = getToolInstallSpec;
25374
+ exports.hasModalityDriverSignature = hasModalityDriverSignature;
25057
25375
  exports.inferArtifactTypeFromId = inferArtifactTypeFromId;
25376
+ exports.inferFallbackUiModality = inferFallbackUiModality;
25058
25377
  exports.inferMissingTrailers = inferMissingTrailers;
25059
25378
  exports.ingestSarifFiles = ingestSarifFiles;
25060
25379
  exports.ingestSbomFile = ingestSbomFile;
@@ -25081,6 +25400,7 @@ exports.isSemgrepInstalled = isSemgrepInstalled;
25081
25400
  exports.isToolAvailable = isToolAvailable;
25082
25401
  exports.isToolInstalled = isToolInstalled;
25083
25402
  exports.isUiComponentFile = isUiComponentFile;
25403
+ exports.isUiComponentTested = isUiComponentTested;
25084
25404
  exports.isUiTestFile = isUiTestFile;
25085
25405
  exports.isUncOrEmptyPath = isUncOrEmptyPath;
25086
25406
  exports.loadDlpPolicy = loadDlpPolicy;
@@ -25128,6 +25448,7 @@ exports.parseTasksFromContent = parseTasksFromContent;
25128
25448
  exports.parseTrivyOutput = parseTrivyOutput;
25129
25449
  exports.parseTrivyVulnerabilities = parseTrivyVulnerabilities;
25130
25450
  exports.processPackageDir = processPackageDir;
25451
+ exports.readAisdlcManifest = readAisdlcManifest;
25131
25452
  exports.readCodeCoverageSummary = readCodeCoverageSummary;
25132
25453
  exports.readFailOnMissingToolFromQualityPolicy = readFailOnMissingToolFromQualityPolicy;
25133
25454
  exports.readNormalizedCoverage = readNormalizedCoverage;
@@ -25194,6 +25515,7 @@ exports.serializeSarifDocument = serializeSarifDocument;
25194
25515
  exports.slugify = slugify2;
25195
25516
  exports.spawnTrustedBinary = spawnTrustedBinary;
25196
25517
  exports.stripMaskingCalls = stripMaskingCalls;
25518
+ exports.stripTestComments = stripTestComments;
25197
25519
  exports.stripVolatileReportMetadata = stripVolatileReportMetadata;
25198
25520
  exports.submitReviewReport = submitReviewReport;
25199
25521
  exports.syncPdacDigests = syncPdacDigests;
@@ -25224,6 +25546,7 @@ exports.walkMdFiles = walkMdFiles;
25224
25546
  exports.walkProjectFiles = walkProjectFiles;
25225
25547
  exports.walkSourceFiles = walkSourceFiles;
25226
25548
  exports.walkTaskFiles = walkTaskFiles;
25549
+ exports.writeAisdlcManifest = writeAisdlcManifest;
25227
25550
  exports.writeCucumberJsonReport = writeCucumberJsonReport;
25228
25551
  exports.writeCycloneDxSbom = writeCycloneDxSbom;
25229
25552
  exports.writeQualityBaseline = writeQualityBaseline;