@aisdlc/core 2.5.0 → 2.5.1

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
@@ -13819,6 +13819,7 @@ var SPECIALIZED_AGENT_TEMPLATES = [
13819
13819
  - Document critical technological decisions using immutable \`ADR-*\` records conforming to \`schemas/architecture/adr.schema.json\`.
13820
13820
  - Validate that architectural choices comply with legal constraints in \`license-policy.yaml\` and data protection constraints in \`privacy-policy.yaml\`.
13821
13821
  - **Technical Security & Privacy Feedback Loop**: If architectural decisions (databases, queues, distributed caching, third-party APIs, LLM providers, authentication schemes) introduce new attack vectors or PII data flows, emit a return handoff to \`agent-threat-modeler\` (which chains to \`agent-privacy-officer\`) for technical modeling prior to the testing phase.
13822
+ - **Mandatory Observability Component (\`CMP-OBSERVABILITY\`)**: In every system architecture modeled under arc42/NAF v4, the system architect MUST define an explicit building block \`CMP-OBSERVABILITY\` (Level 2/3) in Section 5 alongside Section 8 Cross-Cutting Concepts (\`ARCH-CROSS-*\`) and an immutable ADR for Runtime Observability, standardizing on: (1) Structured JSON logging with configurable granularity (\`LOG_LEVEL\`), (2) Distributed tracing via OpenTelemetry with W3C Trace Context (\`traceparent\`), and (3) Operational metrics (RED: Rate, Errors, Duration) in Prometheus / OpenMetrics format for Grafana scraping, satisfying \`QR-OBS-*\`.
13822
13823
  - If autonomy is $\\ge$ \`HUMAN_REVIEW_PLAN\`, conclude by emitting the Workflow Handoff block (\`templates/workflow/agent-handoff.template.md\`) suggesting \`agent-qa-engineer\` (or \`agent-threat-modeler\` if technical security/privacy loop is required) and opening the Human Action Window. In \`AUTONOMOUS\` mode, omit interactive handoff.`
13823
13824
  },
13824
13825
  {
@@ -13878,9 +13879,12 @@ Execute every implementation task following this strict sequential order:
13878
13879
  - **Zero Fake-Wiring Guardrail**: Strictly forbidden from marking a task \`COMPLETED\` with hardcoded \`mockData\` arrays in production views, \`setTimeout\` simulating network calls, or empty UI event handlers (\`onClick={() => {}}\`, \`onSubmit={() => {}}\`). Frontend components must wire directly to the shared contract and real Backend endpoints.
13879
13880
  - **Mandatory 4 UI States Matrix**: Every data-driven UI component or screen must explicitly implement all 4 usability states: \`Loading\` (spinner/skeleton + disabled submit), \`Empty\` (clear message + CTA), \`Error\` (visible error recovery banner, never silent failure), and \`Nominal/Success\` (accessible semantic DOM + keyboard navigation).
13880
13881
  - **Live Runtime Smoke Verification**: For tasks touching UI or UI-to-Backend integration, unit tests alone are insufficient. Before emitting handoff, boot the real Backend and Frontend servers and verify (via Playwright E2E or Chrome DevTools MCP) that browser \`console.error\` and \`pageerror\` counts are \`0\` and API calls return real \`2xx\` responses without CORS or schema mismatches.
13882
+ - **Mandatory Structured Logging & Observability**: Never emit unstructured console logs (\`console.log\`) in production code (\`no_console_logs_in_prod\`). Integrate the structured logger (\`ILogger\`) with configurable \`LOG_LEVEL\`, propagate W3C distributed trace context (\`trace_id\`), and record RED operational metrics compatible with Prometheus and Grafana.
13881
13883
  - Before adding any external dependency, verify its SPDX license is permitted in \`license-policy.yaml\`.
13882
13884
  - Respect non-negotiable \`quality-policy.yaml\` thresholds: Cyclomatic Complexity $\\le 10$, Cognitive Complexity $\\le 15$, Maintainability Index $\\ge 50$, Function Length $\\le 40$ lines.
13883
13885
  - Run unified pre-flight with auto-fix (\`pnpm run check:fix\`) and full verification (\`pnpm run verify:all\`).
13886
+ - **Mandatory Regression Verification**: Never declare build, typecheck, or bug fixes complete without executing the relevant automated test suite (\`pnpm test\`, \`dotnet test\`) and confirming zero regressions.
13887
+ - **Global Styles Protection**: When touching or refactoring frontend views, verify that global stylesheet/asset imports remain intact and that layouts suffer no visual disruption.
13884
13888
  - Upon completing green implementation, suggest handoff to \`agent-expert-user\` for Post-Development Functional Validation prior to security and privacy audit.`
13885
13889
  },
13886
13890
  {
@@ -14308,7 +14312,7 @@ This file defines the operational rules and specialized role mappings for Google
14308
14312
  - FORBIDDEN to include production code or anticipate implementations.
14309
14313
  - **Agreed Project Technology**: Always use the testing frameworks, E2E/UI runners, and technology stack agreed upon for the project (if any), without requiring the user to specify it in the prompt.
14310
14314
  - **Mandatory E2E & UI Testing**: Never forget or omit End-to-End (E2E) and User Interface (UI) tests.
14311
- - **Per-Interactive-Element Coverage**: Create specific tests for every UI element the user can interact with, covering Happy Path, Sad Path, and Boundary Values for each one.
14315
+ - **Per-Interactive-Element Coverage**: Create specific tests for every UI element the user can interact with, using external tools such as Playwright or FlatUI (or the agreed project testing technology), covering Happy Path, Sad Path, and Boundary Values for each one.
14312
14316
  - Every \`FR-*\` must have at least nominal + boundary + out-of-range scenarios; missing these blocks handoff to \`agent-developer\`.
14313
14317
  - Mandatory tags: \`@<FR-ID> @automated @regression\`.
14314
14318
  - Run \`pnpm run verify:testing\` before emitting handoff.
@@ -14321,6 +14325,8 @@ This file defines the operational rules and specialized role mappings for Google
14321
14325
  - Make tests delivered by \`agent-qa-engineer\` pass green without altering them to accommodate code.
14322
14326
  - Respect \`quality-policy.yaml\` thresholds: CC $\\le 10$, Cognitive $\\le 15$, MI $\\ge 50$, LOC $\\le 40$.
14323
14327
  - Run pre-flight with auto-fix: \`pnpm run check:fix\` and full verification: \`pnpm run verify:all\`.
14328
+ - **Mandatory Regression Verification**: Never declare build, typecheck, or bug fixes complete without executing the relevant automated test suite (\`pnpm test\`, \`dotnet test\`) and confirming zero regressions.
14329
+ - **Global Styles Protection**: When touching or refactoring frontend views, verify that global stylesheet/asset imports remain intact and that layouts suffer no visual disruption.
14324
14330
  - Upon completing green implementation, suggest handoff to \`agent-expert-user\` for post-development functional validation prior to security and privacy audit.
14325
14331
 
14326
14332
  ### 7. \`agent-security-auditor\` (Adversarial Code Auditor)
@@ -14493,6 +14499,8 @@ Canonical Reference: [\`process/09_agent_protocols.md\`](process/09_agent_protoc
14493
14499
  - Apply Test-Driven Development: generate unit tests before or alongside component logic.
14494
14500
  - Tag tests linked to requirements with header comments citing the ID (\`FR-*\`, \`SEC-REQ-*\`, or \`PRIV-REQ-*\`) to enable reverse traceability.
14495
14501
  - Suppressing types (\`any\`), linter rules (\`eslint-disable\`), or unit tests to force pipeline passage is prohibited.
14502
+ - **Mandatory Regression Verification**: Never declare build, typecheck, or bug fixes complete without executing the relevant automated test suite (\`pnpm test\`, \`dotnet test\`) and confirming zero regressions.
14503
+ - **Global Styles Protection**: When touching or refactoring frontend views, verify that global stylesheet/asset imports remain intact and that layouts suffer no visual disruption.
14496
14504
 
14497
14505
  ## 3. Open Source License Policy (\`license-policy.yaml\`)
14498
14506
  - Before adding any dependency to \`package.json\`, verify its SPDX identifier.
@@ -14567,11 +14575,11 @@ npx tsx packages/cli/src/index.ts sdd integrate --change <chg-id>
14567
14575
 
14568
14576
  ### 5. \`agent-qa-engineer\` (QA Engineer and SDET)
14569
14577
  - **Mission**: Translate approved requirements (\`FR-*\`, \`SEC-REQ-*\`, \`PRIV-REQ-*\`, \`QR-*\`) into comprehensive FAILING (red) BDD/Gherkin, End-to-End (E2E), UI, and unit test suites, before \`agent-developer\` writes production code.
14570
- - **Guardrails**: Always use the agreed project technology/testing stack (if any). Never omit End-to-End (E2E) and UI tests. Create specific tests for every interactive UI element covering Happy Path, Sad Path, and Boundary Values. FORBIDDEN to include production code. Mandatory tags: \`@<FR-ID> @automated @regression\`.
14578
+ - **Guardrails**: Always use the agreed project technology/testing stack (if any). Never omit End-to-End (E2E) and UI tests. Create specific tests for every interactive UI element using external tools such as Playwright or FlatUI (or the agreed project testing technology), covering Happy Path, Sad Path, and Boundary Values. FORBIDDEN to include production code. Mandatory tags: \`@<FR-ID> @automated @regression\`.
14571
14579
 
14572
14580
  ### 6. \`agent-developer\` (Software Developer)
14573
14581
  - **Mission**: Implement atomic tasks from SDD specifications (\`tasks.md\`) with clean, strictly typed code and thorough tests.
14574
- - **Directives**: Execute the mandatory 4-step order: (1) Modular & Hexagonal Architecture (Ports & Adapters) definition/redefinition, (2) Inter-module interfaces first, (3) Component implementation, (4) Per-function unit tests (Happy Path, Sad Path, Boundary Values, Unexpected/Null/Empty values). Respect the autonomy mode. Make tests delivered by \`agent-qa-engineer\` pass green. Run \`pnpm run check:fix\` and \`pnpm run verify:all\`.
14582
+ - **Directives**: Execute the mandatory 4-step order: (1) Modular & Hexagonal Architecture (Ports & Adapters) definition/redefinition, (2) Inter-module interfaces first, (3) Component implementation, (4) Per-function unit tests (Happy Path, Sad Path, Boundary Values, Unexpected/Null/Empty values). Respect the autonomy mode. Make tests delivered by \`agent-qa-engineer\` pass green. Run \`pnpm run check:fix\` and \`pnpm run verify:all\`. Enforce Mandatory Regression Verification (\`pnpm test\`) with zero regressions before declaring completion, and enforce Global Styles Protection on frontend views.
14575
14583
 
14576
14584
  ### 7. \`agent-security-auditor\` (Adversarial Code Auditor)
14577
14585
  - **Mission**: Examine Pull Requests for business logic vulnerabilities, injection vectors, secret leaks, and authorization flaws as part of the Pre-Merge Audit Triad.
@@ -16644,24 +16652,32 @@ function collectAgentFiles(targets) {
16644
16652
  appendMcpFiles(dirs, files);
16645
16653
  return { dirs, files };
16646
16654
  }
16647
- function writeProjectFiles(destDir, files, dryRun) {
16648
- const filesCreated = [];
16655
+ function writeSingleFile(fullFilePath, content, relPath, opts, results) {
16656
+ const exists = fs8__namespace.existsSync(fullFilePath);
16657
+ if (opts.dryRun) {
16658
+ if (exists && opts.force) results.filesUpdated.push(relPath);
16659
+ else if (!exists) results.filesCreated.push(relPath);
16660
+ return;
16661
+ }
16662
+ const parentDir = path5__namespace.dirname(fullFilePath);
16663
+ if (!fs8__namespace.existsSync(parentDir)) {
16664
+ fs8__namespace.mkdirSync(parentDir, { recursive: true });
16665
+ }
16666
+ if (!exists) {
16667
+ fs8__namespace.writeFileSync(fullFilePath, content, "utf-8");
16668
+ results.filesCreated.push(relPath);
16669
+ } else if (opts.force) {
16670
+ fs8__namespace.writeFileSync(fullFilePath, content, "utf-8");
16671
+ results.filesUpdated.push(relPath);
16672
+ }
16673
+ }
16674
+ function writeProjectFiles(destDir, files, dryRun, force) {
16675
+ const results = { filesCreated: [], filesUpdated: [] };
16649
16676
  for (const f of files) {
16650
16677
  const fullFilePath = path5__namespace.join(destDir, f.relPath);
16651
- const parentDir = path5__namespace.dirname(fullFilePath);
16652
- if (!dryRun) {
16653
- if (!fs8__namespace.existsSync(parentDir)) {
16654
- fs8__namespace.mkdirSync(parentDir, { recursive: true });
16655
- }
16656
- if (!fs8__namespace.existsSync(fullFilePath)) {
16657
- fs8__namespace.writeFileSync(fullFilePath, f.content, "utf-8");
16658
- filesCreated.push(f.relPath);
16659
- }
16660
- } else {
16661
- filesCreated.push(f.relPath);
16662
- }
16678
+ writeSingleFile(fullFilePath, f.content, f.relPath, { dryRun, force }, results);
16663
16679
  }
16664
- return filesCreated;
16680
+ return results;
16665
16681
  }
16666
16682
  function validateCiProvider(ci) {
16667
16683
  if (!ci) return { valid: true };
@@ -16816,6 +16832,7 @@ function buildInitError(targetDir, error) {
16816
16832
  targetDir,
16817
16833
  directoriesCreated: [],
16818
16834
  filesCreated: [],
16835
+ filesUpdated: [],
16819
16836
  agentsConfigured: [],
16820
16837
  gitHookInstalled: false,
16821
16838
  error
@@ -16828,12 +16845,13 @@ function mergeDirectories(base, extra) {
16828
16845
  }
16829
16846
  return result;
16830
16847
  }
16831
- function buildInitSuccessResult(destDir, directoriesCreated, filesCreated, ciProvider, agentsConfigured, architectureGranularity, gitHookInstalled) {
16848
+ function buildInitSuccessResult(destDir, directoriesCreated, filesCreated, filesUpdated, ciProvider, agentsConfigured, architectureGranularity, gitHookInstalled) {
16832
16849
  return {
16833
16850
  success: true,
16834
16851
  targetDir: destDir,
16835
16852
  directoriesCreated,
16836
16853
  filesCreated,
16854
+ filesUpdated,
16837
16855
  ciProvider,
16838
16856
  agentsConfigured,
16839
16857
  architectureGranularity,
@@ -16847,24 +16865,32 @@ function validateInitOptions(options) {
16847
16865
  if (!archRes.valid) return { valid: false, archGranularity: "minimal", error: archRes.error };
16848
16866
  return { valid: true, ciProvider: ciRes.provider, archGranularity: archRes.granularity };
16849
16867
  }
16868
+ function assembleScaffoldingPlan(ciProvider, agents, archGranularity) {
16869
+ const agentTargets = resolveAgentTargets(agents);
16870
+ const { dirs: agentDirs, files: agentFiles } = collectAgentFiles(agentTargets);
16871
+ const directories = mergeDirectories(getBaseDirectories(ciProvider), agentDirs);
16872
+ const starterFiles = collectStarterFiles(ciProvider, agentFiles, archGranularity);
16873
+ return { agentTargets, directories, starterFiles };
16874
+ }
16850
16875
  function initProject(options = {}) {
16851
- const baseDir = options.rootDir || process.cwd();
16852
- const destDir = path5__namespace.resolve(baseDir, options.targetDir || ".");
16876
+ const destDir = path5__namespace.resolve(options.rootDir || process.cwd(), options.targetDir || ".");
16853
16877
  const validated = validateInitOptions(options);
16854
16878
  if (!validated.valid) return buildInitError(destDir, validated.error);
16855
- const agentTargets = resolveAgentTargets(options.agents);
16856
- const { dirs: agentDirs, files: agentFiles } = collectAgentFiles(agentTargets);
16857
- const directories = mergeDirectories(getBaseDirectories(validated.ciProvider), agentDirs);
16858
- const directoriesCreated = createDirectoriesOnDisk(destDir, directories, options.dryRun);
16859
- const starterFiles = collectStarterFiles(validated.ciProvider, agentFiles, validated.archGranularity);
16860
- const filesCreated = writeProjectFiles(destDir, starterFiles, options.dryRun);
16879
+ const { agentTargets, directories, starterFiles } = assembleScaffoldingPlan(
16880
+ validated.ciProvider,
16881
+ options.agents,
16882
+ validated.archGranularity
16883
+ );
16884
+ const dirsCreated = createDirectoriesOnDisk(destDir, directories, options.dryRun);
16885
+ const { filesCreated, filesUpdated } = writeProjectFiles(destDir, starterFiles, options.dryRun, options.force);
16861
16886
  if (updateConsumerPackageJson(destDir, options.dryRun)) {
16862
16887
  filesCreated.push("package.json");
16863
16888
  }
16864
16889
  return buildInitSuccessResult(
16865
16890
  destDir,
16866
- directoriesCreated,
16891
+ dirsCreated,
16867
16892
  filesCreated,
16893
+ filesUpdated,
16868
16894
  validated.ciProvider,
16869
16895
  formatAgentsConfigured(agentTargets),
16870
16896
  validated.archGranularity,