@aisdlc/core 2.5.1 → 3.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/dist/index.cjs +658 -44
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +61 -15
- package/dist/index.d.ts +61 -15
- package/dist/index.js +656 -45
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2642,11 +2642,13 @@ function isProposalRequirementId(id) {
|
|
|
2642
2642
|
}
|
|
2643
2643
|
function buildSubgraphFromProposalIds(ids) {
|
|
2644
2644
|
const reqs = ids.filter(isProposalRequirementId);
|
|
2645
|
+
const ucs = ids.filter((id) => id.startsWith("UC-"));
|
|
2645
2646
|
const privReqs = ids.filter((id) => id.startsWith("PRIV-REQ-"));
|
|
2646
2647
|
const dataAssets = ids.filter((id) => id.startsWith("DATA-ASSET-"));
|
|
2647
2648
|
const ropaEntries = ids.filter((id) => id.startsWith("PRIV-ROPA-"));
|
|
2648
2649
|
return {
|
|
2649
2650
|
requirements: reqs,
|
|
2651
|
+
...ucs.length > 0 ? { useCases: ucs } : {},
|
|
2650
2652
|
...privReqs.length > 0 ? { privacyRequirements: privReqs } : {},
|
|
2651
2653
|
...dataAssets.length > 0 ? { dataAssets } : {},
|
|
2652
2654
|
...ropaEntries.length > 0 ? { ropaEntries } : {}
|
|
@@ -2759,23 +2761,45 @@ function collectCitedComponents(citations) {
|
|
|
2759
2761
|
}
|
|
2760
2762
|
return cited;
|
|
2761
2763
|
}
|
|
2762
|
-
function
|
|
2764
|
+
function collectDesignComponents(changeDir) {
|
|
2765
|
+
const designFile = path5__namespace.join(changeDir, "design.md");
|
|
2766
|
+
if (!fs8__namespace.existsSync(designFile)) return [];
|
|
2767
|
+
try {
|
|
2768
|
+
const { frontmatter } = parseFrontmatter(fs8__namespace.readFileSync(designFile, "utf-8"));
|
|
2769
|
+
const single = typeof frontmatter["architecture-component"] === "string" ? [frontmatter["architecture-component"]] : [];
|
|
2770
|
+
const multi = Array.isArray(frontmatter["architecture-components"]) ? frontmatter["architecture-components"].map(String) : [];
|
|
2771
|
+
return [...single, ...multi].filter(isArchitectureComponentId);
|
|
2772
|
+
} catch {
|
|
2773
|
+
return [];
|
|
2774
|
+
}
|
|
2775
|
+
}
|
|
2776
|
+
function matchesComponentScope(fm, targetReqs, targetUcs) {
|
|
2777
|
+
const satisfies = Array.isArray(fm["satisfies-requirements"]) ? fm["satisfies-requirements"] : [];
|
|
2778
|
+
const implementsUcs = Array.isArray(fm["implements-use-cases"]) ? fm["implements-use-cases"] : [];
|
|
2779
|
+
return targetReqs.some((r) => satisfies.includes(r)) || targetUcs.some((u) => implementsUcs.includes(u));
|
|
2780
|
+
}
|
|
2781
|
+
function collectSatisfyingComponents(canonicalArtifacts, targetReqs, targetUcs, cited) {
|
|
2763
2782
|
for (const [artId, art] of canonicalArtifacts.entries()) {
|
|
2764
2783
|
if (!artId.startsWith("CMP-") || !art.frontmatter) continue;
|
|
2765
|
-
|
|
2766
|
-
if (targetReqs.some((r) => satisfies.includes(r)) && !cited.includes(artId)) {
|
|
2784
|
+
if (matchesComponentScope(art.frontmatter, targetReqs, targetUcs) && !cited.includes(artId)) {
|
|
2767
2785
|
cited.push(artId);
|
|
2768
2786
|
}
|
|
2769
2787
|
}
|
|
2770
2788
|
}
|
|
2771
|
-
function collectArchitectureComponents(handoff, canonicalArtifacts, targetReqs) {
|
|
2789
|
+
function collectArchitectureComponents(handoff, canonicalArtifacts, targetReqs, targetUcs, changeDir) {
|
|
2772
2790
|
const cited = collectCitedComponents(handoff.citations);
|
|
2773
|
-
|
|
2791
|
+
for (const comp of collectDesignComponents(changeDir)) {
|
|
2792
|
+
if (!cited.includes(comp)) cited.push(comp);
|
|
2793
|
+
}
|
|
2794
|
+
collectSatisfyingComponents(canonicalArtifacts, targetReqs, targetUcs, cited);
|
|
2774
2795
|
return cited;
|
|
2775
2796
|
}
|
|
2776
2797
|
function isSatisfiableRequirementId(id) {
|
|
2777
2798
|
return id.startsWith("FR-") || id.startsWith("QR-") || id.startsWith("CON-") || id.startsWith("SEC-REQ-") || id.startsWith("PRIV-REQ-");
|
|
2778
2799
|
}
|
|
2800
|
+
function isImplementableUseCaseId(id) {
|
|
2801
|
+
return id.startsWith("UC-");
|
|
2802
|
+
}
|
|
2779
2803
|
function mergeSatisfiesRequirements(fm, targetReqs) {
|
|
2780
2804
|
const existing = Array.isArray(fm["satisfies-requirements"]) ? [...fm["satisfies-requirements"]] : [];
|
|
2781
2805
|
let modified = false;
|
|
@@ -2789,9 +2813,27 @@ function mergeSatisfiesRequirements(fm, targetReqs) {
|
|
|
2789
2813
|
fm["satisfies-requirements"] = existing;
|
|
2790
2814
|
return modified;
|
|
2791
2815
|
}
|
|
2792
|
-
function
|
|
2816
|
+
function mergeImplementsUseCases(fm, targetUcs) {
|
|
2817
|
+
const existing = Array.isArray(fm["implements-use-cases"]) ? [...fm["implements-use-cases"]] : [];
|
|
2818
|
+
let modified = false;
|
|
2819
|
+
for (const uc of targetUcs) {
|
|
2820
|
+
if (!isImplementableUseCaseId(uc)) continue;
|
|
2821
|
+
if (!existing.includes(uc)) {
|
|
2822
|
+
existing.push(uc);
|
|
2823
|
+
modified = true;
|
|
2824
|
+
}
|
|
2825
|
+
}
|
|
2826
|
+
fm["implements-use-cases"] = existing;
|
|
2827
|
+
return modified;
|
|
2828
|
+
}
|
|
2829
|
+
function syncComponentRelations(fm, targetReqs, targetUcs) {
|
|
2830
|
+
const reqMod = mergeSatisfiesRequirements(fm, targetReqs);
|
|
2831
|
+
const ucMod = mergeImplementsUseCases(fm, targetUcs);
|
|
2832
|
+
return reqMod || ucMod;
|
|
2833
|
+
}
|
|
2834
|
+
function updateSingleArchitectureComponent(canonical, cmpId, targetReqs, targetUcs, changeId, date, author) {
|
|
2793
2835
|
const fm = canonical.frontmatter;
|
|
2794
|
-
const modified = cmpId.startsWith("CMP-") ?
|
|
2836
|
+
const modified = cmpId.startsWith("CMP-") ? syncComponentRelations(fm, targetReqs, targetUcs) : false;
|
|
2795
2837
|
const updatedBody = appendRevisionHistoryRow(canonical.body, {
|
|
2796
2838
|
version: String(fm.version || "1.0.0"),
|
|
2797
2839
|
date,
|
|
@@ -2805,13 +2847,13 @@ function updateSingleArchitectureComponent(canonical, cmpId, targetReqs, changeI
|
|
|
2805
2847
|
}
|
|
2806
2848
|
return false;
|
|
2807
2849
|
}
|
|
2808
|
-
function updateArchitectureComponents(citedComponents, canonicalArtifacts, targetReqs, changeId, date, author, errors) {
|
|
2850
|
+
function updateArchitectureComponents(citedComponents, canonicalArtifacts, targetReqs, targetUcs, changeId, date, author, errors) {
|
|
2809
2851
|
const updated = [];
|
|
2810
2852
|
for (const cmpId of citedComponents) {
|
|
2811
2853
|
const canonical = canonicalArtifacts.get(cmpId);
|
|
2812
2854
|
if (!canonical) continue;
|
|
2813
2855
|
try {
|
|
2814
|
-
if (updateSingleArchitectureComponent(canonical, cmpId, targetReqs, changeId, date, author)) {
|
|
2856
|
+
if (updateSingleArchitectureComponent(canonical, cmpId, targetReqs, targetUcs, changeId, date, author)) {
|
|
2815
2857
|
updated.push(cmpId);
|
|
2816
2858
|
}
|
|
2817
2859
|
} catch (err) {
|
|
@@ -2929,13 +2971,34 @@ function resolveTargetRequirements(handoff, changeDir) {
|
|
|
2929
2971
|
])
|
|
2930
2972
|
);
|
|
2931
2973
|
}
|
|
2974
|
+
function collectSpecUseCases(changeDir) {
|
|
2975
|
+
const specFile = path5__namespace.join(changeDir, "spec.md");
|
|
2976
|
+
if (!fs8__namespace.existsSync(specFile)) return [];
|
|
2977
|
+
try {
|
|
2978
|
+
const { affectedItems, newItems } = parseSpecCatalogScope(fs8__namespace.readFileSync(specFile, "utf-8"));
|
|
2979
|
+
return [...affectedItems, ...newItems].map((i) => i.id).filter((id) => id && id.startsWith("UC-"));
|
|
2980
|
+
} catch {
|
|
2981
|
+
return [];
|
|
2982
|
+
}
|
|
2983
|
+
}
|
|
2984
|
+
function collectTargetUseCases(handoff, changeDir) {
|
|
2985
|
+
const subUcs = (handoff.subgraph?.useCases || []).filter((uc) => uc.startsWith("UC-"));
|
|
2986
|
+
const citeUcs = (handoff.citations || []).map((c) => c.targetId || c.id).filter((id) => typeof id === "string" && id.startsWith("UC-"));
|
|
2987
|
+
const specUcs = collectSpecUseCases(changeDir);
|
|
2988
|
+
return Array.from(/* @__PURE__ */ new Set([...subUcs, ...citeUcs, ...specUcs]));
|
|
2989
|
+
}
|
|
2990
|
+
function syncArchitectureArtifacts(handoff, canonicalArtifacts, targetReqs, targetUcs, changeDir, ctx, errors) {
|
|
2991
|
+
const cited = collectArchitectureComponents(handoff, canonicalArtifacts, targetReqs, targetUcs, changeDir);
|
|
2992
|
+
return updateArchitectureComponents(cited, canonicalArtifacts, targetReqs, targetUcs, ctx.changeId, ctx.date, ctx.author, errors);
|
|
2993
|
+
}
|
|
2932
2994
|
function applyArtifactUpdates(ctx, changeDir, handoff, completedTasks, errors) {
|
|
2933
2995
|
const targetReqs = resolveTargetRequirements(handoff, changeDir);
|
|
2996
|
+
const targetUcs = collectTargetUseCases(handoff, changeDir);
|
|
2934
2997
|
const createdArtifacts = materializeNewCatalogArtifacts(changeDir, ctx.rootDir, ctx.changeId, ctx.author, ctx.date, errors);
|
|
2935
2998
|
const canonicalArtifacts = loadCanonicalArtifacts(ctx.rootDir);
|
|
2936
|
-
const
|
|
2937
|
-
const
|
|
2938
|
-
const updatedArch =
|
|
2999
|
+
const productIds = Array.from(/* @__PURE__ */ new Set([...targetReqs, ...targetUcs]));
|
|
3000
|
+
const updatedProduct = updateRequirementsArtifacts(productIds, createdArtifacts, canonicalArtifacts, completedTasks, ctx.changeId, ctx.date, ctx.author, errors);
|
|
3001
|
+
const updatedArch = syncArchitectureArtifacts(handoff, canonicalArtifacts, targetReqs, targetUcs, changeDir, ctx, errors);
|
|
2939
3002
|
return { targetReqs, updatedProduct, updatedArch, createdArtifacts };
|
|
2940
3003
|
}
|
|
2941
3004
|
function integrateSddChange(options) {
|
|
@@ -3487,7 +3550,7 @@ function syncPdacDigests(options = {}) {
|
|
|
3487
3550
|
// src/init/starter-schemas.ts
|
|
3488
3551
|
var SCHEMA_SCHEMAS_ARCHITECTURE_ADR_SCHEMA_JSON = '{\r\n "$schema": "https://json-schema.org/draft/2020-12/schema",\r\n "$id": "https://ai-sdlc.org/schemas/architecture/adr.schema.json",\r\n "title": "Architecture Decision Record Schema (Versionable)",\r\n "type": "object",\r\n "required": ["id", "type", "title", "status", "version", "deciders", "decision-date"],\r\n "properties": {\r\n "id": {\r\n "type": "string",\r\n "pattern": "^ADR-[0-9]{3,4}(-[A-Z0-9]+)*$"\r\n },\r\n "type": {\r\n "type": "string",\r\n "const": "architecture-decision-record"\r\n },\r\n "version": {\r\n "type": "string",\r\n "pattern": "^[0-9]+\\\\.[0-9]+\\\\.[0-9]+(-[0-9A-Za-z.-]+)?$",\r\n "description": "Decision record semantic version (SemVer)."\r\n },\r\n "schema-version": {\r\n "type": "string"\r\n },\r\n "title": {\r\n "type": "string",\r\n "minLength": 3\r\n },\r\n "status": {\r\n "type": "string",\r\n "enum": ["proposed", "accepted", "rejected", "deprecated", "superseded"]\r\n },\r\n "deciders": {\r\n "type": "array",\r\n "minItems": 1,\r\n "items": { "type": "string" }\r\n },\r\n "decision-date": {\r\n "type": "string",\r\n "format": "date"\r\n },\r\n "affects-components": {\r\n "type": "array",\r\n "items": {\r\n "type": "string",\r\n "pattern": "^CMP-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n }\r\n },\r\n "supersedes": {\r\n "type": ["string", "null"],\r\n "pattern": "^ADR-[0-9]{3,4}(-[A-Z0-9]+)*$"\r\n },\r\n "superseded-by": {\r\n "type": ["string", "null"],\r\n "pattern": "^ADR-[0-9]{3,4}(-[A-Z0-9]+)*$"\r\n }\r\n },\r\n "additionalProperties": false\r\n}\r\n';
|
|
3489
3552
|
var SCHEMA_SCHEMAS_ARCHITECTURE_COMPONENT_SCHEMA_JSON = '{\r\n "$schema": "https://json-schema.org/draft/2020-12/schema",\r\n "$id": "https://ai-sdlc.org/schemas/architecture/component.schema.json",\r\n "title": "NAF v4 / arc42 Architecture Component Schema (Multilevel)",\r\n "type": "object",\r\n "required": [\r\n "id",\r\n "type",\r\n "title",\r\n "status",\r\n "version",\r\n "level",\r\n "implementation-type",\r\n "implements-use-cases"\r\n ],\r\n "properties": {\r\n "id": {\r\n "type": "string",\r\n "pattern": "^CMP-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "type": {\r\n "type": "string",\r\n "const": "component"\r\n },\r\n "version": {\r\n "type": "string",\r\n "pattern": "^[0-9]+\\\\.[0-9]+\\\\.[0-9]+(-[0-9A-Za-z.-]+)?$",\r\n "description": "Architecture component semantic version (SemVer)."\r\n },\r\n "schema-version": {\r\n "type": "string"\r\n },\r\n "title": {\r\n "type": "string",\r\n "minLength": 3\r\n },\r\n "status": {\r\n "type": "string",\r\n "enum": ["proposed", "accepted", "deprecated", "retired"]\r\n },\r\n "level": {\r\n "type": "integer",\r\n "minimum": 1,\r\n "description": "Hierarchical architecture level (1: Bounded Context / Root System, 2: Subsystem / Container, 3: Executable Unit / DLL / Function)."\r\n },\r\n "bounded-context": {\r\n "type": "string",\r\n "description": "Domain-Driven Design (DDD) Bounded Context name this component belongs to."\r\n },\r\n "parent-component": {\r\n "type": ["string", "null"],\r\n "pattern": "^CMP-[A-Z0-9]+(-[A-Z0-9]+)*$",\r\n "description": "Parent component identifier (null if Level 1)."\r\n },\r\n "implementation-type": {\r\n "type": "string",\r\n "enum": ["service", "dll", "function", "composite"],\r\n "description": "Technical implementation paradigm: distributed service (service), dynamic/native library (dll), in-process module/function (function), or logical aggregator/Bounded Context (composite)."\r\n },\r\n "implements-use-cases": {\r\n "type": "array",\r\n "minItems": 1,\r\n "items": {\r\n "type": "string",\r\n "pattern": "^UC-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n }\r\n },\r\n "satisfies-requirements": {\r\n "type": "array",\r\n "items": {\r\n "type": "string",\r\n "pattern": "^(FR|QR|CON|SEC-REQ|SAF-REQ|PRIV-REQ)-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n }\r\n },\r\n "hosted-in-enclave": {\r\n "type": "string",\r\n "pattern": "^SEC-ENC-[A-Z0-9]+(-[A-Z0-9]+)*$",\r\n "description": "Security enclave where the component resides (optional for DLLs or in-process functions)."\r\n },\r\n "interfaces": {\r\n "type": "array",\r\n "items": {\r\n "type": "object",\r\n "required": ["name", "protocol"],\r\n "properties": {\r\n "name": { "type": "string" },\r\n "protocol": {\r\n "type": "string",\r\n "enum": [\r\n "REST/HTTP",\r\n "gRPC",\r\n "WebSocket",\r\n "Kafka",\r\n "MQTT",\r\n "C-ABI",\r\n "Native-ABI",\r\n "FFI",\r\n "In-Process API",\r\n "Function-Call",\r\n "CLI",\r\n "GUI",\r\n "IPC"\r\n ]\r\n },\r\n "contract-spec": { "type": "string" }\r\n }\r\n }\r\n },\r\n "supersedes": {\r\n "type": ["string", "null"],\r\n "pattern": "^CMP-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "superseded-by": {\r\n "type": ["string", "null"],\r\n "pattern": "^CMP-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n }\r\n },\r\n "additionalProperties": false\r\n}\r\n';
|
|
3490
|
-
var SCHEMA_SCHEMAS_ARCHITECTURE_INTRODUCTION_AND_GOALS_SCHEMA_JSON = '{\r\n "$schema": "https://json-schema.org/draft/2020-12/schema",\r\n "$id": "https://ai-sdlc.org/schemas/architecture/introduction-and-goals.schema.json",\r\n "title": "NAF v4 Enterprise & Capability / arc42 Introduction and System Goals Schema",\r\n "type": "object",\r\n "required": [\r\n "id",\r\n "type",\r\n "title",\r\n "status",\r\n "version",\r\n "naf-perspective",\r\n "cites-product-actors",\r\n "cites-quality-goals",\r\n "cites-
|
|
3553
|
+
var SCHEMA_SCHEMAS_ARCHITECTURE_INTRODUCTION_AND_GOALS_SCHEMA_JSON = '{\r\n "$schema": "https://json-schema.org/draft/2020-12/schema",\r\n "$id": "https://ai-sdlc.org/schemas/architecture/introduction-and-goals.schema.json",\r\n "title": "NAF v4 Enterprise & Capability / arc42 Introduction and System Goals Schema",\r\n "type": "object",\r\n "required": [\r\n "id",\r\n "type",\r\n "title",\r\n "status",\r\n "version",\r\n "naf-perspective",\r\n "cites-product-actors",\r\n "cites-quality-goals",\r\n "cites-journeys"\r\n ],\r\n "properties": {\r\n "id": {\r\n "type": "string",\r\n "pattern": "^ARCH-INTRO-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "type": {\r\n "type": "string",\r\n "const": "architecture-introduction"\r\n },\r\n "version": {\r\n "type": "string",\r\n "pattern": "^[0-9]+\\\\.[0-9]+\\\\.[0-9]+(-[0-9A-Za-z.-]+)?$",\r\n "description": "Artifact semantic version (SemVer)."\r\n },\r\n "schema-version": {\r\n "type": "string"\r\n },\r\n "title": {\r\n "type": "string",\r\n "minLength": 3\r\n },\r\n "status": {\r\n "type": "string",\r\n "enum": ["draft", "proposed", "accepted", "approved", "deprecated", "superseded"]\r\n },\r\n "owner": {\r\n "type": "string"\r\n },\r\n "arc42-section": {\r\n "type": "integer",\r\n "const": 1\r\n },\r\n "naf-perspective": {\r\n "type": "string",\r\n "const": "Enterprise & Capability"\r\n },\r\n "cites-product-actors": {\r\n "type": "array",\r\n "minItems": 1,\r\n "items": {\r\n "type": "string",\r\n "pattern": "^ACT-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n }\r\n },\r\n "cites-quality-goals": {\r\n "type": "array",\r\n "minItems": 1,\r\n "items": {\r\n "type": "string",\r\n "pattern": "^(QR|SEC-REQ|PRIV-REQ)-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n }\r\n },\r\n "cites-journeys": {\r\n "type": "array",\r\n "minItems": 1,\r\n "items": {\r\n "type": "string",\r\n "pattern": "^JRN-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "description": "Product journey identifiers (JRN-*) envisioned in this system capability scope."\r\n },\r\n "supersedes": {\r\n "type": ["string", "null"],\r\n "pattern": "^ARCH-INTRO-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "superseded-by": {\r\n "type": ["string", "null"],\r\n "pattern": "^ARCH-INTRO-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n }\r\n },\r\n "additionalProperties": false\r\n}\r\n';
|
|
3491
3554
|
var SCHEMA_SCHEMAS_COMPLIANCE_LICENSE_MANIFEST_SCHEMA_JSON = '{\r\n "$schema": "https://json-schema.org/draft/2020-12/schema",\r\n "$id": "https://ai-sdlc.org/schemas/compliance/license-manifest.schema.json",\r\n "title": "Static Dependencies License Manifest Schema",\r\n "type": "object",\r\n "required": ["evaluated_dependencies"],\r\n "properties": {\r\n "id": {\r\n "type": "string",\r\n "pattern": "^(MAN-LIC|LIC-MAN|LIC)-[A-Z0-9]+(-[A-Z0-9]+)*$",\r\n "description": "Optional canonical artifact identifier."\r\n },\r\n "type": {\r\n "type": "string",\r\n "const": "license-manifest"\r\n },\r\n "version": {\r\n "type": "string",\r\n "pattern": "^[0-9]+\\\\.[0-9]+(\\\\.[0-9]+)?(-[0-9A-Za-z.-]+)?$",\r\n "description": "Manifest format version."\r\n },\r\n "schema-version": {\r\n "type": "string"\r\n },\r\n "description": {\r\n "type": "string"\r\n },\r\n "generated_at": {\r\n "type": "string"\r\n },\r\n "evaluated_dependencies": {\r\n "type": "array",\r\n "minItems": 1,\r\n "items": {\r\n "type": "object",\r\n "required": ["package", "version", "spdx_license", "status"],\r\n "properties": {\r\n "package": {\r\n "type": "string",\r\n "minLength": 1\r\n },\r\n "version": {\r\n "type": "string",\r\n "minLength": 1\r\n },\r\n "spdx_license": {\r\n "type": "string",\r\n "minLength": 1\r\n },\r\n "status": {\r\n "type": "string",\r\n "enum": [\r\n "APPROVED",\r\n "REJECTED",\r\n "REVIEW_REQUIRED",\r\n "COMMERCIAL_APPROVAL_REQUIRED",\r\n "PENDING"\r\n ]\r\n },\r\n "reason": {\r\n "type": "string"\r\n },\r\n "approved_by": {\r\n "type": "string"\r\n }\r\n },\r\n "additionalProperties": false\r\n }\r\n }\r\n },\r\n "additionalProperties": false\r\n}\r\n';
|
|
3492
3555
|
var SCHEMA_SCHEMAS_COMPLIANCE_LICENSE_POLICY_SCHEMA_JSON = '{\r\n "$schema": "https://json-schema.org/draft/2020-12/schema",\r\n "$id": "https://ai-sdlc.org/schemas/compliance/license-policy.schema.json",\r\n "title": "Open Source License Policy Schema",\r\n "type": "object",\r\n "required": ["version", "project", "default_action", "categories", "agent_guardrails", "ci_gates"],\r\n "properties": {\r\n "version": {\r\n "type": "string"\r\n },\r\n "project": {\r\n "type": "string"\r\n },\r\n "default_action": {\r\n "type": "string",\r\n "enum": ["ALLOW", "DENY", "REVIEW_REQUIRED"]\r\n },\r\n "categories": {\r\n "type": "object"\r\n },\r\n "agent_guardrails": {\r\n "type": "object",\r\n "required": ["enforce_pre_check", "reject_unknown_licenses"],\r\n "properties": {\r\n "enforce_pre_check": { "type": "boolean" },\r\n "reject_unknown_licenses": { "type": "boolean" },\r\n "auto_reject_categories": { "type": "array", "items": { "type": "string" } },\r\n "on_commercial_detected": { "type": "object" }\r\n }\r\n },\r\n "ci_gates": {\r\n "type": "object",\r\n "required": ["fail_on_denied", "generate_sbom"],\r\n "properties": {\r\n "fail_on_denied": { "type": "boolean" },\r\n "fail_on_missing_license": { "type": "boolean" },\r\n "generate_sbom": { "type": "boolean" },\r\n "sbom_format": { "type": "string" },\r\n "output_notices_file": { "type": "string" },\r\n "allowed_depth": { "type": "string", "enum": ["DIRECT", "TRANSITIVE"] }\r\n }\r\n }\r\n },\r\n "additionalProperties": false\r\n}\r\n';
|
|
3493
3556
|
var SCHEMA_SCHEMAS_COMPLIANCE_QUALITY_POLICY_SCHEMA_JSON = '{\r\n "$schema": "https://json-schema.org/draft/2020-12/schema",\r\n "$id": "https://ai-sdlc.org/schemas/compliance/quality-policy.schema.json",\r\n "title": "Software Quality Policy Schema (Polyglot)",\r\n "type": "object",\r\n "required": ["version", "project", "enforcement_mode", "coding_rules", "release_thresholds", "agent_guardrails"],\r\n "properties": {\r\n "version": { "type": "string" },\r\n "project": { "type": "string" },\r\n "enforcement_mode": { "type": "string", "enum": ["STRICT", "PERMISSIVE"] },\r\n "ratchet_mode": { "type": "boolean" },\r\n "scope": {\r\n "type": "object",\r\n "properties": {\r\n "target_directories": { "type": "array", "items": { "type": "string" } },\r\n "supported_extensions": { "type": "array", "items": { "type": "string" } },\r\n "exclude_patterns": { "type": "array", "items": { "type": "string" } }\r\n }\r\n },\r\n "language_toolchains": {\r\n "type": "object"\r\n },\r\n "coding_rules": {\r\n "type": "object",\r\n "required": ["standards", "enforce_formatting", "rules"],\r\n "properties": {\r\n "standards": { "type": "array", "items": { "type": "string" } },\r\n "enforce_formatting": { "type": "boolean" },\r\n "formatting_engine": { "type": "string" },\r\n "linter_engine": { "type": "string" },\r\n "rules": { "type": "object" }\r\n }\r\n },\r\n "release_thresholds": {\r\n "type": "object",\r\n "required": ["cyclomatic_complexity", "cognitive_complexity", "maintainability_index", "code_duplication", "test_coverage"],\r\n "properties": {\r\n "cyclomatic_complexity": {\r\n "type": "object",\r\n "required": ["max_per_function", "action_on_breach"],\r\n "properties": {\r\n "max_per_function": { "type": "integer" },\r\n "warning_at": { "type": "integer" },\r\n "action_on_breach": { "type": "string" }\r\n }\r\n },\r\n "cognitive_complexity": {\r\n "type": "object",\r\n "required": ["max_per_function", "action_on_breach"],\r\n "properties": {\r\n "max_per_function": { "type": "integer" },\r\n "warning_at": { "type": "integer" },\r\n "action_on_breach": { "type": "string" }\r\n }\r\n },\r\n "maintainability_index": {\r\n "type": "object",\r\n "required": ["min_acceptable_score", "action_on_breach"],\r\n "properties": {\r\n "min_acceptable_score": { "type": "number" },\r\n "target_score": { "type": "number" },\r\n "action_on_breach": { "type": "string" }\r\n }\r\n },\r\n "code_duplication": {\r\n "type": "object",\r\n "required": ["max_percentage", "action_on_breach"],\r\n "properties": {\r\n "max_percentage": { "type": "number" },\r\n "action_on_breach": { "type": "string" }\r\n }\r\n },\r\n "test_coverage": {\r\n "type": "object",\r\n "required": ["min_line_coverage_percent", "action_on_breach"],\r\n "properties": {\r\n "min_line_coverage_percent": { "type": "number" },\r\n "min_branch_coverage_percent": { "type": "number" },\r\n "min_function_coverage_percent": { "type": "number" },\r\n "action_on_breach": { "type": "string" }\r\n }\r\n },\r\n "technical_debt": {\r\n "type": "object"\r\n }\r\n }\r\n },\r\n "agent_guardrails": {\r\n "type": "object",\r\n "required": ["enforce_pre_commit_linter", "prevent_suppression_comments"],\r\n "properties": {\r\n "enforce_pre_commit_linter": { "type": "boolean" },\r\n "prevent_suppression_comments": { "type": "boolean" },\r\n "auto_refactor_on_high_complexity": { "type": "boolean" }\r\n }\r\n }\r\n },\r\n "additionalProperties": false\r\n}\r\n';
|
|
@@ -3499,7 +3562,7 @@ var SCHEMA_SCHEMAS_PRIVACY_PRIVACY_POLICY_SCHEMA_JSON = '{\r\n "$schema": "http
|
|
|
3499
3562
|
var SCHEMA_SCHEMAS_PRIVACY_PRIVACY_REQ_SCHEMA_JSON = '{\r\n "$schema": "https://json-schema.org/draft/2020-12/schema",\r\n "$id": "https://ai-sdlc.org/schemas/privacy/privacy-req.schema.json",\r\n "title": "Privacy Requirement & Technical Control Schema (PRIV-REQ-*)",\r\n "type": "object",\r\n "required": [\r\n "id",\r\n "type",\r\n "title",\r\n "status",\r\n "version",\r\n "privacy-principle",\r\n "linddun-category",\r\n "governs-ropa"\r\n ],\r\n "properties": {\r\n "id": {\r\n "type": "string",\r\n "pattern": "^PRIV-REQ-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "type": {\r\n "type": "string",\r\n "const": "privacy-requirement"\r\n },\r\n "version": {\r\n "type": "string",\r\n "pattern": "^[0-9]+\\\\.[0-9]+\\\\.[0-9]+(-[0-9A-Za-z.-]+)?$",\r\n "description": "Privacy requirement semantic version (SemVer)."\r\n },\r\n "schema-version": {\r\n "type": "string"\r\n },\r\n "title": {\r\n "type": "string",\r\n "minLength": 3\r\n },\r\n "status": {\r\n "type": "string",\r\n "enum": ["draft", "active", "deprecated", "retired"]\r\n },\r\n "privacy-principle": {\r\n "type": "string",\r\n "enum": [\r\n "data-minimization",\r\n "purpose-limitation",\r\n "storage-limitation",\r\n "accuracy",\r\n "integrity-and-confidentiality",\r\n "transparency-and-consent",\r\n "data-subject-rights-arco",\r\n "pseudonymization-anonymization"\r\n ]\r\n },\r\n "linddun-category": {\r\n "type": "string",\r\n "enum": [\r\n "linkability",\r\n "identifiability",\r\n "non-repudiation",\r\n "detectability",\r\n "disclosure-of-information",\r\n "unawareness",\r\n "non-compliance"\r\n ],\r\n "description": "LINDDUN privacy threat category mitigated by this control."\r\n },\r\n "governs-ropa": {\r\n "type": "array",\r\n "minItems": 1,\r\n "items": {\r\n "type": "string",\r\n "pattern": "^PRIV-ROPA-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "description": "Upstream ROPA records (PRIV-ROPA-*) governed by this privacy requirement."\r\n },\r\n "protects-data-assets": {\r\n "type": "array",\r\n "items": {\r\n "type": "string",\r\n "pattern": "^DATA-ASSET-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n }\r\n },\r\n "enforced-in-enclave": {\r\n "type": "string",\r\n "pattern": "^SEC-ENC-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "compliance-references": {\r\n "type": "array",\r\n "items": {\r\n "type": "string"\r\n }\r\n },\r\n "acceptance-format": {\r\n "type": "string",\r\n "enum": ["gherkin", "declarative-prose"]\r\n },\r\n "cucumber-tags": {\r\n "type": "array",\r\n "items": {\r\n "type": "string",\r\n "pattern": "^@[a-zA-Z0-9_-]+$"\r\n }\r\n },\r\n "supersedes": {\r\n "type": ["string", "null"],\r\n "pattern": "^PRIV-REQ-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "superseded-by": {\r\n "type": ["string", "null"],\r\n "pattern": "^PRIV-REQ-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n }\r\n },\r\n "additionalProperties": false\r\n}\r\n';
|
|
3500
3563
|
var SCHEMA_SCHEMAS_PRIVACY_PRIVACY_ROPA_SCHEMA_JSON = '{\r\n "$schema": "https://json-schema.org/draft/2020-12/schema",\r\n "$id": "https://ai-sdlc.org/schemas/privacy/privacy-ropa.schema.json",\r\n "title": "Record of Processing Activities Schema (PRIV-ROPA-* / GDPR Art. 30)",\r\n "type": "object",\r\n "required": [\r\n "id",\r\n "type",\r\n "title",\r\n "status",\r\n "version",\r\n "lawful-basis",\r\n "processing-purpose",\r\n "use-cases",\r\n "data-assets",\r\n "data-subjects",\r\n "retention-ttl"\r\n ],\r\n "properties": {\r\n "id": {\r\n "type": "string",\r\n "pattern": "^PRIV-ROPA-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "type": {\r\n "type": "string",\r\n "const": "privacy-ropa"\r\n },\r\n "version": {\r\n "type": "string",\r\n "pattern": "^[0-9]+\\\\.[0-9]+\\\\.[0-9]+(-[0-9A-Za-z.-]+)?$",\r\n "description": "ROPA record semantic version (SemVer)."\r\n },\r\n "schema-version": {\r\n "type": "string"\r\n },\r\n "title": {\r\n "type": "string",\r\n "minLength": 3\r\n },\r\n "status": {\r\n "type": "string",\r\n "enum": ["draft", "active", "deprecated", "retired"]\r\n },\r\n "lawful-basis": {\r\n "type": "string",\r\n "enum": [\r\n "consent",\r\n "contract",\r\n "legal-obligation",\r\n "vital-interests",\r\n "public-task",\r\n "legitimate-interests"\r\n ],\r\n "description": "Lawful basis for processing under GDPR Art. 6.1."\r\n },\r\n "special-category-condition": {\r\n "type": ["string", "null"],\r\n "enum": [\r\n null,\r\n "explicit-consent",\r\n "employment-social-security",\r\n "vital-interests",\r\n "public-interest",\r\n "preventive-medicine",\r\n "public-health"\r\n ],\r\n "description": "GDPR Art. 9.2 condition when processing special category data."\r\n },\r\n "processing-purpose": {\r\n "type": "string",\r\n "minLength": 10\r\n },\r\n "use-cases": {\r\n "type": "array",\r\n "minItems": 1,\r\n "items": {\r\n "type": "string",\r\n "pattern": "^UC-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "description": "Upstream Use Cases (UC-*) that trigger this data processing activity."\r\n },\r\n "data-assets": {\r\n "type": "array",\r\n "minItems": 1,\r\n "items": {\r\n "type": "string",\r\n "pattern": "^DATA-ASSET-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "description": "Personal Data Assets (DATA-ASSET-*) processed in this activity."\r\n },\r\n "data-subjects": {\r\n "type": "array",\r\n "minItems": 1,\r\n "items": {\r\n "type": "string",\r\n "pattern": "^ACT-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n }\r\n },\r\n "retention-ttl": {\r\n "type": "string",\r\n "pattern": "^([0-9]+(d|m|y)|session-only|indefinite-anonymized)$"\r\n },\r\n "cross-border-transfer": {\r\n "type": "boolean"\r\n },\r\n "transfer-safeguards": {\r\n "type": ["string", "null"],\r\n "enum": [null, "adequacy-decision", "scc", "bcr", "derogation"]\r\n },\r\n "subprocessors": {\r\n "type": "array",\r\n "items": {\r\n "type": "string"\r\n }\r\n },\r\n "dpia-required": {\r\n "type": "boolean"\r\n },\r\n "dpia-reference": {\r\n "type": ["string", "null"],\r\n "pattern": "^DPIA-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "mitigated-by": {\r\n "type": "array",\r\n "items": {\r\n "type": "string",\r\n "pattern": "^PRIV-REQ-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "description": "Privacy requirements (PRIV-REQ-*) governing and enforcing this processing activity."\r\n },\r\n "supersedes": {\r\n "type": ["string", "null"],\r\n "pattern": "^PRIV-ROPA-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "superseded-by": {\r\n "type": ["string", "null"],\r\n "pattern": "^PRIV-ROPA-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n }\r\n },\r\n "additionalProperties": false\r\n}\r\n';
|
|
3501
3564
|
var SCHEMA_SCHEMAS_PRODUCT_ACTOR_SCHEMA_JSON = '{\r\n "$schema": "https://json-schema.org/draft/2020-12/schema",\r\n "$id": "https://ai-sdlc.org/schemas/product/actor.schema.json",\r\n "title": "ProductShape Actor Schema (Versionable)",\r\n "type": "object",\r\n "required": ["id", "type", "title", "status", "version", "role-type"],\r\n "properties": {\r\n "id": {\r\n "type": "string",\r\n "pattern": "^ACT-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "type": {\r\n "type": "string",\r\n "const": "actor"\r\n },\r\n "version": {\r\n "type": "string",\r\n "pattern": "^[0-9]+\\\\.[0-9]+\\\\.[0-9]+(-[0-9A-Za-z.-]+)?$",\r\n "description": "Artifact semantic version (SemVer)."\r\n },\r\n "schema-version": {\r\n "type": "string",\r\n "description": "Schema specification version used."\r\n },\r\n "title": {\r\n "type": "string",\r\n "minLength": 3\r\n },\r\n "status": {\r\n "type": "string",\r\n "enum": ["draft", "active", "deprecated", "retired"]\r\n },\r\n "role-type": {\r\n "type": "string",\r\n "enum": ["human-user", "ai-agent", "external-system", "sensor-iot"]\r\n },\r\n "description": {\r\n "type": "string"\r\n },\r\n "supersedes": {\r\n "type": ["string", "null"],\r\n "pattern": "^ACT-[A-Z0-9]+(-[A-Z0-9]+)*$",\r\n "description": "Identifier of the actor superseded by this version or artifact."\r\n },\r\n "superseded-by": {\r\n "type": ["string", "null"],\r\n "pattern": "^ACT-[A-Z0-9]+(-[A-Z0-9]+)*$",\r\n "description": "Identifier of the new actor superseding this one upon deprecation/retirement."\r\n }\r\n },\r\n "additionalProperties": false\r\n}\r\n';
|
|
3502
|
-
var SCHEMA_SCHEMAS_PRODUCT_BOUNDED_CONTEXT_SCHEMA_JSON = '{\n "$schema": "https://json-schema.org/draft/2020-12/schema",\n "$id": "https://ai-sdlc.org/schemas/product/bounded-context.schema.json",\n "title": "Domain-Driven Design (DDD) Bounded Context Schema",\n "type": "object",\n "required": [\n "id",\n "type",\n "title",\n "status",\n "version",\n "domain-type",\n "responsibilities"\n ],\n "properties": {\n "id": {\n "type": "string",\n "pattern": "^BC-[A-Z0-9]+(-[A-Z0-9]+)*$",\n "description": "Immutable Bounded Context identifier (e.g. BC-AI-SDLC-GOVERNANCE)."\n },\n "type": {\n "type": "string",\n "const": "bounded-context"\n },\n "version": {\n "type": "string",\n "pattern": "^[0-9]+\\\\.[0-9]+\\\\.[0-9]+(-[0-9A-Za-z.-]+)?$",\n "description": "Bounded context document semantic version (SemVer)."\n },\n "schema-version": {\n "type": "string",\n "description": "Template schema version."\n },\n "title": {\n "type": "string",\n "minLength": 3,\n "description": "Descriptive title of the Bounded Context."\n },\n "status": {\n "type": "string",\n "enum": ["draft", "active", "deprecated", "retired"]\n },\n "domain-type": {\n "type": "string",\n "enum": ["core", "supporting", "generic"],\n "description": "DDD subdomain classification: core differentiator, supporting capability, or generic commodity."\n },\n "strategic-classification": {\n "type": "object",\n "properties": {\n "evolutionary-stage": {\n "type": "string",\n "enum": ["genesis", "custom-built", "product-rental", "commodity"]\n },\n "business-model-role": {\n "type": "string",\n "enum": ["differentiator", "operational", "enabler"]\n }\n },\n "additionalProperties": false\n },\n "responsibilities": {\n "type": "array",\n "items": {\n "type": "string",\n "minLength": 3\n },\n "minItems": 1,\n "description": "List of functional boundaries and core domain responsibilities encapsulated within this context."\n },\n "ubiquitous-language-terms": {\n "type": "array",\n "items": {\n "type": "string",\n "pattern": "^TERM-[A-Z0-9]+(-[A-Z0-9]+)*$"\n },\n "description": "Ubiquitous language terms (TERM-*) governed within this bounded context."\n },\n "context-mapping": {\n "type": "object",\n "properties": {\n "upstream-dependencies": {\n "type": "array",\n "items": {\n "type": "string"\n }\n },\n "downstream-dependents": {\n "type": "array",\n "items": {\n "type": "string"\n }\n },\n "integration-patterns": {\n "type": "array",\n "items": {\n "type": "object",\n "properties": {\n "pattern": {\n "type": "string"\n },\n "related-context": {\n "type": "string"\n }\n },\n "additionalProperties": false\n }\n }\n },\n "additionalProperties": false\n },\n "components-involved": {\n "type": "array",\n "items": {\n "type": "string",\n "pattern": "^CMP-[A-Z0-9]+(-[A-Z0-9]+)*$"\n },\n "description": "Architecture components (CMP-*) implementing this bounded context."\n },\n "supersedes": {\n "type": ["string", "null"],\n "pattern": "^BC-[A-Z0-9]+(-[A-Z0-9]+)*$"\n },\n "superseded-by": {\n "type": ["string", "null"],\n "pattern": "^BC-[A-Z0-9]+(-[A-Z0-9]+)*$"\n }\n },\n "additionalProperties": false\n}\n';
|
|
3565
|
+
var SCHEMA_SCHEMAS_PRODUCT_BOUNDED_CONTEXT_SCHEMA_JSON = '{\r\n "$schema": "https://json-schema.org/draft/2020-12/schema",\r\n "$id": "https://ai-sdlc.org/schemas/product/bounded-context.schema.json",\r\n "title": "Domain-Driven Design (DDD) Bounded Context Schema",\r\n "type": "object",\r\n "required": [\r\n "id",\r\n "type",\r\n "title",\r\n "status",\r\n "version",\r\n "domain-type",\r\n "responsibilities"\r\n ],\r\n "properties": {\r\n "id": {\r\n "type": "string",\r\n "pattern": "^BC-[A-Z0-9]+(-[A-Z0-9]+)*$",\r\n "description": "Immutable Bounded Context identifier (e.g. BC-AI-SDLC-GOVERNANCE)."\r\n },\r\n "type": {\r\n "type": "string",\r\n "const": "bounded-context"\r\n },\r\n "version": {\r\n "type": "string",\r\n "pattern": "^[0-9]+\\\\.[0-9]+\\\\.[0-9]+(-[0-9A-Za-z.-]+)?$",\r\n "description": "Bounded context document semantic version (SemVer)."\r\n },\r\n "schema-version": {\r\n "type": "string",\r\n "description": "Template schema version."\r\n },\r\n "title": {\r\n "type": "string",\r\n "minLength": 3,\r\n "description": "Descriptive title of the Bounded Context."\r\n },\r\n "status": {\r\n "type": "string",\r\n "enum": ["draft", "active", "deprecated", "retired"]\r\n },\r\n "domain-type": {\r\n "type": "string",\r\n "enum": ["core", "supporting", "generic"],\r\n "description": "DDD subdomain classification: core differentiator, supporting capability, or generic commodity."\r\n },\r\n "strategic-classification": {\r\n "type": "object",\r\n "properties": {\r\n "evolutionary-stage": {\r\n "type": "string",\r\n "enum": ["genesis", "custom-built", "product-rental", "commodity"]\r\n },\r\n "business-model-role": {\r\n "type": "string",\r\n "enum": ["differentiator", "operational", "enabler"]\r\n }\r\n },\r\n "additionalProperties": false\r\n },\r\n "responsibilities": {\r\n "type": "array",\r\n "items": {\r\n "type": "string",\r\n "minLength": 3\r\n },\r\n "minItems": 1,\r\n "description": "List of functional boundaries and core domain responsibilities encapsulated within this context."\r\n },\r\n "ubiquitous-language-terms": {\r\n "type": "array",\r\n "items": {\r\n "type": "string",\r\n "pattern": "^TERM-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "description": "Ubiquitous language terms (TERM-*) governed within this bounded context."\r\n },\r\n "context-mapping": {\r\n "type": "object",\r\n "properties": {\r\n "upstream-dependencies": {\r\n "type": "array",\r\n "items": {\r\n "type": "string"\r\n }\r\n },\r\n "downstream-dependents": {\r\n "type": "array",\r\n "items": {\r\n "type": "string"\r\n }\r\n },\r\n "integration-patterns": {\r\n "type": "array",\r\n "items": {\r\n "type": "object",\r\n "properties": {\r\n "pattern": {\r\n "type": "string"\r\n },\r\n "related-context": {\r\n "type": "string"\r\n }\r\n },\r\n "additionalProperties": false\r\n }\r\n }\r\n },\r\n "additionalProperties": false\r\n },\r\n "components-involved": {\r\n "type": "array",\r\n "items": {\r\n "type": "string",\r\n "pattern": "^CMP-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "description": "Architecture components (CMP-*) implementing this bounded context."\r\n },\r\n "supersedes": {\r\n "type": ["string", "null"],\r\n "pattern": "^BC-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "superseded-by": {\r\n "type": ["string", "null"],\r\n "pattern": "^BC-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n }\r\n },\r\n "additionalProperties": false\r\n}\r\n';
|
|
3503
3566
|
var SCHEMA_SCHEMAS_PRODUCT_BUSINESS_RULE_SCHEMA_JSON = '{\r\n "$schema": "https://json-schema.org/draft/2020-12/schema",\r\n "$id": "https://ai-sdlc.org/schemas/product/business-rule.schema.json",\r\n "title": "ProductShape Business Rule Schema (Versionable)",\r\n "type": "object",\r\n "required": ["id", "type", "title", "status", "version", "enforcement-level"],\r\n "properties": {\r\n "id": {\r\n "type": "string",\r\n "pattern": "^BR-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "type": {\r\n "type": "string",\r\n "const": "business-rule"\r\n },\r\n "version": {\r\n "type": "string",\r\n "pattern": "^[0-9]+\\\\.[0-9]+\\\\.[0-9]+(-[0-9A-Za-z.-]+)?$",\r\n "description": "Business rule semantic version (SemVer)."\r\n },\r\n "schema-version": {\r\n "type": "string"\r\n },\r\n "title": {\r\n "type": "string",\r\n "minLength": 3\r\n },\r\n "status": {\r\n "type": "string",\r\n "enum": ["draft", "active", "deprecated", "retired"]\r\n },\r\n "enforcement-level": {\r\n "type": "string",\r\n "enum": ["strict-invariant", "override-with-approval", "guideline"]\r\n },\r\n "defined-in": {\r\n "type": "string",\r\n "pattern": "^BC-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "uses-terms": {\r\n "type": "array",\r\n "items": {\r\n "type": "string",\r\n "pattern": "^TERM-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n }\r\n },\r\n "supersedes": {\r\n "type": ["string", "null"],\r\n "pattern": "^BR-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "superseded-by": {\r\n "type": ["string", "null"],\r\n "pattern": "^BR-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n }\r\n },\r\n "additionalProperties": false\r\n}\r\n';
|
|
3504
3567
|
var SCHEMA_SCHEMAS_PRODUCT_JOURNEY_SCHEMA_JSON = '{\r\n "$schema": "https://json-schema.org/draft/2020-12/schema",\r\n "$id": "https://ai-sdlc.org/schemas/product/journey.schema.json",\r\n "title": "Customer / Operator Journey Schema",\r\n "type": "object",\r\n "required": [\r\n "id",\r\n "type",\r\n "title",\r\n "status",\r\n "version",\r\n "persona",\r\n "stages",\r\n "touchpoints"\r\n ],\r\n "properties": {\r\n "id": {\r\n "type": "string",\r\n "pattern": "^JRN-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "type": {\r\n "type": "string",\r\n "const": "journey"\r\n },\r\n "version": {\r\n "type": "string",\r\n "pattern": "^[0-9]+\\\\.[0-9]+\\\\.[0-9]+(-[0-9A-Za-z.-]+)?$",\r\n "description": "Journey semantic version (SemVer)."\r\n },\r\n "schema-version": {\r\n "type": "string"\r\n },\r\n "title": {\r\n "type": "string",\r\n "minLength": 3\r\n },\r\n "status": {\r\n "type": "string",\r\n "enum": ["draft", "active", "deprecated", "retired"]\r\n },\r\n "persona": {\r\n "type": "string",\r\n "pattern": "^ACT-[A-Z0-9]+(-[A-Z0-9]+)*$",\r\n "description": "Actor (persona) starring in this journey."\r\n },\r\n "stages": {\r\n "type": "array",\r\n "minItems": 1,\r\n "items": {\r\n "type": "string"\r\n },\r\n "description": "Sequential journey stages (e.g. Awareness, Onboarding, Activation, Retention)."\r\n },\r\n "touchpoints": {\r\n "type": "array",\r\n "minItems": 1,\r\n "items": {\r\n "type": "string"\r\n },\r\n "description": "Touchpoints between persona and system at each stage."\r\n },\r\n "related-use-cases": {\r\n "type": "array",\r\n "items": {\r\n "type": "string",\r\n "pattern": "^UC-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "description": "System use cases related to this journey."\r\n },\r\n "pain-points": {\r\n "type": "array",\r\n "items": {\r\n "type": "string"\r\n },\r\n "description": "Frictions or issues detected along the user journey."\r\n },\r\n "supersedes": {\r\n "type": ["string", "null"]\r\n },\r\n "superseded-by": {\r\n "type": ["string", "null"]\r\n }\r\n },\r\n "additionalProperties": false\r\n}\r\n';
|
|
3505
3568
|
var SCHEMA_SCHEMAS_PRODUCT_REQUIREMENT_SCHEMA_JSON = '{\r\n "$schema": "https://json-schema.org/draft/2020-12/schema",\r\n "$id": "https://ai-sdlc.org/schemas/product/requirement.schema.json",\r\n "title": "ProductShape Requirement Schema (Strict Test Validation Enforced)",\r\n "type": "object",\r\n "required": ["id", "type", "title", "status", "version", "category", "derives-from", "verifiable-by"],\r\n "properties": {\r\n "id": {\r\n "type": "string",\r\n "pattern": "^(FR|QR|CON)-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "type": {\r\n "type": "string",\r\n "const": "requirement"\r\n },\r\n "version": {\r\n "type": "string",\r\n "pattern": "^[0-9]+\\\\.[0-9]+\\\\.[0-9]+(-[0-9A-Za-z.-]+)?$",\r\n "description": "Requirement semantic version (SemVer)."\r\n },\r\n "schema-version": {\r\n "type": "string"\r\n },\r\n "title": {\r\n "type": "string",\r\n "minLength": 3\r\n },\r\n "status": {\r\n "type": "string",\r\n "enum": ["draft", "active", "deprecated", "retired"]\r\n },\r\n "category": {\r\n "type": "string",\r\n "enum": ["functional", "quality", "constraint"]\r\n },\r\n "derives-from": {\r\n "type": "array",\r\n "minItems": 1,\r\n "items": {\r\n "type": "string",\r\n "pattern": "^(UC|BR|CON|CAP|GOAL)-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "description": "Product Traceability: Origin Use Cases, Rules, Constraints, or Capabilities."\r\n },\r\n "verifiable-by": {\r\n "type": "string",\r\n "enum": ["cucumber-bdd", "automated-unit-test", "integration-test", "performance-benchmark", "security-audit", "inspection"],\r\n "description": "Mandatory formal verification method."\r\n },\r\n "acceptance-format": {\r\n "type": "string",\r\n "enum": ["gherkin", "declarative-prose"],\r\n "description": "Acceptance criteria format."\r\n },\r\n "cucumber-tags": {\r\n "type": "array",\r\n "items": {\r\n "type": "string",\r\n "pattern": "^@[a-zA-Z0-9_-]+$"\r\n },\r\n "description": "Cucumber tags for filtering and executing BDD tests."\r\n },\r\n "enforce-bdd-variants": {\r\n "type": "boolean",\r\n "description": "When true, enforces all 3 BDD scenario categories (@nominal, @boundary, @invalid)."\r\n },\r\n "supersedes": {\r\n "type": ["string", "null"],\r\n "pattern": "^(FR|QR|CON)-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n },\r\n "superseded-by": {\r\n "type": ["string", "null"],\r\n "pattern": "^(FR|QR|CON)-[A-Z0-9]+(-[A-Z0-9]+)*$"\r\n }\r\n },\r\n "additionalProperties": false\r\n}\r\n';
|
|
@@ -6848,7 +6911,7 @@ function resolveProjectIdentity(options) {
|
|
|
6848
6911
|
function buildBomMetadata(name, version, rootDir) {
|
|
6849
6912
|
return {
|
|
6850
6913
|
timestamp: resolveDeterministicDate(rootDir).toISOString(),
|
|
6851
|
-
tools: [{ vendor: "AI-SDLC", name: "@aisdlc/core", version: "
|
|
6914
|
+
tools: [{ vendor: "AI-SDLC", name: "@aisdlc/core", version: "3.0.0" }],
|
|
6852
6915
|
component: { type: "application", name, version }
|
|
6853
6916
|
};
|
|
6854
6917
|
}
|
|
@@ -7359,7 +7422,7 @@ function isPathProtectedFromPatch(filePath) {
|
|
|
7359
7422
|
const normalized = filePath.replace(/\\/g, "/");
|
|
7360
7423
|
return PROTECTED_BYPASS_PATTERNS.some((pattern) => pattern.test(normalized));
|
|
7361
7424
|
}
|
|
7362
|
-
function
|
|
7425
|
+
function detectCurrentBranch(rootDir) {
|
|
7363
7426
|
let branch = "";
|
|
7364
7427
|
if (fs8__namespace.existsSync(path5__namespace.join(rootDir, ".git"))) {
|
|
7365
7428
|
try {
|
|
@@ -7371,20 +7434,25 @@ function detectBranchChangeMatch(rootDir, dirs) {
|
|
|
7371
7434
|
} catch {
|
|
7372
7435
|
}
|
|
7373
7436
|
}
|
|
7374
|
-
if (!branch) {
|
|
7437
|
+
if (!branch && path5__namespace.resolve(rootDir) === path5__namespace.resolve(process.cwd())) {
|
|
7375
7438
|
const ciBranch = (process.env.GITHUB_HEAD_REF || process.env.GITHUB_REF_NAME || process.env.CI_COMMIT_REF_NAME || process.env.BRANCH_NAME || "").toLowerCase();
|
|
7376
7439
|
branch = ciBranch;
|
|
7377
7440
|
}
|
|
7378
|
-
|
|
7379
|
-
return dirs.find((d) => branch.includes(path5__namespace.basename(d).toLowerCase()));
|
|
7441
|
+
return branch;
|
|
7380
7442
|
}
|
|
7381
7443
|
function resolveActiveChangeDir(rootDir) {
|
|
7382
7444
|
const activeRoot = path5__namespace.join(rootDir, "specs", "changes", "active");
|
|
7383
7445
|
if (!fs8__namespace.existsSync(activeRoot)) return void 0;
|
|
7384
7446
|
try {
|
|
7385
7447
|
const dirs = fs8__namespace.readdirSync(activeRoot, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => path5__namespace.join(activeRoot, d.name)).sort((a, b) => canonicalSort(a, b));
|
|
7386
|
-
const
|
|
7387
|
-
if (
|
|
7448
|
+
const branch = detectCurrentBranch(rootDir);
|
|
7449
|
+
if (branch) {
|
|
7450
|
+
const branchMatch = dirs.find((d) => branch.includes(path5__namespace.basename(d).toLowerCase()));
|
|
7451
|
+
if (branchMatch) return branchMatch;
|
|
7452
|
+
if (!branch.startsWith("patch")) {
|
|
7453
|
+
return void 0;
|
|
7454
|
+
}
|
|
7455
|
+
}
|
|
7388
7456
|
return dirs.find((d) => detectProfileFromChange(d) === "patch") || dirs[0];
|
|
7389
7457
|
} catch {
|
|
7390
7458
|
return void 0;
|
|
@@ -10425,6 +10493,35 @@ function detectAuthorIdentity(options = {}) {
|
|
|
10425
10493
|
activeTimeSeconds: 0
|
|
10426
10494
|
};
|
|
10427
10495
|
}
|
|
10496
|
+
var PRE_COMMIT_SCRIPT = `#!/usr/bin/env bash
|
|
10497
|
+
# ==============================================================================
|
|
10498
|
+
# AI-SDLC: Universal Protected Branches Guard (pre-commit)
|
|
10499
|
+
# ==============================================================================
|
|
10500
|
+
|
|
10501
|
+
CURRENT_BRANCH=$(git symbolic-ref --short HEAD 2>/dev/null || git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "")
|
|
10502
|
+
|
|
10503
|
+
if [ -z "$CURRENT_BRANCH" ] || [ "$CURRENT_BRANCH" = "HEAD" ]; then
|
|
10504
|
+
exit 0
|
|
10505
|
+
fi
|
|
10506
|
+
|
|
10507
|
+
# Protected branches regex: main, master, release/*, release/v*
|
|
10508
|
+
if echo "$CURRENT_BRANCH" | grep -qE "^(main|master|release/.*)$"; then
|
|
10509
|
+
echo "" >&2
|
|
10510
|
+
echo "\u274C [AI-SDLC Security Guard] BLOCKED: Direct commits to protected branch '$CURRENT_BRANCH' are forbidden!" >&2
|
|
10511
|
+
echo "--------------------------------------------------------------------------------" >&2
|
|
10512
|
+
echo "Direct commits on protected branches violate the AI-SDLC 4-Tier Branching Policy." >&2
|
|
10513
|
+
echo "You must create and switch to a dedicated working branch before committing:" >&2
|
|
10514
|
+
echo "" >&2
|
|
10515
|
+
echo " git checkout -b feat/<CHG-ID>-<slug>" >&2
|
|
10516
|
+
echo " or" >&2
|
|
10517
|
+
echo " git checkout -b task/<PARENT-ID>/<TSK-ID>-<slug>" >&2
|
|
10518
|
+
echo "--------------------------------------------------------------------------------" >&2
|
|
10519
|
+
echo "" >&2
|
|
10520
|
+
exit 1
|
|
10521
|
+
fi
|
|
10522
|
+
|
|
10523
|
+
exit 0
|
|
10524
|
+
`;
|
|
10428
10525
|
var PREPARE_COMMIT_MSG_SCRIPT = `#!/usr/bin/env bash
|
|
10429
10526
|
# ==============================================================================
|
|
10430
10527
|
# AI-SDLC: Automated Commit Trailers Injection Hook
|
|
@@ -10438,7 +10535,7 @@ if [ "$COMMIT_SOURCE" = "merge" ]; then
|
|
|
10438
10535
|
exit 0
|
|
10439
10536
|
fi
|
|
10440
10537
|
|
|
10441
|
-
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "")
|
|
10538
|
+
CURRENT_BRANCH=$(git symbolic-ref --short HEAD 2>/dev/null || git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "")
|
|
10442
10539
|
if [ -z "$CURRENT_BRANCH" ]; then
|
|
10443
10540
|
exit 0
|
|
10444
10541
|
fi
|
|
@@ -10539,18 +10636,21 @@ function installGitHooks(rootDir = process.cwd()) {
|
|
|
10539
10636
|
if (!fs8__namespace.existsSync(hooksDir)) {
|
|
10540
10637
|
fs8__namespace.mkdirSync(hooksDir, { recursive: true });
|
|
10541
10638
|
}
|
|
10542
|
-
const
|
|
10639
|
+
const prepareCommitMsgPath = path5__namespace.join(hooksDir, "prepare-commit-msg");
|
|
10640
|
+
const preCommitPath = path5__namespace.join(hooksDir, "pre-commit");
|
|
10543
10641
|
try {
|
|
10544
|
-
fs8__namespace.writeFileSync(
|
|
10642
|
+
fs8__namespace.writeFileSync(prepareCommitMsgPath, PREPARE_COMMIT_MSG_SCRIPT, { encoding: "utf-8", mode: 493 });
|
|
10643
|
+
fs8__namespace.writeFileSync(preCommitPath, PRE_COMMIT_SCRIPT, { encoding: "utf-8", mode: 493 });
|
|
10545
10644
|
return {
|
|
10546
10645
|
success: true,
|
|
10547
|
-
hookPath
|
|
10646
|
+
hookPath: prepareCommitMsgPath,
|
|
10647
|
+
installedHooks: [prepareCommitMsgPath, preCommitPath]
|
|
10548
10648
|
};
|
|
10549
10649
|
} catch (err) {
|
|
10550
10650
|
const msg = err instanceof Error ? err.message : String(err);
|
|
10551
10651
|
return {
|
|
10552
10652
|
success: false,
|
|
10553
|
-
error: `Error al escribir
|
|
10653
|
+
error: `Error al escribir hooks en '${hooksDir}': ${msg}`
|
|
10554
10654
|
};
|
|
10555
10655
|
}
|
|
10556
10656
|
}
|
|
@@ -11229,7 +11329,7 @@ function connectTargets(sourceId, rawTargets, relation, nodeMap, addEdge, defaul
|
|
|
11229
11329
|
function connectIntroRelationships(art, nodeMap, addEdge) {
|
|
11230
11330
|
const fm = art.frontmatter;
|
|
11231
11331
|
connectTargets(art.id, fm["cites-product-actors"], "identifies", nodeMap, addEdge, "actor", "product");
|
|
11232
|
-
connectTargets(art.id, fm["cites-
|
|
11332
|
+
connectTargets(art.id, fm["cites-journeys"], "envisions", nodeMap, addEdge, "journey", "product");
|
|
11233
11333
|
const citedGoals = fm["cites-quality-goals"];
|
|
11234
11334
|
const list = Array.isArray(citedGoals) ? citedGoals : [];
|
|
11235
11335
|
for (const qrId of list) {
|
|
@@ -13736,6 +13836,8 @@ var SPECIALIZED_AGENT_TEMPLATES = [
|
|
|
13736
13836
|
title: "Product Analyst / Scribe",
|
|
13737
13837
|
description: "Assist the human Product Owner in exploring, modeling, and refining product definition using NAF v4 Enterprise & Capability Vision (ARCH-INTRO-*) and ProductShape (ACT-*, UC-*, FR-*, QR-*, BR-*).",
|
|
13738
13838
|
globs: "product/**, specs/product/**, templates/product/**, templates/architecture/introduction-and-goals.template.md",
|
|
13839
|
+
claudeTools: ["View", "Edit", "Replace", "GlobTool", "GrepTool", "LS", "Bash"],
|
|
13840
|
+
antigravityTools: ["read_file", "edit_file", "write_file", "run_command", "call_mcp_tool", "ask_question"],
|
|
13739
13841
|
body: `## Role & Mission
|
|
13740
13842
|
- **Role**: Product Analyst Agent (\`agent-product-analyst\`) and Technical Scribe (AI as Scribe) of the AI-SDLC framework.
|
|
13741
13843
|
- **Mission**: Capture new product intent via NAF v4 Enterprise & Capability Vision (\`ARCH-INTRO-*\`) and transform natural language business intent into canonical ProductShape artifacts (\`ACT-*\`, \`JRN-*\`, \`UC-*\`, \`BR-*\`, \`TERM-*\`, \`FR-*\`, \`QR-*\`) 100% compliant with JSON schemas.
|
|
@@ -13761,6 +13863,8 @@ var SPECIALIZED_AGENT_TEMPLATES = [
|
|
|
13761
13863
|
title: "Threat Modeler and Security Specialist",
|
|
13762
13864
|
description: "Analyze business use cases and architecture artifacts to proactively model STRIDE adversaries, abuse cases, and OWASP ASVS security requirements.",
|
|
13763
13865
|
globs: "security/**, specs/security/**, architecture/**",
|
|
13866
|
+
claudeTools: ["View", "Edit", "Replace", "GlobTool", "GrepTool", "LS", "Bash"],
|
|
13867
|
+
antigravityTools: ["read_file", "edit_file", "write_file", "run_command", "call_mcp_tool"],
|
|
13764
13868
|
body: `## Role & Mission
|
|
13765
13869
|
- **Role**: Threat Modeling and Shift-Left Cybersecurity Specialist Agent (\`agent-threat-modeler\`).
|
|
13766
13870
|
- **Mission**: Analyze business use cases and architecture artifacts to proactively model adversaries, STRIDE attack vectors, and OWASP ASVS mitigation requirements.
|
|
@@ -13782,6 +13886,8 @@ var SPECIALIZED_AGENT_TEMPLATES = [
|
|
|
13782
13886
|
title: "Data Protection & Privacy-by-Design Specialist",
|
|
13783
13887
|
description: "Model personal data assets (DATA-ASSET-*), GDPR Art. 30 records of processing (PRIV-ROPA-*), and LINDDUN/ISO 27701 privacy requirements (PRIV-REQ-*) on handoff from cybersecurity, and audit code diffs against privacy-policy.yaml.",
|
|
13784
13888
|
globs: "privacy/**, specs/privacy/**, privacy-policy.yaml, templates/privacy/**, schemas/privacy/**",
|
|
13889
|
+
claudeTools: ["View", "Edit", "Replace", "GlobTool", "GrepTool", "LS", "Bash"],
|
|
13890
|
+
antigravityTools: ["read_file", "edit_file", "write_file", "run_command", "call_mcp_tool"],
|
|
13785
13891
|
body: `## Role & Mission
|
|
13786
13892
|
- **Role**: Data Protection & Privacy-by-Design Specialist Agent (\`agent-privacy-officer\`).
|
|
13787
13893
|
- **Mission**: Receive the handoff from \`agent-threat-modeler\` to model personal data assets (\`DATA-ASSET-*\`), GDPR Art. 30 records of processing (\`PRIV-ROPA-*\`), and LINDDUN / GDPR Art. 25 / ISO 27701 privacy requirements (\`PRIV-REQ-*\`), and audit code changes in Pre-Merge against \`privacy-policy.yaml\`.
|
|
@@ -13807,6 +13913,8 @@ var SPECIALIZED_AGENT_TEMPLATES = [
|
|
|
13807
13913
|
title: "System Architect",
|
|
13808
13914
|
description: "Translate approved product and security definitions into modular technical architecture based on arc42 enriched with NAF v4 (CMP-*, ADR-*).",
|
|
13809
13915
|
globs: "architecture/**, specs/changes/**/design.md, templates/architecture/**",
|
|
13916
|
+
claudeTools: ["View", "Edit", "Replace", "GlobTool", "GrepTool", "LS", "Bash"],
|
|
13917
|
+
antigravityTools: ["read_file", "edit_file", "write_file", "run_command", "call_mcp_tool"],
|
|
13810
13918
|
body: `## Role & Mission
|
|
13811
13919
|
- **Role**: System Architect Agent (\`agent-system-architect\`) of the AI-SDLC framework.
|
|
13812
13920
|
- **Mission**: Translate approved product definition into a modular technical architecture based on arc42 enriched with NAF v4.
|
|
@@ -13827,6 +13935,8 @@ var SPECIALIZED_AGENT_TEMPLATES = [
|
|
|
13827
13935
|
title: "QA Engineer and SDET",
|
|
13828
13936
|
description: "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 production code is written.",
|
|
13829
13937
|
globs: "tests/**, specs/changes/**/spec.md",
|
|
13938
|
+
claudeTools: ["View", "Edit", "Replace", "GlobTool", "GrepTool", "LS", "Bash"],
|
|
13939
|
+
antigravityTools: ["read_file", "edit_file", "write_file", "run_command", "call_mcp_tool"],
|
|
13830
13940
|
body: `## Role & Mission
|
|
13831
13941
|
- **Role**: QA Engineer and SDET (Software Development Engineer in Test) Agent (\`agent-qa-engineer\`).
|
|
13832
13942
|
- **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 a single line of production code.
|
|
@@ -13856,6 +13966,8 @@ var SPECIALIZED_AGENT_TEMPLATES = [
|
|
|
13856
13966
|
title: "Software Developer",
|
|
13857
13967
|
description: "Implement atomic tasks from SDD specifications (tasks.md) delivering clean, strictly typed, and tested code satisfying quality-policy.yaml thresholds.",
|
|
13858
13968
|
globs: "src/**, packages/**, tests/**, specs/changes/**",
|
|
13969
|
+
claudeTools: ["View", "Edit", "Replace", "GlobTool", "GrepTool", "LS", "Bash"],
|
|
13970
|
+
antigravityTools: ["read_file", "edit_file", "write_file", "run_command", "call_mcp_tool"],
|
|
13859
13971
|
body: `## Role & Mission
|
|
13860
13972
|
- **Role**: High-Precision Software Developer / Coder Agent (\`agent-developer\`).
|
|
13861
13973
|
- **Mission**: Implement atomic tasks from SDD specifications (\`tasks.md\`) delivering clean, strictly typed, and tested code.
|
|
@@ -13892,6 +14004,8 @@ Execute every implementation task following this strict sequential order:
|
|
|
13892
14004
|
title: "Adversarial Code Auditor",
|
|
13893
14005
|
description: "Examine Pull Requests and source code with an attacker mindset for business logic vulnerabilities, injection vectors, secret leaks, and authorization flaws.",
|
|
13894
14006
|
globs: "src/**, packages/**, security/**",
|
|
14007
|
+
claudeTools: ["View", "GlobTool", "GrepTool", "LS", "Bash"],
|
|
14008
|
+
antigravityTools: ["read_file", "run_command", "call_mcp_tool"],
|
|
13895
14009
|
body: `## Role & Mission
|
|
13896
14010
|
- **Role**: Adversarial Security Auditor Agent (\`agent-security-auditor\`).
|
|
13897
14011
|
- **Mission**: Rigorously examine Pull Requests and code diffs for business logic vulnerabilities, injection vectors, secret leaks, and authorization flaws as part of the Pre-Merge Audit Triad.
|
|
@@ -13908,6 +14022,8 @@ Execute every implementation task following this strict sequential order:
|
|
|
13908
14022
|
title: "Open Source License Compliance Auditor",
|
|
13909
14023
|
description: "Audit dependency manifests and SBOMs against license-policy.yaml to block viral copyleft licenses and flag commercial license requirements.",
|
|
13910
14024
|
globs: "package.json, pnpm-lock.yaml, license-policy.yaml, compliance/**",
|
|
14025
|
+
claudeTools: ["View", "GlobTool", "GrepTool", "LS", "Bash"],
|
|
14026
|
+
antigravityTools: ["read_file", "run_command", "call_mcp_tool"],
|
|
13911
14027
|
body: `## Role & Mission
|
|
13912
14028
|
- **Role**: Open Source License and Intellectual Property Compliance Auditor Agent (\`agent-compliance-checker\`).
|
|
13913
14029
|
- **Mission**: Audit dependency manifests and ensure every direct and transitive third-party package complies with \`license-policy.yaml\` as part of the Pre-Merge Audit Triad.
|
|
@@ -13923,6 +14039,8 @@ Execute every implementation task following this strict sequential order:
|
|
|
13923
14039
|
title: "Expert User and Domain Evaluator",
|
|
13924
14040
|
description: "Scrutinize product design (MVP vs roadmap) and functionally validate finished software against UC-* and FR-* acceptance criteria before pre-merge audit.",
|
|
13925
14041
|
globs: "product/**, specs/**, src/**, packages/**",
|
|
14042
|
+
claudeTools: ["View", "GlobTool", "GrepTool", "LS", "Bash"],
|
|
14043
|
+
antigravityTools: ["read_file", "run_command", "call_mcp_tool"],
|
|
13926
14044
|
body: `## Role & Mission
|
|
13927
14045
|
- **Role**: Expert User and Domain Evaluator Agent (\`agent-expert-user\`).
|
|
13928
14046
|
- **Mission**: Scrutinize product design, technical specifications, and implemented software from the perspective of an advanced operator, enforcing strict MVP boundaries and pre-PR functional conformity.
|
|
@@ -13939,6 +14057,8 @@ Execute every implementation task following this strict sequential order:
|
|
|
13939
14057
|
title: "Technical and Architectural Code Reviewer",
|
|
13940
14058
|
description: "Audit Pull Requests for Clean Code, SOLID, DRY, YAGNI, design patterns, and compliance with quality-policy.yaml complexity and maintainability thresholds.",
|
|
13941
14059
|
globs: "src/**, packages/**, tests/**",
|
|
14060
|
+
claudeTools: ["View", "GlobTool", "GrepTool", "LS", "Bash"],
|
|
14061
|
+
antigravityTools: ["read_file", "run_command", "call_mcp_tool"],
|
|
13942
14062
|
body: `## Role & Mission
|
|
13943
14063
|
- **Role**: Technical and Architectural Code Reviewer Agent (\`agent-code-reviewer\`).
|
|
13944
14064
|
- **Mission**: Audit Pull Requests evaluating code cleanliness, adherence to SOLID, DRY, YAGNI principles, design patterns, and compliance with complexity and maintainability thresholds (\`quality-policy.yaml\`), forming part of the Pre-Merge Audit Triad.
|
|
@@ -13957,6 +14077,8 @@ Execute every implementation task following this strict sequential order:
|
|
|
13957
14077
|
title: "Automation and Infrastructure Engineer",
|
|
13958
14078
|
description: "Maintain, evolve, and audit CI/CD workflows, Dockerfiles, IaC manifests, and support scripts under strict non-invasion guardrails on src/.",
|
|
13959
14079
|
globs: ".github/workflows/**, templates/ci/**, scripts/**, Dockerfile*",
|
|
14080
|
+
claudeTools: ["View", "Edit", "Replace", "GlobTool", "GrepTool", "LS", "Bash"],
|
|
14081
|
+
antigravityTools: ["read_file", "edit_file", "write_file", "run_command", "call_mcp_tool"],
|
|
13960
14082
|
body: `## Role & Mission
|
|
13961
14083
|
- **Role**: DevOps and Infrastructure as Code (IaC) Engineer Agent (\`agent-devops\`).
|
|
13962
14084
|
- **Mission**: Maintain, evolve, and audit automated project infrastructure: CI/CD workflows, Docker containers, deployment manifests, and infrastructure scripts.
|
|
@@ -13972,10 +14094,13 @@ Execute every implementation task following this strict sequential order:
|
|
|
13972
14094
|
}
|
|
13973
14095
|
];
|
|
13974
14096
|
function renderAntigravityAgentFile(agent) {
|
|
14097
|
+
const toolsSection = agent.antigravityTools && agent.antigravityTools.length > 0 ? `
|
|
14098
|
+
tools:
|
|
14099
|
+
${agent.antigravityTools.map((t) => ` - ${t}`).join("\n")}` : "";
|
|
13975
14100
|
return `---
|
|
13976
14101
|
name: ${agent.id}
|
|
13977
14102
|
description: >-
|
|
13978
|
-
${agent.description}
|
|
14103
|
+
${agent.description}${toolsSection}
|
|
13979
14104
|
---
|
|
13980
14105
|
|
|
13981
14106
|
# ${agent.id} (${agent.title})
|
|
@@ -13986,9 +14111,12 @@ ${agent.body}
|
|
|
13986
14111
|
`;
|
|
13987
14112
|
}
|
|
13988
14113
|
function renderClaudeAgentFile(agent) {
|
|
14114
|
+
const toolsSection = agent.claudeTools && agent.claudeTools.length > 0 ? `
|
|
14115
|
+
tools:
|
|
14116
|
+
${agent.claudeTools.map((t) => ` - ${t}`).join("\n")}` : "";
|
|
13989
14117
|
return `---
|
|
13990
14118
|
name: ${agent.id}
|
|
13991
|
-
description: ${agent.description}
|
|
14119
|
+
description: ${agent.description}${toolsSection}
|
|
13992
14120
|
---
|
|
13993
14121
|
|
|
13994
14122
|
# ${agent.id} (${agent.title})
|
|
@@ -13999,9 +14127,12 @@ ${agent.body}
|
|
|
13999
14127
|
`;
|
|
14000
14128
|
}
|
|
14001
14129
|
function renderCopilotAgentFile(agent) {
|
|
14130
|
+
const toolsSection = agent.claudeTools && agent.claudeTools.length > 0 ? `
|
|
14131
|
+
tools:
|
|
14132
|
+
${agent.claudeTools.map((t) => ` - ${t}`).join("\n")}` : "";
|
|
14002
14133
|
return `---
|
|
14003
14134
|
name: ${agent.id}
|
|
14004
|
-
description: ${agent.description}
|
|
14135
|
+
description: ${agent.description}${toolsSection}
|
|
14005
14136
|
---
|
|
14006
14137
|
|
|
14007
14138
|
# ${agent.id} (${agent.title})
|
|
@@ -14746,7 +14877,10 @@ var STARTER_CURSOR_MCP = `{
|
|
|
14746
14877
|
"command": "npx",
|
|
14747
14878
|
"args": [
|
|
14748
14879
|
"@aisdlc/mcp"
|
|
14749
|
-
]
|
|
14880
|
+
],
|
|
14881
|
+
"env": {
|
|
14882
|
+
"AISDLC_MCP_ROLE": "developer"
|
|
14883
|
+
}
|
|
14750
14884
|
}
|
|
14751
14885
|
}
|
|
14752
14886
|
}
|
|
@@ -14757,7 +14891,10 @@ var STARTER_ANTIGRAVITY_MCP = `{
|
|
|
14757
14891
|
"command": "npx",
|
|
14758
14892
|
"args": [
|
|
14759
14893
|
"@aisdlc/mcp"
|
|
14760
|
-
]
|
|
14894
|
+
],
|
|
14895
|
+
"env": {
|
|
14896
|
+
"AISDLC_MCP_ROLE": "developer"
|
|
14897
|
+
}
|
|
14761
14898
|
}
|
|
14762
14899
|
}
|
|
14763
14900
|
}
|
|
@@ -14768,7 +14905,10 @@ var STARTER_VSCODE_MCP = `{
|
|
|
14768
14905
|
"command": "npx",
|
|
14769
14906
|
"args": [
|
|
14770
14907
|
"@aisdlc/mcp"
|
|
14771
|
-
]
|
|
14908
|
+
],
|
|
14909
|
+
"env": {
|
|
14910
|
+
"AISDLC_MCP_ROLE": "developer"
|
|
14911
|
+
}
|
|
14772
14912
|
}
|
|
14773
14913
|
}
|
|
14774
14914
|
}
|
|
@@ -15176,8 +15316,8 @@ cites-product-actors:
|
|
|
15176
15316
|
cites-quality-goals:
|
|
15177
15317
|
- QR-LATENCY-001
|
|
15178
15318
|
- QR-AVAILABILITY-001
|
|
15179
|
-
cites-
|
|
15180
|
-
-
|
|
15319
|
+
cites-journeys:
|
|
15320
|
+
- JRN-MAIN-001
|
|
15181
15321
|
supersedes: null
|
|
15182
15322
|
superseded-by: null
|
|
15183
15323
|
---
|
|
@@ -15778,19 +15918,19 @@ pipelines:\r
|
|
|
15778
15918
|
- step: *build-and-verify\r
|
|
15779
15919
|
- step: *sdd-integrate\r
|
|
15780
15920
|
`;
|
|
15781
|
-
var STARTER_TEMPLATES_CI_GITHUB_WORKFLOWS_CI_YML = "name: CI - AI-SDLC Quality Gates & Testing\r\n\r\non:\r\n push:\r\n branches: [ main ]\r\n pull_request:\r\n branches: [ main ]\r\n\r\njobs:\r\n verify-and-test:\r\n runs-on: ubuntu-latest\r\n strategy:\r\n matrix:\r\n node-version: [
|
|
15921
|
+
var STARTER_TEMPLATES_CI_GITHUB_WORKFLOWS_CI_YML = "name: CI - AI-SDLC Quality Gates & Testing\r\n\r\non:\r\n push:\r\n branches: [ main ]\r\n pull_request:\r\n branches: [ main ]\r\n\r\njobs:\r\n verify-and-test:\r\n runs-on: ubuntu-latest\r\n strategy:\r\n matrix:\r\n node-version: [ 20.x, 22.x ]\r\n\r\n steps:\r\n - name: Checkout Code\r\n uses: actions/checkout@v4\r\n\r\n - name: Install pnpm\r\n uses: pnpm/action-setup@v4\r\n with:\r\n version: 10\r\n\r\n - name: Setup Node.js ${{ matrix.node-version }}\r\n uses: actions/setup-node@v4\r\n with:\r\n node-version: ${{ matrix.node-version }}\r\n\r\n - name: Install Dependencies\r\n run: |\r\n pnpm install --frozen-lockfile\r\n pnpm approve-builds --all\r\n\r\n - name: Build Packages\r\n run: pnpm run build\r\n\r\n - name: Run Vitest Unit & Integration Suites\r\n run: pnpm test\r\n\r\n - name: AI-SDLC Quality Gate & Full Verification\r\n run: npx @aisdlc/cli verify all\r\n";
|
|
15782
15922
|
var STARTER_TEMPLATES_CI_GITHUB_WORKFLOWS_DEPLOY_DASHBOARD_YML = 'name: Deploy AI-SDLC Dashboard to GitHub Pages\r\n\r\non:\r\n push:\r\n branches:\r\n - main\r\n workflow_dispatch:\r\n\r\npermissions:\r\n contents: read\r\n pages: write\r\n id-token: write\r\n\r\nconcurrency:\r\n group: pages\r\n cancel-in-progress: false\r\n\r\njobs:\r\n deploy-dashboard:\r\n name: Build & Publish Interactive Dashboard\r\n runs-on: ubuntu-latest\r\n environment:\r\n name: github-pages\r\n url: ${{ steps.deployment.outputs.page_url }}\r\n\r\n steps:\r\n - name: Checkout Code\r\n uses: actions/checkout@v4\r\n with:\r\n fetch-depth: 0 # Full git history required for historical KPIs and telemetry\r\n\r\n - name: Setup Node.js\r\n uses: actions/setup-node@v4\r\n with:\r\n node-version: 20\r\n\r\n - name: Generate AI-SDLC Interactive Dashboard\r\n run: |\r\n mkdir -p reports\r\n npx --yes @aisdlc/cli report dashboard --output reports/index.html\r\n cp reports/index.html reports/dashboard.html\r\n touch reports/.nojekyll\r\n\r\n - name: Setup GitHub Pages\r\n uses: actions/configure-pages@v5\r\n\r\n - name: Upload Pages Artifact\r\n uses: actions/upload-pages-artifact@v3\r\n with:\r\n path: reports\r\n\r\n - name: Deploy to GitHub Pages\r\n id: deployment\r\n uses: actions/deploy-pages@v4\r\n\r\n - name: Emit Summary to GitHub Actions\r\n if: always() && steps.deployment.outcome == \'success\'\r\n run: |\r\n echo "### \u{1F310} AI-SDLC Interactive Dashboard Published" >> $GITHUB_STEP_SUMMARY\r\n echo "" >> $GITHUB_STEP_SUMMARY\r\n echo "The interactive PDaC / RTM graph, Quality Gate telemetry, and release metrics are live at:" >> $GITHUB_STEP_SUMMARY\r\n echo "" >> $GITHUB_STEP_SUMMARY\r\n echo "\u{1F449} **[Open Live Dashboard](${{ steps.deployment.outputs.page_url }})**" >> $GITHUB_STEP_SUMMARY\r\n';
|
|
15783
15923
|
var STARTER_TEMPLATES_CI_GITHUB_WORKFLOWS_PR_KPI_SUMMARY_YML = "name: AI-SDLC PR KPI Aggregator\r\n\r\non:\r\n pull_request:\r\n types: [opened, synchronize, reopened]\r\n\r\npermissions:\r\n contents: read\r\n pull-requests: write\r\n\r\njobs:\r\n aggregate-kpis:\r\n name: Aggregate PR KPIs & Telemetry\r\n runs-on: ubuntu-latest\r\n\r\n steps:\r\n - name: Checkout Repository\r\n uses: actions/checkout@v4\r\n with:\r\n fetch-depth: 0\r\n\r\n - name: Install pnpm\r\n uses: pnpm/action-setup@v4\r\n with:\r\n version: 10\r\n\r\n - name: Setup Node.js\r\n uses: actions/setup-node@v4\r\n with:\r\n node-version: 20\r\n\r\n - name: Install Dependencies\r\n run: |\r\n pnpm install --frozen-lockfile\r\n\r\n - name: Calculate and Emit PR KPIs\r\n id: kpi\r\n run: |\r\n npx @aisdlc/cli kpi pr --base origin/${{ github.base_ref }} --head HEAD >> $GITHUB_STEP_SUMMARY\r\n";
|
|
15784
15924
|
var STARTER_TEMPLATES_CI_GITHUB_WORKFLOWS_SDD_INTEGRATE_ON_MERGE_YML = 'name: SDD Canonical Integration on Merge\r\n\r\non:\r\n pull_request:\r\n types: [closed]\r\n branches:\r\n - main\r\n - \'release/**\'\r\n workflow_dispatch:\r\n inputs:\r\n change_id:\r\n description: \'SDD change ID to integrate manually (e.g. chg-001-telemetry)\'\r\n required: false\r\n type: string\r\n\r\npermissions:\r\n contents: write\r\n pull-requests: read\r\n\r\nconcurrency:\r\n group: sdd-integrate-${{ github.event.pull_request.base.ref || github.ref_name }}\r\n cancel-in-progress: false\r\n\r\njobs:\r\n integrate-sdd:\r\n name: SDD Canonical Integration\r\n if: github.event.pull_request.merged == true || github.event_name == \'workflow_dispatch\'\r\n runs-on: ubuntu-latest\r\n\r\n steps:\r\n - name: Checkout Repository\r\n uses: actions/checkout@v4\r\n with:\r\n ref: ${{ github.event.pull_request.base.ref || github.ref_name }}\r\n fetch-depth: 0\r\n token: ${{ secrets.GITHUB_TOKEN }}\r\n\r\n - name: Install pnpm\r\n uses: pnpm/action-setup@v4\r\n with:\r\n version: 10\r\n\r\n - name: Setup Node.js\r\n uses: actions/setup-node@v4\r\n with:\r\n node-version: 20\r\n\r\n - name: Install Dependencies\r\n run: |\r\n pnpm install --frozen-lockfile\r\n pnpm approve-builds --all\r\n\r\n - name: Build Packages\r\n run: pnpm run build\r\n\r\n - name: Detect and Integrate SDD Change\r\n id: integrate\r\n env:\r\n PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}\r\n PR_TITLE: ${{ github.event.pull_request.title }}\r\n PR_BODY: ${{ github.event.pull_request.body }}\r\n MANUAL_CHANGE_ID: ${{ github.event.inputs.change_id }}\r\n run: |\r\n npx @aisdlc/cli sdd integrate --auto || true\r\n\r\n - name: Commit and Push Canonical Baseline Changes\r\n run: |\r\n git config user.name "github-actions[bot]"\r\n git config user.email "github-actions[bot]@users.noreply.github.com"\r\n git add -A\r\n if ! git diff --cached --quiet; then\r\n git commit -m "chore(sdd): integrate changes into canonical baseline [skip ci]"\r\n TARGET_BRANCH="${{ github.event.pull_request.base.ref || github.ref_name }}"\r\n MAX_RETRIES=3\r\n RETRY_COUNT=0\r\n DELAY=2\r\n\r\n while [ $RETRY_COUNT -lt $MAX_RETRIES ]; do\r\n echo "Synchronizing with remote branch $TARGET_BRANCH (pull --rebase)..."\r\n git pull --rebase origin "$TARGET_BRANCH"\r\n if git push origin "$TARGET_BRANCH"; then\r\n echo "\u2714 Canonical integration committed and synchronized to repository."\r\n exit 0\r\n fi\r\n RETRY_COUNT=$((RETRY_COUNT + 1))\r\n if [ $RETRY_COUNT -lt $MAX_RETRIES ]; then\r\n echo "\u26A0 Push rejected (concurrency detected). Retrying in ${DELAY}s (attempt $RETRY_COUNT/$MAX_RETRIES)..."\r\n sleep $DELAY\r\n DELAY=$((DELAY * 2))\r\n fi\r\n done\r\n\r\n echo "\u274C Error: Failed to push canonical integration after $MAX_RETRIES attempts."\r\n exit 1\r\n else\r\n echo "\u2139 No pending changes generated in working tree."\r\n fi\r\n';
|
|
15785
15925
|
var STARTER_TEMPLATES_COMPLIANCE_COMMERCIAL_ACQUISITION_REQUEST_TEMPLATE_MD = '---\r\nid: REQ-LIC-ACQUISITION-001\r\ntype: license-acquisition-request\r\ntitle: Commercial License Acquisition Request for [Library]\r\nstatus: pending-approval # pending-approval, approved, rejected\r\nrequested-package: "@vendor/commercial-package"\r\nspdx-license: "BSL-1.1" # or Commercial, SSPL-1.0\r\nlicense-category: commercial_acquisition_required\r\nestimated-cost: "$1,200 / year"\r\nbusiness-justification: "Accelerates critical telemetry module development avoiding 4 months of in-house implementation."\r\n---\r\n\r\n# Commercial License Acquisition Request\r\n\r\n## 1. Package and Vendor\r\n- **Package**: `@vendor/commercial-package`\r\n- **Version**: `2.4.0`\r\n- **License Type**: BSL 1.1 / Commercial\r\n- **Official Website**: `https://vendor.example.com`\r\n\r\n## 2. Technical Justification and Evaluated Alternatives\r\n- **Why a permissive alternative (MIT/Apache 2.0) is not used**:\r\n - Open-source alternatives lack required hardware encryption protocol support.\r\n- **Impact of not acquiring the license**:\r\n - 4-month delay on product delivery milestone.\r\n\r\n## 3. Human Authorization Signatures\r\n- [ ] Tech Lead: Technical approval\r\n- [ ] Legal / IP Counsel: EULA clauses validation\r\n- [ ] Procurement / Budget Owner: Payment authorization\r\n';
|
|
15786
|
-
var STARTER_TEMPLATES_MANUALS_PRODUCTION_MANUAL_TEMPLATE_MD = '---\r\nid: MAN-PROD-001\r\ntype: production-manual\r\ntitle: "Production & Operations Manual: Application Name"\r\nstatus: draft\r\nversion: "1.0.0"\r\nschema-version: "1.0"\r\napplies-to-version: "v1.0.0"\r\ntarget-audience:\r\n - devops-engineer\r\n - sre-engineer\r\n - release-manager\r\n - secops\r\ncomponents-covered:\r\n - CMP-NAME-001\r\nenclaves-involved:\r\n - SEC-ENC-DMZ-001\r\nsupersedes: null\r\nsuperseded-by: null\r\n---\r\n\r\n# MAN-PROD-001: Production & Operations Manual - Application Name\r\n\r\n## 1. Deterministic Release Regeneration (Reproducible Builds)\r\n\r\nThis section contains the specifications and directives required to deterministically reproduce identical bit-by-bit application artifacts or releases from their Git tag.\r\n\r\n### 1.1 Source Code Baseline\r\n\r\n- **Canonical Repository**: `https://github.com/organization/repo-name.git`\r\n- **Immutable Git Release Tag**: `v1.0.0`\r\n- **Commit SHA-256 / SHA-1**: `[VERIFIED_HEXADECIMAL_COMMIT_SHA]`\r\n- **Clean Checkout Command**:\r\n ```bash\r\n git clone --recurse-submodules https://github.com/organization/repo-name.git\r\n cd repo-name\r\n git checkout tags/v1.0.0\r\n git submodule update --init --recursive\r\n ```\r\n\r\n### 1.2 Frozen Toolchains and Build Tool Matrix\r\n\r\nTo prevent discrepancies in binary or package generation, strict usage of pinned versions of the following utilities is enforced:\r\n\r\n| Tool / Runtime | Exact Version | Toolchain Checksum / Digest | Purpose |\r\n| :--- | :--- | :--- | :--- |\r\n| **Node.js LTS** | `v22.12.0` | `sha256:node-v22.12.0-linux-x64.tar.xz` | Execution and transpilation runtime |\r\n| **pnpm** | `9.15.0` | `sha256:pnpm-v9.15.0` | Deterministic monorepo package manager |\r\n| **TypeScript (tsc)** | `5.7.2` | Pinned in `devDependencies` | Strict ECMAScript compiler |\r\n| **Docker BuildKit** | `v0.18.0` | `moby/buildkit:v0.18.0` | Hermetic OCI packaging engine |\r\n\r\n### 1.3 Libraries, Dependencies, and Vertex Graph\r\n\r\n- **Immutable Lockfile**: `pnpm-lock.yaml` (or `Cargo.lock`, `go.sum`, `requirements.lock`). Installations with open resolution are forbidden (`pnpm install --frozen-lockfile` mandatory).\r\n- **SBOM (Software Bill of Materials) Inventory**:\r\n - Format: CycloneDX JSON v1.5 / SPDX v2.3.\r\n - Compiled SBOM path: `reports/sbom-cyclonedx.json`.\r\n- **OSS License Governance**:\r\n - Binding policy: `license-policy.yaml`.\r\n - Library vertex pre-verification:\r\n ```bash\r\n pnpm verify:licenses\r\n ```\r\n\r\n### 1.4 Step-by-Step Deterministic Build Procedure\r\n\r\n1. **Step 1: Hermetic Dependency Installation**\r\n ```bash\r\n pnpm install --frozen-lockfile --ignore-scripts\r\n ```\r\n\r\n2. **Step 2: Integrity and Strict Type Checking**\r\n ```bash\r\n pnpm typecheck\r\n ```\r\n\r\n3. **Step 3: Artifact Compilation**\r\n ```bash\r\n export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)\r\n pnpm build\r\n ```\r\n\r\n4. **Step 4: Cryptographic Verification of Generated Artifact**\r\n ```bash\r\n sha256sum dist/app.bundle.js\r\n # Compare against the canonical checksum registered in official release:\r\n # Expected: [CANONICAL_SHA256_CHECKSUM]\r\n ```\r\n\r\n\n\n5. **Step 5: Sigstore / Cosign Signature and SLSA Provenance Verification**\n ```bash\n # Verify npm package provenance from registry\n npm audit signatures\n\n # Verify package tarball with Sigstore / Cosign (Keyless via OIDC identity)\n cosign verify-blob \\\n --bundle release-artifacts/package.tgz.bundle \\\n --certificate-identity-regexp "^https://github.com/organization/repo-name/.*$" \\\n --certificate-oidc-issuer "https://token.actions.githubusercontent.com" \\\n release-artifacts/package.tgz\n\n # Verify SLSA Build Provenance Attestation using GitHub CLI\n gh attestation verify release-artifacts/package.tgz --repo organization/repo-name\n ```\n\n---\r\n\r\n## 2. Version, Infrastructure, and Migration Compatibility Matrix\r\n\r\nThis section defines technical interoperability boundaries between the release version and the deployment ecosystem, ensuring safe Zero-Downtime transitions.\r\n\r\n### 2.1 Platform and Execution Runtime Compatibility\r\n\r\n| Infrastructure Component | Approved Version Range | Recommended Version | Support Status |\r\n| :--- | :--- | :--- | :---: |\r\n| **Kubernetes Cluster (K8s)** | `>= 1.28` and `<= 1.31` | `1.30.2` | \u2705 Certified |\r\n| **Container Runtime (CRI)** | containerd `>= 1.7` / CRI-O `>= 1.28` | containerd `1.7.15` | \u2705 Certified |\r\n| **Base Operating System (Host)** | Ubuntu 22.04 LTS / RHEL 9.2+ | Ubuntu 22.04 LTS (Kernel 6.x) | \u2705 Homologated |\r\n| **Language Runtime (Production)** | Node.js `>= 20.x` and `<= 22.x` | `v22.12.0 LTS` | \u2705 Hermetic |\r\n\r\n### 2.2 Data Schema and Migration Compatibility (N-1 Support)\r\n\r\nTo enable Canary or Blue-Green continuous deployments without transaction loss:\r\n\r\n| Release Version | DB Schema Version | Compatible with $N-1$ Code | Schema Migration Status |\r\n| :---: | :---: | :---: | :--- |\r\n| **`v1.0.0`** (Current) | `SCHEMA-v1.0` | \u2705 Yes (supports `v0.9.x` code) | Non-destructive additive migration (no column renaming). |\r\n| **`v0.9.x`** | `SCHEMA-v0.9` | \u2705 Previous baseline | Fully compatible during Canary drain period. |\r\n\r\n### 2.3 Interoperability Between Architecture Components (`CMP-*`)\r\n\r\n| Dependent Component | Consumed Component | Minimum Compatible Versions | Binding Protocol / Contract |\r\n| :--- | :--- | :---: | :--- |\r\n| `CMP-NAME-001` (Gateway) | `CMP-NAME-002` (Backend) | `>= v1.0.0` | gRPC / Protobuf v3 (`contract_spec.proto`) |\r\n| `CMP-NAME-001` (Gateway) | Messaging Bus / Kafka | `>= 3.5.0` | Kafka v2 Protocol with TLS mTLS |\r\n\r\n### 2.4 Homologated Upgrade & Rollback Paths\r\n\r\n| Source Version | Direct Jump to `v1.0.0` | Intermediate Migration Required | Direct Rollback Procedure |\r\n| :---: | :---: | :---: | :---: |\r\n| **`v0.9.1`** | \u2705 Allowed | \u274C Not required | `kubectl rollout undo` without data loss. |\r\n| **`v0.9.0`** | \u2705 Allowed | \u274C Not required | `kubectl rollout undo` without data loss. |\r\n| **`< v0.9.0`** | \u274C Blocked | \u2705 Must upgrade to `v0.9.1` first | Requires restore from backup snapshot. |\r\n\r\n---\r\n\r\n## 3. CI/CD Architecture and Pipelines\r\n\r\n### 3.1 Hierarchical Branching Model and Integration Triggers\r\n\r\nFollowing the AI-SDLC 4-tier standard:\r\n\r\n```text\r\nTIER 1: main (Production)\r\n \u25B2\r\n \u2514\u2500\u2500 PR Release Gate (Manual Tech Lead / Release Manager Approval)\r\n \u2502\r\nTIER 2: release/v1.0.0 (Open Version Branch)\r\n \u25B2\r\n \u2514\u2500\u2500 PR Feature Gate (Lint + Tests + Quality Gate + SAST + SBOM)\r\n \u2502\r\nTIER 3: feat/CHG-001-* (Feature / Bug)\r\n```\r\n\r\n- **Pull Request Trigger**: Executes linters, full test battery, and governance verifications without deployment.\r\n- **Release Tag Trigger (`v*.*.*`)**: Executes the full hermetic build pipeline, image signing, and continuous deployment.\r\n\r\n### 3.2 CI/CD Pipeline Flowchart\r\n\r\n```mermaid\r\nflowchart LR\r\n A["Git Push / Tag v1.0.0"] --> B["Hermetic Checkout"]\r\n B --> C["Linters & Typecheck"]\r\n C --> D["Vitest: Unit & BDD"]\r\n D --> E["Quality Gate: CC & MI"]\r\n E --> F["SAST & Secret Scan"]\r\n F --> G["SBOM & License Gate"]\r\n G --> H["Deterministic Build"]\r\n H --> I["Cosign / SLSA Signing"]\r\n I --> J["Push to OCI Registry"]\r\n J --> K["Deploy to DMZ Enclave"]\r\n```\r\n\r\n### 3.3 Release Gate Contracts and Thresholds\r\n\r\n| Quality Gate | Tool / Command | Required Threshold | Action on Non-Compliance |\r\n| :--- | :--- | :--- | :--- |\r\n| **Lint & Typecheck** | `pnpm typecheck` | Zero errors, zero `any` | **Immediate failure** |\r\n| **Automated Tests** | `pnpm test:all` | 100% passed, Coverage >= 85% | **Immediate failure** |\r\n| **Cyclomatic Complexity** | `aisdlc verify quality` | CC <= 10 per function | **Release blocked** |\r\n| **Maintainability Index** | `aisdlc verify quality` | MI >= 50.0 / 100 | **Release blocked** |\r\n| **360\xB0 Traceability** | `aisdlc verify traceability` | 100% of requirements linked | **Release blocked** |\r\n| **OSS Licenses** | `aisdlc verify licenses` | Zero forbidden/viral licenses | **Release blocked** |\r\n| **Cryptographic Signature & SLSA** | `cosign verify-blob` / `gh attestation verify` | Valid signature and SLSA provenance from GitHub Actions OIDC | **Deployment rejected** |\r\n\r\n---\r\n\r\n## 4. Production Deployment Strategy and Procedure\r\n\r\n### 4.1 Infrastructure Prerequisites and Network Enclaves\r\n\r\n- **Target Enclave**: `SEC-ENC-DMZ-001` (Strict segmentation without direct uncontrolled outbound internet access).\r\n- **Enabled Network Ports**:\r\n - Port `8443/TCP`: Secure WebSocket ingestion with mutual TLS (mTLS) authentication.\r\n - Port `9090/TCP`: Prometheus metrics (internal management network only).\r\n- **Secrets and Certificate Management**:\r\n - Server TLS and client root CA certificates mounted via immutable secret at `/etc/pki/tls/`.\r\n - Embedding cryptographic keys in environment variables or images is strictly forbidden.\r\n\r\n### 4.2 Rollout Strategy\r\n\r\nA **Canary strategy with progressive telemetry metrics analysis** is utilized:\r\n1. 10% of traffic is routed to the new version for 15 minutes.\r\n2. If the 5xx error rate is `<= 0.01%` and p99 latency is `<= 50ms`, traffic is promoted to 100%.\r\n\r\n### 4.3 Step-by-Step Deployment Procedure\r\n\r\n1. **Step 1: Pre-deployment and State Snapshot**\r\n ```bash\r\n # Check cluster health and record baseline\r\n kubectl get pods -n production -l app=system\r\n kubectl exec -it system-db-0 -- /backup/create-snapshot.sh\r\n ```\r\n\r\n2. **Step 2: Deployment Manifest Application**\r\n ```bash\r\n kubectl apply -f deploy/production/canary-deployment.yaml\r\n kubectl rollout status deployment/system-service -n production --timeout=180s\r\n ```\r\n\r\n3. **Step 3: Health Verification and Smoke Tests**\r\n ```bash\r\n curl -f --cacert /etc/pki/tls/ca.crt https://127.0.0.1:8443/healthz\r\n curl -f --cacert /etc/pki/tls/ca.crt https://127.0.0.1:8443/readyz\r\n pnpm test:example\r\n ```\r\n\r\n### 4.4 Rollback Plan (Immediate Rollback)\r\n\r\n- **Objective Rollback Activation Criteria**:\r\n - mTLS handshake failure rate `> 1.0%`.\r\n - Ingestion p99 latency `> 100ms` for 2 continuous minutes.\r\n - Critical `CrashLoopBackOff` alert on more than 20% of instances.\r\n- **Rollback Execution Command**:\r\n ```bash\r\n kubectl rollout undo deployment/system-service -n production\r\n kubectl rollout status deployment/system-service -n production\r\n ```\r\n\r\n---\r\n\r\n## 5. Likely Errors Resolution and Troubleshooting (Runbooks)\r\n\r\nThis section documents the most frequent runtime and deployment failures along with diagnosis and immediate mitigation procedures.\r\n\r\n### 5.1 Frequent Incidents and Solutions Matrix\r\n\r\n#### Incident 1: Dependency Vertex Inconsistency or Drift (Build Failure)\r\n- **Symptom**: `pnpm install --frozen-lockfile` command fails in CI with error `ERR_PNPM_LOCKFILE_OUTDATED`.\r\n- **Root Cause**: `package.json` was modified without updating `pnpm-lock.yaml`.\r\n- **Diagnosis**:\r\n ```bash\r\n git diff HEAD^ package.json pnpm-lock.yaml\r\n ```\r\n- **Mitigation**:\r\n 1. On the feature branch, run `pnpm install` locally to regenerate the deterministic lockfile.\r\n 2. Verify no restricted-license dependencies were introduced via `pnpm verify:licenses`.\r\n 3. Commit both files together in an atomic commit.\r\n\r\n---\r\n\r\n#### Incident 2: mTLS Handshake Failure or Enclave Certificate Rejected\r\n- **Symptom**: Clients receive error `ERR_TLS_CERT_ALTNAME_INVALID` or connection closed with TLS alert `certificate_unknown (46)`.\r\n- **Root Cause**: Internal root CA mounted on server does not match the client certificate issuer CA, or certificate expired.\r\n- **Diagnosis**:\r\n ```bash\r\n openssl s_client -connect 127.0.0.1:8443 -CAfile /etc/pki/tls/ca.crt -cert /etc/pki/tls/client.crt -key /etc/pki/tls/client.key\r\n openssl x509 -in /etc/pki/tls/ca.crt -noout -dates -issuer -subject\r\n ```\r\n- **Mitigation**:\r\n 1. Verify expiration date of certificate mounted in cluster Secret.\r\n 2. If expired, rotate the certificate by injecting the new pair from HSM / Vault storage.\r\n 3. Orderly restart pods with `kubectl rollout restart deployment/system-service`.\r\n\r\n---\r\n\r\n#### Incident 3: Release Gate Rejection in CI/CD Due to Quality Metrics\r\n- **Symptom**: Pipeline aborts with verdict `Quality Gate REJECTED` (Cyclomatic Complexity > 10 or Maintainability < 50).\r\n- **Root Cause**: Introduction of complex nested logic (multiple `if/else`, extensive `switch`, or branching loops).\r\n- **Diagnosis**:\r\n ```bash\r\n pnpm verify:quality\r\n ```\r\n- **Mitigation**:\r\n 1. Inspect the violation report in `reports/QUALITY_GATE_REPORT.md` to identify the offending function.\r\n 2. Decompose function into cohesive private helper methods following the rule of maximum 40 lines per function.\r\n 3. Re-run `pnpm verify:quality` until green verdict is confirmed. Adding suppression comments (`// @ts-ignore`) is forbidden.\r\n\r\n---\r\n\r\n#### Incident 4: CrashLoopBackOff Due to Memory Leak or Connection Limit\r\n- **Symptom**: Pod is terminated with exit code `ExitCode: 137` (`OOMKilled`) after a load spike.\r\n- **Root Cause**: Undrained socket buffer accumulation during high-frequency bursts.\r\n- **Diagnosis**:\r\n ```bash\r\n kubectl describe pod system-service-xxx -n production | grep -i oom\r\n kubectl logs system-service-xxx -n production --previous\r\n ```\r\n- **Mitigation**:\r\n 1. Temporarily adjust memory limits in Kubernetes manifest (`resources.limits.memory`) if the load burst is legitimate.\r\n 2. Apply backpressure or discard expired packets in accordance with business rules (`BR-*`).\r\n 3. Run local benchmark with `pnpm test:all` to audit memory consumption.\r\n\r\n---\r\n\r\n### 5.2 Escalation Protocol and Critical Incident Management\r\n\r\n| Severity Level | Impact Criterion | Maximum Response Time | Roles Involved |\r\n| :--- | :--- | :---: | :--- |\r\n| **SEV-1 (Critical)** | Complete service outage or security breach in enclave. | 15 minutes | On-call SRE + Lead Architect + SecOps |\r\n| **SEV-2 (Major)** | Severe service degradation, massive retries without outage. | 1 hour | On-call SRE + Tech Lead |\r\n| **SEV-3 (Minor)** | Isolated node incident without global SLA impact. | 4 hours | Support Engineer / DevOps |\r\n\r\n---\r\n\r\n## 6. Revision History and Version Control\r\n\r\n| Version | Date | Author / Agent | Change Description | Change Reference (Change/PR) |\r\n| :--- | :--- | :--- | :--- | :--- |\r\n| **1.0.0** | 2026-09-15 | Operations & DevOps Team | Initial Production Manual generation | CHG-009 |\r\n';
|
|
15926
|
+
var STARTER_TEMPLATES_MANUALS_PRODUCTION_MANUAL_TEMPLATE_MD = '---\r\nid: MAN-PROD-001\r\ntype: production-manual\r\ntitle: "Production & Operations Manual: Application Name"\r\nstatus: draft\r\nversion: "1.0.0"\r\nschema-version: "1.0"\r\napplies-to-version: "v1.0.0"\r\ntarget-audience:\r\n - devops-engineer\r\n - sre-engineer\r\n - release-manager\r\n - secops\r\ncomponents-covered:\r\n - CMP-NAME-001\r\nenclaves-involved:\r\n - SEC-ENC-DMZ-001\r\nsupersedes: null\r\nsuperseded-by: null\r\n---\r\n\r\n# MAN-PROD-001: Production & Operations Manual - Application Name\r\n\r\n## 1. Deterministic Release Regeneration (Reproducible Builds)\r\n\r\nThis section contains the specifications and directives required to deterministically reproduce identical bit-by-bit application artifacts or releases from their Git tag.\r\n\r\n### 1.1 Source Code Baseline\r\n\r\n- **Canonical Repository**: `https://github.com/organization/repo-name.git`\r\n- **Immutable Git Release Tag**: `v1.0.0`\r\n- **Commit SHA-256 / SHA-1**: `[VERIFIED_HEXADECIMAL_COMMIT_SHA]`\r\n- **Clean Checkout Command**:\r\n ```bash\r\n git clone --recurse-submodules https://github.com/organization/repo-name.git\r\n cd repo-name\r\n git checkout tags/v1.0.0\r\n git submodule update --init --recursive\r\n ```\r\n\r\n### 1.2 Frozen Toolchains and Build Tool Matrix\r\n\r\nTo prevent discrepancies in binary or package generation, strict usage of pinned versions of the following utilities is enforced:\r\n\r\n| Tool / Runtime | Exact Version | Toolchain Checksum / Digest | Purpose |\r\n| :--- | :--- | :--- | :--- |\r\n| **Node.js LTS** | `v22.12.0` | `sha256:node-v22.12.0-linux-x64.tar.xz` | Execution and transpilation runtime |\r\n| **pnpm** | `9.15.0` | `sha256:pnpm-v9.15.0` | Deterministic monorepo package manager |\r\n| **TypeScript (tsc)** | `5.7.2` | Pinned in `devDependencies` | Strict ECMAScript compiler |\r\n| **Docker BuildKit** | `v0.18.0` | `moby/buildkit:v0.18.0` | Hermetic OCI packaging engine |\r\n\r\n### 1.3 Libraries, Dependencies, and Vertex Graph\r\n\r\n- **Immutable Lockfile**: `pnpm-lock.yaml` (or `Cargo.lock`, `go.sum`, `requirements.lock`). Installations with open resolution are forbidden (`pnpm install --frozen-lockfile` mandatory).\r\n- **SBOM (Software Bill of Materials) Inventory**:\r\n - Format: CycloneDX JSON v1.5 / SPDX v2.3.\r\n - Compiled SBOM path: `reports/sbom-cyclonedx.json`.\r\n- **OSS License Governance**:\r\n - Binding policy: `license-policy.yaml`.\r\n - Library vertex pre-verification:\r\n ```bash\r\n pnpm verify:licenses\r\n ```\r\n\r\n### 1.4 Step-by-Step Deterministic Build Procedure\r\n\r\n1. **Step 1: Hermetic Dependency Installation**\r\n ```bash\r\n pnpm install --frozen-lockfile --ignore-scripts\r\n ```\r\n\r\n2. **Step 2: Integrity and Strict Type Checking**\r\n ```bash\r\n pnpm typecheck\r\n ```\r\n\r\n3. **Step 3: Artifact Compilation**\r\n ```bash\r\n export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)\r\n pnpm build\r\n ```\r\n\r\n4. **Step 4: Cryptographic Verification of Generated Artifact**\r\n ```bash\r\n sha256sum dist/app.bundle.js\r\n # Compare against the canonical checksum registered in official release:\r\n # Expected: [CANONICAL_SHA256_CHECKSUM]\r\n ```\r\n\r\n\r\n\r\n5. **Step 5: Sigstore / Cosign Signature and SLSA Provenance Verification**\r\n ```bash\r\n # Verify npm package provenance from registry\r\n npm audit signatures\r\n\r\n # Verify package tarball with Sigstore / Cosign (Keyless via OIDC identity)\r\n cosign verify-blob \\\r\n --bundle release-artifacts/package.tgz.bundle \\\r\n --certificate-identity-regexp "^https://github.com/organization/repo-name/.*$" \\\r\n --certificate-oidc-issuer "https://token.actions.githubusercontent.com" \\\r\n release-artifacts/package.tgz\r\n\r\n # Verify SLSA Build Provenance Attestation using GitHub CLI\r\n gh attestation verify release-artifacts/package.tgz --repo organization/repo-name\r\n ```\r\n\r\n---\r\n\r\n## 2. Version, Infrastructure, and Migration Compatibility Matrix\r\n\r\nThis section defines technical interoperability boundaries between the release version and the deployment ecosystem, ensuring safe Zero-Downtime transitions.\r\n\r\n### 2.1 Platform and Execution Runtime Compatibility\r\n\r\n| Infrastructure Component | Approved Version Range | Recommended Version | Support Status |\r\n| :--- | :--- | :--- | :---: |\r\n| **Kubernetes Cluster (K8s)** | `>= 1.28` and `<= 1.31` | `1.30.2` | \u2705 Certified |\r\n| **Container Runtime (CRI)** | containerd `>= 1.7` / CRI-O `>= 1.28` | containerd `1.7.15` | \u2705 Certified |\r\n| **Base Operating System (Host)** | Ubuntu 22.04 LTS / RHEL 9.2+ | Ubuntu 22.04 LTS (Kernel 6.x) | \u2705 Homologated |\r\n| **Language Runtime (Production)** | Node.js `>= 20.x` and `<= 22.x` | `v22.12.0 LTS` | \u2705 Hermetic |\r\n\r\n### 2.2 Data Schema and Migration Compatibility (N-1 Support)\r\n\r\nTo enable Canary or Blue-Green continuous deployments without transaction loss:\r\n\r\n| Release Version | DB Schema Version | Compatible with $N-1$ Code | Schema Migration Status |\r\n| :---: | :---: | :---: | :--- |\r\n| **`v1.0.0`** (Current) | `SCHEMA-v1.0` | \u2705 Yes (supports `v0.9.x` code) | Non-destructive additive migration (no column renaming). |\r\n| **`v0.9.x`** | `SCHEMA-v0.9` | \u2705 Previous baseline | Fully compatible during Canary drain period. |\r\n\r\n### 2.3 Interoperability Between Architecture Components (`CMP-*`)\r\n\r\n| Dependent Component | Consumed Component | Minimum Compatible Versions | Binding Protocol / Contract |\r\n| :--- | :--- | :---: | :--- |\r\n| `CMP-NAME-001` (Gateway) | `CMP-NAME-002` (Backend) | `>= v1.0.0` | gRPC / Protobuf v3 (`contract_spec.proto`) |\r\n| `CMP-NAME-001` (Gateway) | Messaging Bus / Kafka | `>= 3.5.0` | Kafka v2 Protocol with TLS mTLS |\r\n\r\n### 2.4 Homologated Upgrade & Rollback Paths\r\n\r\n| Source Version | Direct Jump to `v1.0.0` | Intermediate Migration Required | Direct Rollback Procedure |\r\n| :---: | :---: | :---: | :---: |\r\n| **`v0.9.1`** | \u2705 Allowed | \u274C Not required | `kubectl rollout undo` without data loss. |\r\n| **`v0.9.0`** | \u2705 Allowed | \u274C Not required | `kubectl rollout undo` without data loss. |\r\n| **`< v0.9.0`** | \u274C Blocked | \u2705 Must upgrade to `v0.9.1` first | Requires restore from backup snapshot. |\r\n\r\n---\r\n\r\n## 3. CI/CD Architecture and Pipelines\r\n\r\n### 3.1 Hierarchical Branching Model and Integration Triggers\r\n\r\nFollowing the AI-SDLC 4-tier standard:\r\n\r\n```text\r\nTIER 1: main (Production)\r\n \u25B2\r\n \u2514\u2500\u2500 PR Release Gate (Manual Tech Lead / Release Manager Approval)\r\n \u2502\r\nTIER 2: release/v1.0.0 (Open Version Branch)\r\n \u25B2\r\n \u2514\u2500\u2500 PR Feature Gate (Lint + Tests + Quality Gate + SAST + SBOM)\r\n \u2502\r\nTIER 3: feat/CHG-001-* (Feature / Bug)\r\n```\r\n\r\n- **Pull Request Trigger**: Executes linters, full test battery, and governance verifications without deployment.\r\n- **Release Tag Trigger (`v*.*.*`)**: Executes the full hermetic build pipeline, image signing, and continuous deployment.\r\n\r\n### 3.2 CI/CD Pipeline Flowchart\r\n\r\n```mermaid\r\nflowchart LR\r\n A["Git Push / Tag v1.0.0"] --> B["Hermetic Checkout"]\r\n B --> C["Linters & Typecheck"]\r\n C --> D["Vitest: Unit & BDD"]\r\n D --> E["Quality Gate: CC & MI"]\r\n E --> F["SAST & Secret Scan"]\r\n F --> G["SBOM & License Gate"]\r\n G --> H["Deterministic Build"]\r\n H --> I["Cosign / SLSA Signing"]\r\n I --> J["Push to OCI Registry"]\r\n J --> K["Deploy to DMZ Enclave"]\r\n```\r\n\r\n### 3.3 Release Gate Contracts and Thresholds\r\n\r\n| Quality Gate | Tool / Command | Required Threshold | Action on Non-Compliance |\r\n| :--- | :--- | :--- | :--- |\r\n| **Lint & Typecheck** | `pnpm typecheck` | Zero errors, zero `any` | **Immediate failure** |\r\n| **Automated Tests** | `pnpm test:all` | 100% passed, Coverage >= 85% | **Immediate failure** |\r\n| **Cyclomatic Complexity** | `aisdlc verify quality` | CC <= 10 per function | **Release blocked** |\r\n| **Maintainability Index** | `aisdlc verify quality` | MI >= 50.0 / 100 | **Release blocked** |\r\n| **360\xB0 Traceability** | `aisdlc verify traceability` | 100% of requirements linked | **Release blocked** |\r\n| **OSS Licenses** | `aisdlc verify licenses` | Zero forbidden/viral licenses | **Release blocked** |\r\n| **Cryptographic Signature & SLSA** | `cosign verify-blob` / `gh attestation verify` | Valid signature and SLSA provenance from GitHub Actions OIDC | **Deployment rejected** |\r\n\r\n---\r\n\r\n## 4. Production Deployment Strategy and Procedure\r\n\r\n### 4.1 Infrastructure Prerequisites and Network Enclaves\r\n\r\n- **Target Enclave**: `SEC-ENC-DMZ-001` (Strict segmentation without direct uncontrolled outbound internet access).\r\n- **Enabled Network Ports**:\r\n - Port `8443/TCP`: Secure WebSocket ingestion with mutual TLS (mTLS) authentication.\r\n - Port `9090/TCP`: Prometheus metrics (internal management network only).\r\n- **Secrets and Certificate Management**:\r\n - Server TLS and client root CA certificates mounted via immutable secret at `/etc/pki/tls/`.\r\n - Embedding cryptographic keys in environment variables or images is strictly forbidden.\r\n\r\n### 4.2 Rollout Strategy\r\n\r\nA **Canary strategy with progressive telemetry metrics analysis** is utilized:\r\n1. 10% of traffic is routed to the new version for 15 minutes.\r\n2. If the 5xx error rate is `<= 0.01%` and p99 latency is `<= 50ms`, traffic is promoted to 100%.\r\n\r\n### 4.3 Step-by-Step Deployment Procedure\r\n\r\n1. **Step 1: Pre-deployment and State Snapshot**\r\n ```bash\r\n # Check cluster health and record baseline\r\n kubectl get pods -n production -l app=system\r\n kubectl exec -it system-db-0 -- /backup/create-snapshot.sh\r\n ```\r\n\r\n2. **Step 2: Deployment Manifest Application**\r\n ```bash\r\n kubectl apply -f deploy/production/canary-deployment.yaml\r\n kubectl rollout status deployment/system-service -n production --timeout=180s\r\n ```\r\n\r\n3. **Step 3: Health Verification and Smoke Tests**\r\n ```bash\r\n curl -f --cacert /etc/pki/tls/ca.crt https://127.0.0.1:8443/healthz\r\n curl -f --cacert /etc/pki/tls/ca.crt https://127.0.0.1:8443/readyz\r\n pnpm test:example\r\n ```\r\n\r\n### 4.4 Rollback Plan (Immediate Rollback)\r\n\r\n- **Objective Rollback Activation Criteria**:\r\n - mTLS handshake failure rate `> 1.0%`.\r\n - Ingestion p99 latency `> 100ms` for 2 continuous minutes.\r\n - Critical `CrashLoopBackOff` alert on more than 20% of instances.\r\n- **Rollback Execution Command**:\r\n ```bash\r\n kubectl rollout undo deployment/system-service -n production\r\n kubectl rollout status deployment/system-service -n production\r\n ```\r\n\r\n---\r\n\r\n## 5. Likely Errors Resolution and Troubleshooting (Runbooks)\r\n\r\nThis section documents the most frequent runtime and deployment failures along with diagnosis and immediate mitigation procedures.\r\n\r\n### 5.1 Frequent Incidents and Solutions Matrix\r\n\r\n#### Incident 1: Dependency Vertex Inconsistency or Drift (Build Failure)\r\n- **Symptom**: `pnpm install --frozen-lockfile` command fails in CI with error `ERR_PNPM_LOCKFILE_OUTDATED`.\r\n- **Root Cause**: `package.json` was modified without updating `pnpm-lock.yaml`.\r\n- **Diagnosis**:\r\n ```bash\r\n git diff HEAD^ package.json pnpm-lock.yaml\r\n ```\r\n- **Mitigation**:\r\n 1. On the feature branch, run `pnpm install` locally to regenerate the deterministic lockfile.\r\n 2. Verify no restricted-license dependencies were introduced via `pnpm verify:licenses`.\r\n 3. Commit both files together in an atomic commit.\r\n\r\n---\r\n\r\n#### Incident 2: mTLS Handshake Failure or Enclave Certificate Rejected\r\n- **Symptom**: Clients receive error `ERR_TLS_CERT_ALTNAME_INVALID` or connection closed with TLS alert `certificate_unknown (46)`.\r\n- **Root Cause**: Internal root CA mounted on server does not match the client certificate issuer CA, or certificate expired.\r\n- **Diagnosis**:\r\n ```bash\r\n openssl s_client -connect 127.0.0.1:8443 -CAfile /etc/pki/tls/ca.crt -cert /etc/pki/tls/client.crt -key /etc/pki/tls/client.key\r\n openssl x509 -in /etc/pki/tls/ca.crt -noout -dates -issuer -subject\r\n ```\r\n- **Mitigation**:\r\n 1. Verify expiration date of certificate mounted in cluster Secret.\r\n 2. If expired, rotate the certificate by injecting the new pair from HSM / Vault storage.\r\n 3. Orderly restart pods with `kubectl rollout restart deployment/system-service`.\r\n\r\n---\r\n\r\n#### Incident 3: Release Gate Rejection in CI/CD Due to Quality Metrics\r\n- **Symptom**: Pipeline aborts with verdict `Quality Gate REJECTED` (Cyclomatic Complexity > 10 or Maintainability < 50).\r\n- **Root Cause**: Introduction of complex nested logic (multiple `if/else`, extensive `switch`, or branching loops).\r\n- **Diagnosis**:\r\n ```bash\r\n pnpm verify:quality\r\n ```\r\n- **Mitigation**:\r\n 1. Inspect the violation report in `reports/QUALITY_GATE_REPORT.md` to identify the offending function.\r\n 2. Decompose function into cohesive private helper methods following the rule of maximum 40 lines per function.\r\n 3. Re-run `pnpm verify:quality` until green verdict is confirmed. Adding suppression comments (`// @ts-ignore`) is forbidden.\r\n\r\n---\r\n\r\n#### Incident 4: CrashLoopBackOff Due to Memory Leak or Connection Limit\r\n- **Symptom**: Pod is terminated with exit code `ExitCode: 137` (`OOMKilled`) after a load spike.\r\n- **Root Cause**: Undrained socket buffer accumulation during high-frequency bursts.\r\n- **Diagnosis**:\r\n ```bash\r\n kubectl describe pod system-service-xxx -n production | grep -i oom\r\n kubectl logs system-service-xxx -n production --previous\r\n ```\r\n- **Mitigation**:\r\n 1. Temporarily adjust memory limits in Kubernetes manifest (`resources.limits.memory`) if the load burst is legitimate.\r\n 2. Apply backpressure or discard expired packets in accordance with business rules (`BR-*`).\r\n 3. Run local benchmark with `pnpm test:all` to audit memory consumption.\r\n\r\n---\r\n\r\n### 5.2 Escalation Protocol and Critical Incident Management\r\n\r\n| Severity Level | Impact Criterion | Maximum Response Time | Roles Involved |\r\n| :--- | :--- | :---: | :--- |\r\n| **SEV-1 (Critical)** | Complete service outage or security breach in enclave. | 15 minutes | On-call SRE + Lead Architect + SecOps |\r\n| **SEV-2 (Major)** | Severe service degradation, massive retries without outage. | 1 hour | On-call SRE + Tech Lead |\r\n| **SEV-3 (Minor)** | Isolated node incident without global SLA impact. | 4 hours | Support Engineer / DevOps |\r\n\r\n---\r\n\r\n## 6. Revision History and Version Control\r\n\r\n| Version | Date | Author / Agent | Change Description | Change Reference (Change/PR) |\r\n| :--- | :--- | :--- | :--- | :--- |\r\n| **1.0.0** | 2026-09-15 | Operations & DevOps Team | Initial Production Manual generation | CHG-009 |\r\n';
|
|
15787
15927
|
var STARTER_TEMPLATES_MANUALS_USER_MANUAL_TEMPLATE_MD = '---\r\nid: MAN-USER-001\r\ntype: user-manual\r\ntitle: "User Manual: Application Name"\r\nstatus: draft\r\nversion: "1.0.0"\r\nschema-version: "1.0"\r\napplies-to-version: "v1.0.0"\r\ntarget-audience:\r\n - ACT-ROLE-USER-001\r\n - ACT-OPERATOR-002\r\nallowed-roles:\r\n - ACT-ROLE-USER-001\r\n - ACT-OPERATOR-002\r\njourneys-covered:\r\n - JRN-JOURNEY-001\r\nuse-cases-covered:\r\n - UC-ACTION-001\r\nsupersedes: null\r\nsuperseded-by: null\r\n---\r\n\r\n# MAN-USER-001: User Manual - Application Name\r\n\r\n## 1. System Purpose and Audience\r\n\r\nConcisely describes the software\'s purpose, the operational value it delivers to end users, and the general context in which it operates.\r\n\r\n- **Application / System**: `[System Name or Bounded Context]`\r\n- **Software Version**: `v1.0.0`\r\n- **Target Audience**: `[Functional roles and user profiles addressed]`\r\n\r\n---\r\n\r\n## 2. User Role Catalog and Permissions Matrix (RBAC)\r\n\r\nThis section formally defines the roles authorized to access and operate the application, as well as the privileges assigned to each.\r\n\r\n### 2.1 Authorized Role Catalog\r\n\r\n| Role Identifier | Role Name | Associated Actor | Description & Responsibility | Enclave / Access Level |\r\n| :--- | :--- | :--- | :--- | :--- |\r\n| **`ROLE_USER`** | Standard User | `ACT-ROLE-USER-001` | Data queries and nominal business flow execution. | Corporate Network / Web UI |\r\n| **`ROLE_OPERATOR`** | System Operator | `ACT-OPERATOR-002` | Streaming supervision, alert management, and command control. | DMZ Enclave / Operational Console |\r\n\r\n### 2.2 Access and Capabilities Matrix by Role\r\n\r\n| Application Capability / Module | `ROLE_USER` | `ROLE_OPERATOR` | Authentication Mode |\r\n| :--- | :---: | :---: | :--- |\r\n| Status Query and Dashboard Visualizations | \u2705 Allowed | \u2705 Allowed | Bearer Token (OIDC/JWT) |\r\n| Business Journey Execution (`JRN-JOURNEY-001`) | \u2705 Allowed | \u2705 Allowed | Bearer Token (OIDC/JWT) |\r\n| Real-Time Streaming and Operational Control | \u274C Denied | \u2705 Allowed | mTLS + Device X.509 Certificate |\r\n| Global Parameters Configuration & Connectivity | \u274C Denied | \u2705 Allowed | Administrator Credential |\r\n\r\n---\r\n\r\n## 3. Version and User Platform Compatibility Matrix\r\n\r\nThis section specifies cross-compatibility between the current application version and user environments, clients, and formats.\r\n\r\n### 3.1 Client-Server Compatibility (APIs and SDKs)\r\n\r\n| Application Version (Backend) | Compatible CLI Version | Compatible SDK Version | Compatibility Status | Migration Notes |\r\n| :---: | :---: | :---: | :---: | :--- |\r\n| **`v1.0.0`** (Current) | `>= v1.0.0` | `>= v1.0.0` | \u2705 Fully Supported | Active canonical version. |\r\n| **`v1.0.0`** (Current) | `v0.9.x` | `v0.9.x` | \u26A0\uFE0F Degraded Mode | Requires upgrade before next minor. |\r\n| **`v1.0.0`** (Current) | `< v0.9.0` | `< v0.9.0` | \u274C Incompatible / Deprecated | Legacy endpoints decommissioned. |\r\n\r\n### 3.2 Homologated Browsers and Client Platforms\r\n\r\n| Platform / Environment | Minimum Supported Versions | Support Level | Known Constraints |\r\n| :--- | :--- | :---: | :--- |\r\n| **Google Chrome / Chromium** | Version `>= 120` | Tier 1 (Official) | Optimal WebSockets and WebGL performance. |\r\n| **Mozilla Firefox** | Version `>= 115 ESR` | Tier 1 (Official) | Full client certificate support. |\r\n| **Safari / WebKit** | Version `>= 17.0` | Tier 2 (Functional) | Requires explicit mTLS enablement in macOS Keychain. |\r\n| **Terminal / CLI (Linux / macOS / Windows)** | Node.js `>= 18` or Bash `>= 5.0` | Tier 1 (Official) | Full support on PowerShell 7+ and bash. |\r\n\r\n### 3.3 Configuration Files and Data Formats Compatibility\r\n\r\n| Format / Artifact | Source Version Supported | Automatic Conversion | User Action Required |\r\n| :--- | :---: | :---: | :--- |\r\n| **`config.yaml`** | `v0.9.x` | \u2705 Yes | None. Application migrates deprecated keys on startup. |\r\n| **Export Profiles (`.json`)** | `v0.9.x` | \u2705 Yes | 100% backward compatible. |\r\n\r\n---\r\n\r\n## 4. Application Installation, Access, and Configuration\r\n\r\n### 4.1 Access Channels and Prerequisites\r\n\r\n- **Web Portal / UI**: Access URL (e.g., `https://app.system.internal`).\r\n- **Command Line (CLI)**: Executable binary or package (e.g., `npx system-cli` or `./system-client`).\r\n- **Supported Browsers or Platforms**: Chrome >= 120, Firefox >= 120, Linux/macOS/Windows terminal.\r\n\r\n### 4.2 Client Configuration and Environment Variables\r\n\r\nThe application allows parameterizing its behavior via environment variables or local configuration files:\r\n\r\n| Parameter / Variable | Type | Default Value | Required | Description |\r\n| :--- | :--- | :--- | :---: | :--- |\r\n| `API_ENDPOINT` | URL | `https://api.system.internal/v1` | Yes | Base backend API endpoint. |\r\n| `WS_STREAM_URL` | WSS URL | `wss://stream.system.internal/telemetry` | No | Real-time telemetry or notifications socket. |\r\n| `CLIENT_TIMEOUT_MS` | Integer | `5000` | No | Network response timeout in milliseconds. |\r\n| `AUTH_PROFILE` | String | `production` | No | Active authentication profile (`development`, `staging`, `production`). |\r\n\r\n### 4.3 Local Configuration File (`config.yaml` / `.env`)\r\n\r\nExample recommended configuration for operator workstations:\r\n\r\n```yaml\r\n# Client configuration file: config.yaml\r\nprofile: production\r\nnetwork:\r\n api_endpoint: "https://api.system.internal/v1"\r\n stream_url: "wss://stream.system.internal/telemetry"\r\n timeout_ms: 5000\r\n retry_attempts: 3\r\n\r\nsecurity:\r\n tls_verify: true\r\n client_cert_path: "/etc/pki/client/operator.crt"\r\n client_key_path: "/etc/pki/client/operator.key"\r\n\r\nui:\r\n theme: "dark"\r\n refresh_interval_sec: 1\r\n```\r\n\r\n---\r\n\r\n## 5. Step-by-Step Journey Execution Guide (`JRN-*`)\r\n\r\nEach subsection documents an end-to-end Journey, specifying authorized execution roles, starting conditions, and the step-by-step operating procedure.\r\n\r\n### 5.1 `JRN-JOURNEY-001`: User Journey Name\r\n\r\n- **Linked Use Case**: `UC-ACTION-001`\r\n- **Primary Actor**: `ACT-ROLE-USER-001`\r\n- **Authorized Roles**: `ROLE_USER`, `ROLE_OPERATOR`\r\n- **Required Execution Enclave**: Corporate Intranet or VPN access\r\n\r\n#### A. Preconditions\r\n1. User must have an active and authenticated session with their authorized role.\r\n2. The base entity or resource must be in `ACTIVE` state.\r\n\r\n#### B. Step-by-Step Procedure\r\n\r\n1. **Step 1: Operation Initiation**\r\n - **Action**: User navigates to the execution section or invokes the corresponding command:\r\n ```bash\r\n system-cli execute --journey JRN-JOURNEY-001 --input payload.json\r\n ```\r\n - **Required Input**: Resource identifier and validated parameters.\r\n - **Expected On-Screen Response**: System displays confirmation dialog with operation summary.\r\n\r\n2. **Step 2: Validation and Submission**\r\n - **Action**: User reviews parameters and confirms execution.\r\n - **System Behavior**: Client locally validates data schema and transmits signed request.\r\n\r\n3. **Step 3: Observable Outcome Verification**\r\n - **Success Outcome**: Console / interface displays success message `MSG-SUCCESS-001` with generated unique transaction ID.\r\n - **Final State**: Resource transitions to `PROCESSED` state.\r\n\r\n#### C. Alternative Flows and Exception Handling\r\n- **Unauthorized Access**: If an unauthorized role attempts to invoke the journey, the system blocks the action, outputs code `MSG-ERR-AUTH-403`, and records the access attempt in the audit trail.\r\n- **Connection Loss in Transit**: If connection is lost during step 2, client retries with exponential backoff up to 3 times before notifying user.\r\n\r\n---\r\n\r\n## 6. System Messages Catalog and Response Codes\r\n\r\nStructured matrix of key informational, warning, and error messages emitted by the application during its operational lifecycle:\r\n\r\n| Code | Severity | Literal Screen Message | Trigger / Context | Meaning for User | Recommended Corrective Action |\r\n| :--- | :--- | :--- | :--- | :--- | :--- |\r\n| **`MSG-SYS-100`** | `INFO` | `"Connection established successfully with server"` | Successful network handshake upon initializing session. | Application is online and ready to process commands. | None. Normal operation. |\r\n| **`MSG-SYS-200`** | `INFO` | `"Operation completed successfully. Transaction ID: [TX-ID]"` | Successful completion of a Journey or Use Case. | Transaction was persisted and acknowledged by backend. | Save `TX-ID` for tracking if required. |\r\n| **`MSG-WARN-301`** | `WARN` | `"High link latency (>500ms). Degraded mode active"` | Response metric exceeds real-time threshold. | Screen data may experience slight refresh delays. | Check network connection quality or bandwidth. |\r\n| **`MSG-WARN-302`** | `WARN` | `"Session expiring in 5 minutes"` | Authentication token approaching TTL expiry. | User will be logged out unless credential is refreshed. | Renew session by clicking alert or re-authenticating. |\r\n| **`MSG-ERR-401`** | `ERR-USER` | `"Invalid credentials or expired token. Access denied"` | Login authentication failure or expired token. | User identity could not be validated. | Re-enter credentials or request a new token. |\r\n| **`MSG-ERR-403`** | `ERR-USER` | `"Unauthorized action for assigned role [ROLE]"` | Attempted execution of Journey or command outside RBAC. | User role lacks permissions for this resource. | Contact administrator to request permission expansion. |\r\n| **`MSG-ERR-422`** | `ERR-USER` | `"Invalid payload: field [FIELD] does not match schema"` | Syntactic validation or business rule (`BR-*`) failure. | User-supplied data is invalid. | Correct indicated fields according to business rule. |\r\n| **`MSG-ERR-503`** | `ERR-SYS` | `"Service temporarily unavailable. Retrying..."` | Backend gateway unreachable or under scheduled maintenance. | Central server is not responding to requests. | Await automatic retries or check system status page. |\r\n\r\n---\r\n\r\n## 7. Frequently Asked Questions (FAQ) and Support\r\n\r\n- **What should I do if I lose connectivity while executing a Journey?** \r\n The application implements idempotency mechanisms. Once network connectivity is restored, verify resource status before retrying to prevent duplicate transactions.\r\n- **How do I request a user role change?** \r\n Contact the Security Administrator (`SecOps`) referencing your user ID and operational justification for the role change.\r\n\r\n---\r\n\r\n## 8. Revision History and Version Control\r\n\r\n| Version | Date | Author / Agent | Change Description | Change Reference (Change/PR) |\r\n| :--- | :--- | :--- | :--- | :--- |\r\n| **1.0.0** | 2026-09-15 | Documentation & Product Team | Initial User Manual generation | CHG-009 |\r\n';
|
|
15788
15928
|
var STARTER_TEMPLATES_PRIVACY_DATA_ASSET_TEMPLATE_MD = '---\r\nid: DATA-ASSET-USER-PROFILE-001\r\ntype: data-asset\r\ntitle: User Profile & Identity Personal Data Asset\r\nstatus: draft\r\nversion: "1.0.0"\r\nschema-version: "1.0"\r\nclassification: confidential-pii # public, internal, confidential-pii, special-category-sensitive\r\npii-categories:\r\n - identifiers\r\n - contact\r\ndata-subjects:\r\n - ACT-USER-001\r\nfields:\r\n - name: email\r\n sensitivity: pii\r\n masking-strategy: sha256-salt\r\n - name: phone_number\r\n sensitivity: pii\r\n masking-strategy: redact\r\n - name: operator_callsign\r\n sensitivity: internal\r\n masking-strategy: none\r\nretention-period: 365d\r\nerasure-method: crypto-shredding\r\nowner-bounded-context: CMP-IDENTITY-SERVICE-001\r\nsupersedes: null\r\nsuperseded-by: null\r\n---\r\n\r\n# DATA-ASSET-USER-PROFILE-001: User Profile & Identity Personal Data Asset\r\n\r\n## 1. Data Asset Inventory & Purpose\r\nDescribes the structure, storage medium, and operational boundary of the personal data asset governed under GDPR / ISO 27701.\r\n\r\n## 2. Field-Level Sensitivity & Masking Policy\r\n\r\n| Field Name | Sensitivity | Masking / Pseudonymization Strategy | Allowed in Logs | Allowed in AI Prompts |\r\n| :--- | :--- | :--- | :---: | :---: |\r\n| `email` | `pii` | `sha256-salt` | \u274C No | \u274C No |\r\n| `phone_number` | `pii` | `redact` | \u274C No | \u274C No |\r\n| `operator_callsign` | `internal` | `none` | \u2705 Yes | \u2705 Yes |\r\n\r\n## 3. Storage Limitation & Right to Erasure (GDPR Art. 17)\r\n- **Maximum Retention TTL**: `365d` after account deactivation.\r\n- **Erasure Mechanism**: `crypto-shredding` (destruction of per-subject encryption key and PII column purge).\r\n\r\n---\r\n\r\n## 4. Revision History and Version Control\r\n\r\n| Version | Date | Author / Agent | Change Description | Change Reference (Change/PR) |\r\n| :--- | :--- | :--- | :--- | :--- |\r\n| **1.0.0** | 2026-10-17 | Privacy Officer (`agent-privacy-officer`) | Initial personal data asset inventory | CHG-PRIV-001 |\r\n';
|
|
15789
15929
|
var STARTER_TEMPLATES_PRIVACY_DPIA_REQUEST_TEMPLATE_MD = '---\r\nid: DPIA-ASSESSMENT-001\r\ntype: dpia-request\r\ntitle: Data Protection Impact Assessment (DPIA / EIPD) Request\r\nstatus: pending-dpo-approval # pending-dpo-approval, approved, rejected\r\nversion: "1.0.0"\r\nschema-version: "1.0"\r\nropa-reference: PRIV-ROPA-USER-AUTH-001\r\ndata-assets:\r\n - DATA-ASSET-USER-PROFILE-001\r\nspecial-category-triggers:\r\n - "GDPR Art. 9 Special Category Data or Automated Profiling"\r\nresidual-risk-level: MEDIUM # LOW, MEDIUM, HIGH\r\n---\r\n\r\n# Data Protection Impact Assessment (DPIA / EIPD \u2014 GDPR Art. 35)\r\n\r\n## 1. Trigger & Necessity Assessment\r\n- **Associated ROPA**: `PRIV-ROPA-USER-AUTH-001`\r\n- **Data Assets Affected**: `DATA-ASSET-USER-PROFILE-001`\r\n- **Why a DPIA is Mandatory**: Processing involves `special_category_sensitive` data (biometrics, health, precise geolocation) or systematic automated profiling under GDPR Art. 35.\r\n\r\n## 2. Necessity, Proportionality & LINDDUN Risk Matrix\r\n\r\n| LINDDUN Threat Category | Identified Privacy Risk | Intrinsic Risk | Technical Mitigation (`PRIV-REQ-*`) | Residual Risk |\r\n| :--- | :--- | :---: | :--- | :---: |\r\n| **Identifiability** | Re-identification of operator from telemetry streams | HIGH | `PRIV-REQ-MASKING-001` (SHA-256 salted pseudonymization) | LOW |\r\n| **Disclosure of Information** | Plaintext PII leakage in error logs | HIGH | `PRIV-REQ-MASKING-001` (Redaction middleware) | LOW |\r\n\r\n## 3. Mandatory Human Sovereign Signatures (DPO & Legal)\r\n- [ ] **Data Protection Officer (DPO)**: Necessity, proportionality, and GDPR Art. 35 validation\r\n- [ ] **Legal / Privacy Counsel**: Lawful basis and cross-border transfer clauses verified\r\n- [ ] **Security Officer (CISO) / System Architect**: Cryptographic and enclave controls verified\r\n';
|
|
15790
15930
|
var STARTER_TEMPLATES_PRIVACY_PRIVACY_REQ_TEMPLATE_MD = '---\r\nid: PRIV-REQ-MASKING-001\r\ntype: privacy-requirement\r\ntitle: Mandatory Pseudonymization and Log Redaction of Operator PII\r\nstatus: draft\r\nversion: "1.0.0"\r\nschema-version: "1.0"\r\nprivacy-principle: data-minimization # data-minimization, purpose-limitation, storage-limitation, accuracy, integrity-and-confidentiality, transparency-and-consent, data-subject-rights-arco, pseudonymization-anonymization\r\nlinddun-category: identifiability # linkability, identifiability, non-repudiation, detectability, disclosure-of-information, unawareness, non-compliance\r\ngoverns-ropa:\r\n - PRIV-ROPA-USER-AUTH-001\r\nprotects-data-assets:\r\n - DATA-ASSET-USER-PROFILE-001\r\nenforced-in-enclave: SEC-ENC-DMZ-001\r\ncompliance-references:\r\n - "GDPR-Art-25-Privacy-by-Design"\r\n - "GDPR-Art-32-Pseudonymization"\r\n - "ISO-27701-A.7.4"\r\nacceptance-format: gherkin\r\ncucumber-tags:\r\n - "@PRIV-REQ-MASKING-001"\r\n - "@privacy"\r\n - "@linddun"\r\nsupersedes: null\r\nsuperseded-by: null\r\n---\r\n\r\n# PRIV-REQ-MASKING-001: Mandatory Pseudonymization and Log Redaction of Operator PII\r\n\r\n## 1. Technical Privacy Control Statement\r\nThe system MUST pseudonymize or redact all `confidential-pii` fields (`email`, `phone_number`) prior to emitting structured application logs, telemetry traces, or external AI prompts, and MUST enforce automated TTL purge after `365d`.\r\n\r\n---\r\n\r\n## 2. Upstream Privacy Traceability (PDaC)\r\n\r\n| Dimension | Link / Artifact | Relationship Type | Status |\r\n| :--- | :--- | :--- | :--- |\r\n| **Record of Processing (ROPA)** | `PRIV-ROPA-USER-AUTH-001` | Governs Processing Activity | Validated |\r\n| **Protected Data Asset** | `DATA-ASSET-USER-PROFILE-001` | Enforces Field Masking & TTL | Validated |\r\n\r\n---\r\n\r\n## 3. Privacy Verification Criteria in Gherkin Format (Cucumber Privacy Tests)\r\n\r\n```gherkin\r\n@PRIV-REQ-MASKING-001 @privacy @linddun\r\nFeature: Personal Data Pseudonymization and Zero-PII Telemetry Logging\r\n As a Data Protection Officer (DPO)\r\n I want all personal identifiers to be redacted or salted-hashed before logging\r\n So that application logs and telemetry never expose raw personal data\r\n\r\n Scenario: Structured logger redacts PII fields automatically (Nominal Privacy Control)\r\n Given an authenticated operator session with email "operator@example.com" and phone "+34600112233"\r\n When the telemetry ingestion service emits an audit log entry\r\n Then the serialized log payload must not contain the literal string "operator@example.com"\r\n And the serialized log payload must not contain the literal string "+34600112233"\r\n And the email field must be replaced by a deterministic SHA-256 salted pseudonym\r\n\r\n Scenario: Right to erasure purges expired or revoked subject records\r\n Given a personal data record for subject "ACT-USER-001" exceeding the "365d" retention TTL\r\n When the automated retention enforcement job executes\r\n Then the personal data fields must be irreversibly erased via crypto-shredding\r\n```\r\n\r\n---\r\n\r\n## 4. Revision History and Version Control\r\n\r\n| Version | Date | Author / Agent | Change Description | Change Reference (Change/PR) |\r\n| :--- | :--- | :--- | :--- | :--- |\r\n| **1.0.0** | 2026-10-17 | Privacy Officer (`agent-privacy-officer`) | Initial privacy control specification | CHG-PRIV-001 |\r\n';
|
|
15791
15931
|
var STARTER_TEMPLATES_PRIVACY_PRIVACY_ROPA_TEMPLATE_MD = '---\r\nid: PRIV-ROPA-USER-AUTH-001\r\ntype: privacy-ropa\r\ntitle: Record of Processing Activity for Operator Authentication and Session Audit\r\nstatus: draft\r\nversion: "1.0.0"\r\nschema-version: "1.0"\r\nlawful-basis: contract # consent, contract, legal-obligation, vital-interests, public-task, legitimate-interests\r\nspecial-category-condition: null\r\nprocessing-purpose: "Authenticate authorized operators and maintain tamper-evident operational session audit trails."\r\nuse-cases:\r\n - UC-ACTION-001\r\ndata-assets:\r\n - DATA-ASSET-USER-PROFILE-001\r\ndata-subjects:\r\n - ACT-USER-001\r\nretention-ttl: 365d\r\ncross-border-transfer: false\r\ntransfer-safeguards: null\r\nsubprocessors: []\r\ndpia-required: false\r\ndpia-reference: null\r\nmitigated-by:\r\n - PRIV-REQ-MASKING-001\r\nsupersedes: null\r\nsuperseded-by: null\r\n---\r\n\r\n# PRIV-ROPA-USER-AUTH-001: Record of Processing Activity (GDPR Art. 30)\r\n\r\n## 1. Processing Activity Summary & Lawful Basis\r\n- **Lawful Basis (GDPR Art. 6.1)**: `contract` \u2014 Necessary for the performance of the operator service agreement.\r\n- **Purpose of Processing**: Authenticate authorized operators and maintain tamper-evident operational session audit trails.\r\n\r\n## 2. Linked Product & Data Artifacts\r\n\r\n| Dimension | Artifact ID | Relationship |\r\n| :--- | :--- | :--- |\r\n| **Triggering Use Cases** | `UC-ACTION-001` | Initiates personal data collection/processing |\r\n| **Data Assets Processed** | `DATA-ASSET-USER-PROFILE-001` | Personal data fields subject to minimization |\r\n| **Data Subjects** | `ACT-USER-001` | Natural persons whose data is processed |\r\n| **Governing Privacy Controls** | `PRIV-REQ-MASKING-001` | Technical privacy-by-design controls |\r\n\r\n## 3. International Transfers & Subprocessors\r\n- **Cross-Border Transfer Outside EEA**: `false`\r\n- **Authorized Subprocessors**: None (In-house processing within `SEC-ENC-DMZ-001`).\r\n\r\n---\r\n\r\n## 4. Revision History and Version Control\r\n\r\n| Version | Date | Author / Agent | Change Description | Change Reference (Change/PR) |\r\n| :--- | :--- | :--- | :--- | :--- |\r\n| **1.0.0** | 2026-10-17 | Privacy Officer (`agent-privacy-officer`) | Initial GDPR Art. 30 ROPA entry | CHG-PRIV-001 |\r\n';
|
|
15792
15932
|
var STARTER_TEMPLATES_PRODUCT_ACTOR_TEMPLATE_MD = '---\r\nid: ACT-NAME-001\r\ntype: actor\r\ntitle: Descriptive Actor Title\r\nstatus: draft\r\nversion: "1.0.0"\r\nschema-version: "1.0"\r\nrole-type: human-user # human-user, ai-agent, external-system, sensor-iot\r\ndescription: One-sentence summary of the role this actor performs in the system.\r\nsupersedes: null\r\nsuperseded-by: null\r\n---\r\n\r\n# ACT-NAME-001: Descriptive Actor Title\r\n\r\n## 1. Profile and Responsibility\r\nDescribes who this actor is, their operational context, and what goals they pursue when interacting with the product.\r\n\r\n## 2. System Touchpoints\r\n- Interaction channels (Web UI, REST API, WebSocket, Messaging).\r\n- Privilege level and latency/availability expectations.\r\n\r\n---\r\n\r\n## 3. Revision History and Version Control\r\n\r\n| Version | Date | Author / Agent | Change Description | Change Reference (Change/PR) |\r\n| :--- | :--- | :--- | :--- | :--- |\r\n| **1.0.0** | 2026-09-03 | Product Owner / Analyst | Initial actor profile creation | CHG-INIT-001 |\r\n';
|
|
15793
|
-
var STARTER_TEMPLATES_PRODUCT_BOUNDED_CONTEXT_TEMPLATE_MD = '---\nid: BC-NAME-001\ntype: bounded-context\ntitle: "Bounded Context Name"\nstatus: draft\nversion: "1.0.0"\nschema-version: "1.0"\ndomain-type: core\nstrategic-classification:\n evolutionary-stage: custom-built\n business-model-role: differentiator\nresponsibilities:\n - "Primary domain capability or boundary responsibility"\nubiquitous-language-terms:\n - TERM-NAME-001\ncontext-mapping:\n upstream-dependencies: []\n downstream-dependents: []\n integration-patterns:\n - pattern: Open Host Service / Published Language\n related-context: BC-ANOTHER-001\ncomponents-involved:\n - CMP-NAME-001\nsupersedes: null\nsuperseded-by: null\n---\n\n# BC-NAME-001: Bounded Context Name\n\n## 1. Context Purpose and Scope\nExecutive summary and clear linguistic boundary defining what is inside vs. outside this Bounded Context according to Domain-Driven Design (DDD).\n\n### 1.1 Strategic Domain Classification\n- **Domain Type**: `core` (Core Domain / Supporting Subdomain / Generic Subdomain)\n- **Evolutionary Stage**: `custom-built` (Genesis / Custom-Built / Product / Commodity - Wardley Mapping)\n- **Business Role**: Key differentiator creating competitive advantage for the product.\n\n---\n\n## 2. Ubiquitous Language & Domain Invariants\n- **Core Entities & Aggregates**: High-level domain concepts encapsulated within this boundary.\n- **Glossary References**:\n - `TERM-NAME-001`: Primary ubiquitous term definition.\n- **Domain Invariants**: Critical business rules (`BR-*`) enforced exclusively within this boundary.\n\n---\n\n## 3. Context Mapping & Integration Relationships\nRelationships with adjacent Bounded Contexts:\n- **Upstream Contexts**: Contexts providing domain events, APIs, or contracts.\n- **Downstream Contexts**: Contexts consuming models from this boundary.\n- **Anti-Corruption Layers (ACL)**: Translations safeguarding ubiquitous language from external contamination.\n\n---\n\n## 4. Architecture Mapping\n- **Physical Components (`CMP-*`)**: Components implementing aggregates, services, or adapters within this context.\n- **Security Enclaves (`SEC-ENC-*`)**: Execution boundary or isolation tier.\n\n---\n\n## 5. Revision History\n\n| Version | Date | Author / Agent | Change Description | Change Reference (Change/PR) |\n| :--- | :--- | :--- | :--- | :--- |\n| **1.0.0** | YYYY-MM-DD | Product Analyst / Architect | Initial Bounded Context definition | CHG-INIT-001 |\n';
|
|
15933
|
+
var STARTER_TEMPLATES_PRODUCT_BOUNDED_CONTEXT_TEMPLATE_MD = '---\r\nid: BC-NAME-001\r\ntype: bounded-context\r\ntitle: "Bounded Context Name"\r\nstatus: draft\r\nversion: "1.0.0"\r\nschema-version: "1.0"\r\ndomain-type: core\r\nstrategic-classification:\r\n evolutionary-stage: custom-built\r\n business-model-role: differentiator\r\nresponsibilities:\r\n - "Primary domain capability or boundary responsibility"\r\nubiquitous-language-terms:\r\n - TERM-NAME-001\r\ncontext-mapping:\r\n upstream-dependencies: []\r\n downstream-dependents: []\r\n integration-patterns:\r\n - pattern: Open Host Service / Published Language\r\n related-context: BC-ANOTHER-001\r\ncomponents-involved:\r\n - CMP-NAME-001\r\nsupersedes: null\r\nsuperseded-by: null\r\n---\r\n\r\n# BC-NAME-001: Bounded Context Name\r\n\r\n## 1. Context Purpose and Scope\r\nExecutive summary and clear linguistic boundary defining what is inside vs. outside this Bounded Context according to Domain-Driven Design (DDD).\r\n\r\n### 1.1 Strategic Domain Classification\r\n- **Domain Type**: `core` (Core Domain / Supporting Subdomain / Generic Subdomain)\r\n- **Evolutionary Stage**: `custom-built` (Genesis / Custom-Built / Product / Commodity - Wardley Mapping)\r\n- **Business Role**: Key differentiator creating competitive advantage for the product.\r\n\r\n---\r\n\r\n## 2. Ubiquitous Language & Domain Invariants\r\n- **Core Entities & Aggregates**: High-level domain concepts encapsulated within this boundary.\r\n- **Glossary References**:\r\n - `TERM-NAME-001`: Primary ubiquitous term definition.\r\n- **Domain Invariants**: Critical business rules (`BR-*`) enforced exclusively within this boundary.\r\n\r\n---\r\n\r\n## 3. Context Mapping & Integration Relationships\r\nRelationships with adjacent Bounded Contexts:\r\n- **Upstream Contexts**: Contexts providing domain events, APIs, or contracts.\r\n- **Downstream Contexts**: Contexts consuming models from this boundary.\r\n- **Anti-Corruption Layers (ACL)**: Translations safeguarding ubiquitous language from external contamination.\r\n\r\n---\r\n\r\n## 4. Architecture Mapping\r\n- **Physical Components (`CMP-*`)**: Components implementing aggregates, services, or adapters within this context.\r\n- **Security Enclaves (`SEC-ENC-*`)**: Execution boundary or isolation tier.\r\n\r\n---\r\n\r\n## 5. Revision History\r\n\r\n| Version | Date | Author / Agent | Change Description | Change Reference (Change/PR) |\r\n| :--- | :--- | :--- | :--- | :--- |\r\n| **1.0.0** | YYYY-MM-DD | Product Analyst / Architect | Initial Bounded Context definition | CHG-INIT-001 |\r\n';
|
|
15794
15934
|
var STARTER_TEMPLATES_PRODUCT_BUSINESS_RULE_TEMPLATE_MD = '---\r\nid: BR-DOMAIN-001\r\ntype: business-rule\r\ntitle: Business Rule Name\r\nstatus: draft\r\nversion: "1.0.0"\r\nschema-version: "1.0"\r\nenforcement-level: strict-invariant # strict-invariant, override-with-approval, guideline\r\ndefined-in: BC-CONTEXT-001\r\nuses-terms:\r\n - TERM-TERM-001\r\nsupersedes: null\r\nsuperseded-by: null\r\n---\r\n\r\n# BR-DOMAIN-001: Business Rule Name\r\n\r\n## 1. Rule Definition\r\nFormally establishes the business invariant that must not be violated under any circumstance.\r\n\r\n## 2. Business Rationale and Consequences\r\n- **Why it exists**: Economic, regulatory, or technical justification for the constraint.\r\n- **Action upon violation**: Immediate transaction rejection with a formal error code.\r\n\r\n---\r\n\r\n## 3. Revision History and Version Control\r\n\r\n| Version | Date | Author / Agent | Change Description | Change Reference (Change/PR) |\r\n| :--- | :--- | :--- | :--- | :--- |\r\n| **1.0.0** | 2026-09-03 | Product Owner / Analyst | Initial business rule definition | CHG-INIT-001 |\r\n';
|
|
15795
15935
|
var STARTER_TEMPLATES_PRODUCT_JOURNEY_TEMPLATE_MD = '---\r\nid: JRN-NAME-001\r\ntype: journey\r\ntitle: Descriptive User or Operator Journey Title\r\nstatus: draft\r\nversion: "1.0.0"\r\nschema-version: "1.0"\r\npersona: ACT-OPERATOR-001\r\nstages:\r\n - "Discovery and Planning"\r\n - "Configuration and Pre-flight"\r\n - "Mission Execution"\r\n - "Post-Analysis and Wrap-up"\r\ntouchpoints:\r\n - "Mission planning web portal"\r\n - "Ground control station (GCS)"\r\n - "Real-time telemetry dashboard"\r\n - "Flight report exporter"\r\nrelated-use-cases:\r\n - UC-PLAN-MISSION-001\r\n - UC-MONITOR-FLIGHT-001\r\npain-points:\r\n - "Latency when loading offline navigation maps"\r\n - "Complexity in manual flight plan reconciliation"\r\nsupersedes: null\r\nsuperseded-by: null\r\n---\r\n\r\n# JRN-NAME-001: Descriptive User or Operator Journey Title\r\n\r\n## 1. Actor / Primary Persona Profile\r\n- **Protagonist Actor**: `ACT-OPERATOR-001`\r\n- **Main Goal**: Complete operational workflow with high efficiency, safety, and real-time visibility.\r\n\r\n---\r\n\r\n## 2. Journey Stages Map\r\n\r\n| Stage | User Goal | Touchpoints | Frictions / Pain Points |\r\n| :--- | :--- | :--- | :--- |\r\n| **1. Discovery and Planning** | Design route and validate operational constraints | Mission planning web portal | Complexity in manual flight plan reconciliation |\r\n| **2. Configuration and Pre-flight** | Verify subsystem health and link integrity | Ground control station (GCS) | Latency when loading offline navigation maps |\r\n| **3. Mission Execution** | Supervise telemetry and respond to alerts | Real-time telemetry dashboard | None detected in nominal flow |\r\n| **4. Post-Analysis and Wrap-up** | Export mission logs and performance metrics | Flight report exporter | Telemetry consolidation latency |\r\n\r\n---\r\n\r\n## 3. Traceability to Use Cases and Product\r\n\r\n- `UC-PLAN-MISSION-001`: Planning and validation of safe corridors.\r\n- `UC-MONITOR-FLIGHT-001`: Ingestion and visualization of real-time telemetry.\r\n\r\n---\r\n\r\n## 4. Revision History\r\n\r\n| Version | Date | Author / Agent | Change Description | Change Reference (Change/PR) |\r\n| :--- | :--- | :--- | :--- | :--- |\r\n| **1.0.0** | 2026-09-23 | Product Manager / UX Lead | Initial operator journey definition | CHG-INIT-001 |\r\n';
|
|
15796
15936
|
var STARTER_TEMPLATES_PRODUCT_REQUIREMENT_TEMPLATE_MD = '---\r\n# Valid prefixes: FR- (Functional), QR- (Quality), CON- (Constraint)\r\nid: FR-FEATURE-001\r\ntype: requirement\r\ntitle: Concise Requirement Title\r\nstatus: draft\r\nversion: "1.0.0"\r\nschema-version: "1.0"\r\ncategory: functional # functional, quality, constraint\r\n\r\n# 1. PRODUCT TRACEABILITY (Upstream)\r\nderives-from:\r\n - UC-ACTION-001\r\n\r\n# 2. METHOD AND ACCEPTANCE CRITERIA\r\nverifiable-by: cucumber-bdd # cucumber-bdd, automated-unit-test, integration-test, performance-benchmark\r\nacceptance-format: gherkin # gherkin, declarative-prose\r\ncucumber-tags:\r\n - "@FR-FEATURE-001"\r\n - "@automated"\r\n - "@regression"\r\n\r\nsupersedes: null\r\nsuperseded-by: null\r\n---\r\n\r\n# FR-FEATURE-001: Concise Requirement Title\r\n\r\n## 1. Normative Statement\r\nThe system MUST [unambiguous and atomic description of expected behavior under specific conditions].\r\n\r\n---\r\n\r\n## 2. Upstream Traceability\r\n\r\n| Dimension | Link / Artifact | Relationship Type | Status |\r\n| :--- | :--- | :--- | :--- |\r\n| **Product (Upstream)** | `UC-ACTION-001` | Derived from Use Case | Validated |\r\n\r\n> *Note: Traceability toward Architecture and Testing is maintained inversely; services declare `satisfies-requirements` and test suites tag or reference this requirement.*\r\n\r\n---\r\n\r\n## 3. Acceptance Criteria in Gherkin (Cucumber) Format\r\n\r\n```gherkin\r\n@FR-FEATURE-001 @automated @regression\r\nFeature: Concise Requirement Title\r\n As a [primary actor / user role]\r\n I want [functional system capability]\r\n So that [obtain expected business benefit or value]\r\n\r\n Background:\r\n Given the system is in operational state\r\n And the actor is authenticated with valid permissions\r\n\r\n Scenario: Successful nominal flow\r\n Given the system has initial precondition configured\r\n When the actor submits a request with valid parameters\r\n Then the system processes the operation successfully\r\n And the resource status updates to "ACTIVE"\r\n And the corresponding domain event is emitted\r\n\r\n Scenario Outline: Business rule validation and edge cases\r\n Given data input with value "<input>"\r\n When requirement validation is processed\r\n Then the response must return status code "<status_code>"\r\n And the descriptive message must be "<message>"\r\n\r\n Examples:\r\n | input | status_code | message |\r\n | correct_value | 200 | SUCCESSFUL_OPERATION |\r\n | invalid_value | 400 | ERROR_INVALID_PARAMETER |\r\n | limit_exceeded | 422 | ERROR_LIMIT_EXCEEDED |\r\n```\r\n\r\n---\r\n\r\n## 4. Revision History and Version Control\r\n\r\n| Version | Date | Author / Agent | Change Description | Change Reference (Change/PR) |\r\n| :--- | :--- | :--- | :--- | :--- |\r\n| **1.0.0** | 2026-09-03 | Product Owner / QA | Initial specification with complete 360\xB0 traceability | CHG-INIT-001 |\r\n';
|
|
@@ -15953,14 +16093,27 @@ categories:
|
|
|
15953
16093
|
- "Unlicense"
|
|
15954
16094
|
- "CC0-1.0"
|
|
15955
16095
|
- "0BSD"
|
|
16096
|
+
- "Python-2.0"
|
|
16097
|
+
- "BlueOak-1.0.0"
|
|
16098
|
+
- "Zlib"
|
|
16099
|
+
- "CC-BY-3.0"
|
|
16100
|
+
- "CC-BY-4.0"
|
|
16101
|
+
- "MS-PL"
|
|
15956
16102
|
|
|
15957
16103
|
weak_copyleft_conditional:
|
|
15958
16104
|
action: "REVIEW_REQUIRED"
|
|
15959
16105
|
description: "Allowed only as dynamically linked decoupled libraries."
|
|
15960
16106
|
spdx_identifiers:
|
|
15961
16107
|
- "LGPL-2.1-only"
|
|
16108
|
+
- "LGPL-2.1-or-later"
|
|
15962
16109
|
- "LGPL-3.0-only"
|
|
16110
|
+
- "LGPL-3.0-or-later"
|
|
15963
16111
|
- "MPL-2.0"
|
|
16112
|
+
- "EPL-2.0"
|
|
16113
|
+
- "CDDL-1.0"
|
|
16114
|
+
- "MS-RL"
|
|
16115
|
+
- "MS-LPL"
|
|
16116
|
+
- "MS-LRL"
|
|
15964
16117
|
|
|
15965
16118
|
strong_copyleft_viral:
|
|
15966
16119
|
action: "DENY"
|
|
@@ -16318,7 +16471,7 @@ jobs:
|
|
|
16318
16471
|
runs-on: ubuntu-latest
|
|
16319
16472
|
strategy:
|
|
16320
16473
|
matrix:
|
|
16321
|
-
node-version: [
|
|
16474
|
+
node-version: [ 20.x, 22.x ]
|
|
16322
16475
|
|
|
16323
16476
|
steps:
|
|
16324
16477
|
- name: Checkout Code
|
|
@@ -16580,11 +16733,7 @@ function appendAntigravityFiles(dirs, files) {
|
|
|
16580
16733
|
files.push({ relPath: ".agent/rules/ai-sdlc.md", content: STARTER_ANTIGRAVITY_RULES });
|
|
16581
16734
|
for (const agent of SPECIALIZED_AGENT_TEMPLATES) {
|
|
16582
16735
|
const content = renderAntigravityAgentFile(agent);
|
|
16583
|
-
|
|
16584
|
-
files.push(
|
|
16585
|
-
{ relPath: `.agent/agents/${agent.id}.md`, content },
|
|
16586
|
-
{ relPath: `.agent/skills/${agent.id}/SKILL.md`, content }
|
|
16587
|
-
);
|
|
16736
|
+
files.push({ relPath: `.agent/agents/${agent.id}.md`, content });
|
|
16588
16737
|
}
|
|
16589
16738
|
for (const skill of LIFECYCLE_SKILL_TEMPLATES) {
|
|
16590
16739
|
dirs.push(`.agent/skills/${skill.id}`);
|
|
@@ -17042,6 +17191,468 @@ function sanitizeDlpPayload(payload, policy = createDefaultDlpPolicy()) {
|
|
|
17042
17191
|
return payload;
|
|
17043
17192
|
}
|
|
17044
17193
|
}
|
|
17194
|
+
var CITATION_REGEX = /\b(ARCH-INTRO|JRN|ACT-THREAT|ACT|UC|BR|BC|ABUSE|DATA-ASSET|PRIV-ROPA|HAZ|SEC-ENC|CMP|ADR|SEC-REQ|PRIV-REQ|FR|QR|CHG|TSK|HOF)-[A-Z0-9_-]+/g;
|
|
17195
|
+
function parseTasksFromDir(changeDirPath, rootDir) {
|
|
17196
|
+
const tasksPath = path5__namespace.join(changeDirPath, "tasks.md");
|
|
17197
|
+
if (!fs8__namespace.existsSync(tasksPath)) return [];
|
|
17198
|
+
try {
|
|
17199
|
+
const raw = fs8__namespace.readFileSync(tasksPath, "utf-8");
|
|
17200
|
+
const { frontmatter } = parseTasksDoc(raw);
|
|
17201
|
+
const changeId = typeof frontmatter["change-id"] === "string" ? frontmatter["change-id"] : path5__namespace.basename(changeDirPath);
|
|
17202
|
+
const list = [];
|
|
17203
|
+
if (Array.isArray(frontmatter.tasks)) {
|
|
17204
|
+
const relPath = path5__namespace.relative(rootDir, tasksPath).replace(/\\/g, "/");
|
|
17205
|
+
for (const t of frontmatter.tasks) {
|
|
17206
|
+
list.push({ task: t, changeId, tasksFilePath: relPath });
|
|
17207
|
+
}
|
|
17208
|
+
}
|
|
17209
|
+
return list;
|
|
17210
|
+
} catch {
|
|
17211
|
+
return [];
|
|
17212
|
+
}
|
|
17213
|
+
}
|
|
17214
|
+
function scanTasksInBaseDir(baseDir, rootDir) {
|
|
17215
|
+
if (!fs8__namespace.existsSync(baseDir)) return [];
|
|
17216
|
+
const acc = [];
|
|
17217
|
+
try {
|
|
17218
|
+
const entries = fs8__namespace.readdirSync(baseDir, { withFileTypes: true });
|
|
17219
|
+
for (const e of entries) {
|
|
17220
|
+
if (e.isDirectory()) {
|
|
17221
|
+
acc.push(...parseTasksFromDir(path5__namespace.join(baseDir, e.name), rootDir));
|
|
17222
|
+
}
|
|
17223
|
+
}
|
|
17224
|
+
} catch {
|
|
17225
|
+
}
|
|
17226
|
+
return acc;
|
|
17227
|
+
}
|
|
17228
|
+
function scanAllTasks(rootDir) {
|
|
17229
|
+
const activeDir = path5__namespace.join(rootDir, "specs", "changes", "active");
|
|
17230
|
+
const completedDir = path5__namespace.join(rootDir, "specs", "changes", "completed");
|
|
17231
|
+
return [
|
|
17232
|
+
...scanTasksInBaseDir(activeDir, rootDir),
|
|
17233
|
+
...scanTasksInBaseDir(completedDir, rootDir)
|
|
17234
|
+
];
|
|
17235
|
+
}
|
|
17236
|
+
function isSkippableLine(trimmed) {
|
|
17237
|
+
return trimmed.startsWith("#") || trimmed.startsWith("---") || trimmed.startsWith("|") || trimmed.startsWith("```");
|
|
17238
|
+
}
|
|
17239
|
+
function collectTextParagraphs(body) {
|
|
17240
|
+
const lines = body.split(/\r?\n/);
|
|
17241
|
+
const paragraphs = [];
|
|
17242
|
+
let current = [];
|
|
17243
|
+
for (const line of lines) {
|
|
17244
|
+
const trimmed = line.trim();
|
|
17245
|
+
if (isSkippableLine(trimmed) || !trimmed) {
|
|
17246
|
+
if (current.length > 0) {
|
|
17247
|
+
paragraphs.push(current.join(" "));
|
|
17248
|
+
current = [];
|
|
17249
|
+
}
|
|
17250
|
+
continue;
|
|
17251
|
+
}
|
|
17252
|
+
current.push(trimmed);
|
|
17253
|
+
}
|
|
17254
|
+
if (current.length > 0) {
|
|
17255
|
+
paragraphs.push(current.join(" "));
|
|
17256
|
+
}
|
|
17257
|
+
return paragraphs;
|
|
17258
|
+
}
|
|
17259
|
+
function extractTechnicalSummary(body, fallbackTitle) {
|
|
17260
|
+
if (!body || !body.trim()) {
|
|
17261
|
+
return fallbackTitle ? `Elemento ${fallbackTitle}.` : "Sin descripci\xF3n detallada.";
|
|
17262
|
+
}
|
|
17263
|
+
const paras = collectTextParagraphs(body);
|
|
17264
|
+
const firstGood = paras.find((p) => p.length > 20 && !p.startsWith(">"));
|
|
17265
|
+
if (firstGood) {
|
|
17266
|
+
return firstGood.length > 350 ? firstGood.substring(0, 347) + "..." : firstGood;
|
|
17267
|
+
}
|
|
17268
|
+
return paras[0] || fallbackTitle || "Sin resumen disponible.";
|
|
17269
|
+
}
|
|
17270
|
+
function resolveCitationType(cit) {
|
|
17271
|
+
if (cit.startsWith("CMP-")) return "component";
|
|
17272
|
+
if (cit.startsWith("FR-") || cit.startsWith("QR-")) return "requirement";
|
|
17273
|
+
if (cit.startsWith("SEC-REQ-")) return "security-requirement";
|
|
17274
|
+
if (cit.startsWith("PRIV-REQ-")) return "privacy-requirement";
|
|
17275
|
+
if (cit.startsWith("UC-")) return "use-case";
|
|
17276
|
+
if (cit.startsWith("ADR-")) return "adr";
|
|
17277
|
+
return "artifact";
|
|
17278
|
+
}
|
|
17279
|
+
function buildCitationRelations(citations) {
|
|
17280
|
+
return citations.map((cit) => ({
|
|
17281
|
+
id: cit,
|
|
17282
|
+
type: resolveCitationType(cit),
|
|
17283
|
+
direction: "upstream",
|
|
17284
|
+
relation: cit.startsWith("CMP-") ? "implements" : "satisfies"
|
|
17285
|
+
}));
|
|
17286
|
+
}
|
|
17287
|
+
function findTasksForCitations(citations, allTasks) {
|
|
17288
|
+
const relations = [];
|
|
17289
|
+
for (const dt of allTasks) {
|
|
17290
|
+
const t = dt.task;
|
|
17291
|
+
const matchesReq = t.satisfiesRequirements?.some((r) => citations.includes(r));
|
|
17292
|
+
const matchesCmp = t.implementsComponents?.some((c) => citations.includes(c));
|
|
17293
|
+
if (matchesReq || matchesCmp) {
|
|
17294
|
+
relations.push({
|
|
17295
|
+
id: `${t.id} (${dt.changeId})`,
|
|
17296
|
+
type: "task",
|
|
17297
|
+
direction: "upstream",
|
|
17298
|
+
relation: "developed-by-task",
|
|
17299
|
+
title: t.title,
|
|
17300
|
+
filePath: dt.tasksFilePath
|
|
17301
|
+
});
|
|
17302
|
+
}
|
|
17303
|
+
}
|
|
17304
|
+
return relations;
|
|
17305
|
+
}
|
|
17306
|
+
function isTestNode(e) {
|
|
17307
|
+
if (e.group !== "nodes") return false;
|
|
17308
|
+
const d = e.data;
|
|
17309
|
+
return d.layer === "test" || d.type === "bdd-feature" || d.type === "code-test";
|
|
17310
|
+
}
|
|
17311
|
+
function findTestNodesForCitations(citations, graphElements) {
|
|
17312
|
+
const downstream = [];
|
|
17313
|
+
const testNodes = graphElements.filter(isTestNode).map((e) => e.data);
|
|
17314
|
+
for (const tn of testNodes) {
|
|
17315
|
+
const isMatched = citations.some((c) => tn.content?.includes(c) || tn.title?.includes(c) || tn.id?.includes(c));
|
|
17316
|
+
if (isMatched) {
|
|
17317
|
+
downstream.push({
|
|
17318
|
+
id: tn.label || tn.id,
|
|
17319
|
+
type: tn.type || "test",
|
|
17320
|
+
direction: "downstream",
|
|
17321
|
+
relation: "verified-by",
|
|
17322
|
+
title: tn.title,
|
|
17323
|
+
filePath: tn.filePath
|
|
17324
|
+
});
|
|
17325
|
+
}
|
|
17326
|
+
}
|
|
17327
|
+
return downstream;
|
|
17328
|
+
}
|
|
17329
|
+
function extractKeySymbols(content) {
|
|
17330
|
+
const fns = Array.from(content.matchAll(/export\s+(?:async\s+)?function\s+([a-zA-Z0-9_]+)/g)).map((m) => m[1]);
|
|
17331
|
+
const cls = Array.from(content.matchAll(/export\s+class\s+([a-zA-Z0-9_]+)/g)).map((m) => m[1]);
|
|
17332
|
+
const cst = Array.from(content.matchAll(/export\s+const\s+([a-zA-Z0-9_]+)/g)).map((m) => m[1]);
|
|
17333
|
+
return [...fns, ...cls, ...cst].slice(0, 6);
|
|
17334
|
+
}
|
|
17335
|
+
function buildSourceSummary(ext, loc, symbols, citations) {
|
|
17336
|
+
const parts = [
|
|
17337
|
+
`M\xF3dulo de c\xF3digo fuente (${ext || "c\xF3digo"}).`,
|
|
17338
|
+
`Tama\xF1o: ${loc} l\xEDneas de c\xF3digo.`
|
|
17339
|
+
];
|
|
17340
|
+
if (symbols.length > 0) parts.push(`S\xEDmbolos clave: ${symbols.join(", ")}.`);
|
|
17341
|
+
if (citations.length > 0) parts.push(`Trazabilidad: ${citations.join(", ")}.`);
|
|
17342
|
+
return parts.join(" ");
|
|
17343
|
+
}
|
|
17344
|
+
function deduplicateRelations(items) {
|
|
17345
|
+
const map = /* @__PURE__ */ new Map();
|
|
17346
|
+
for (const item of items) {
|
|
17347
|
+
map.set(item.id, item);
|
|
17348
|
+
}
|
|
17349
|
+
return Array.from(map.values());
|
|
17350
|
+
}
|
|
17351
|
+
function buildSourceInspectResult(relPath, summary, upstream, downstream, content, metrics) {
|
|
17352
|
+
const relatedItems = deduplicateRelations([...upstream, ...downstream]);
|
|
17353
|
+
return {
|
|
17354
|
+
found: true,
|
|
17355
|
+
query: relPath,
|
|
17356
|
+
id: path5__namespace.basename(relPath),
|
|
17357
|
+
title: relPath,
|
|
17358
|
+
type: "source-file",
|
|
17359
|
+
layer: "code",
|
|
17360
|
+
filePath: relPath,
|
|
17361
|
+
status: "ACTIVE",
|
|
17362
|
+
summary,
|
|
17363
|
+
upstream,
|
|
17364
|
+
downstream,
|
|
17365
|
+
relatedItems,
|
|
17366
|
+
metrics: {
|
|
17367
|
+
loc: metrics.loc,
|
|
17368
|
+
extension: metrics.ext,
|
|
17369
|
+
exportedSymbolsCount: metrics.symbolsCount,
|
|
17370
|
+
citationsCount: metrics.citationsCount
|
|
17371
|
+
},
|
|
17372
|
+
contentPreview: content.substring(0, 1e3)
|
|
17373
|
+
};
|
|
17374
|
+
}
|
|
17375
|
+
function inspectSourceCodeFile(fullPath, relPath, graphElements, allTasks) {
|
|
17376
|
+
const content = fs8__namespace.readFileSync(fullPath, "utf-8");
|
|
17377
|
+
const loc = content.split("\n").length;
|
|
17378
|
+
const ext = path5__namespace.extname(fullPath).toLowerCase();
|
|
17379
|
+
const citations = Array.from(new Set(content.match(CITATION_REGEX) || []));
|
|
17380
|
+
const upstream = [
|
|
17381
|
+
...buildCitationRelations(citations),
|
|
17382
|
+
...findTasksForCitations(citations, allTasks)
|
|
17383
|
+
];
|
|
17384
|
+
const downstream = findTestNodesForCitations(citations, graphElements);
|
|
17385
|
+
const keySymbols = extractKeySymbols(content);
|
|
17386
|
+
const summary = buildSourceSummary(ext, loc, keySymbols, citations);
|
|
17387
|
+
return buildSourceInspectResult(relPath, summary, upstream, downstream, content, {
|
|
17388
|
+
loc,
|
|
17389
|
+
ext,
|
|
17390
|
+
symbolsCount: keySymbols.length,
|
|
17391
|
+
citationsCount: citations.length
|
|
17392
|
+
});
|
|
17393
|
+
}
|
|
17394
|
+
function buildTaskUpstreamRelations(t, changeId, filePath, graphNodes) {
|
|
17395
|
+
const list = [
|
|
17396
|
+
{ id: changeId, type: "change-proposal", direction: "upstream", relation: "part-of-change", filePath }
|
|
17397
|
+
];
|
|
17398
|
+
for (const cmp of t.implementsComponents || []) {
|
|
17399
|
+
const node = graphNodes.get(cmp);
|
|
17400
|
+
list.push({ id: cmp, type: "component", direction: "upstream", relation: "implements", title: node?.title, filePath: node?.filePath });
|
|
17401
|
+
}
|
|
17402
|
+
for (const req of t.satisfiesRequirements || []) {
|
|
17403
|
+
const node = graphNodes.get(req);
|
|
17404
|
+
list.push({ id: req, type: node?.type || "requirement", direction: "upstream", relation: "satisfies", title: node?.title, filePath: node?.filePath });
|
|
17405
|
+
}
|
|
17406
|
+
return list;
|
|
17407
|
+
}
|
|
17408
|
+
function buildTaskVerificationDownstream(t) {
|
|
17409
|
+
if (!t.verification?.criteria && !t.verification?.method) return [];
|
|
17410
|
+
return [{
|
|
17411
|
+
id: `${t.verification.method || "verification"}: ${t.verification.criteria || "passed"}`,
|
|
17412
|
+
type: "verification-criteria",
|
|
17413
|
+
direction: "downstream",
|
|
17414
|
+
relation: "verified-by-criteria"
|
|
17415
|
+
}];
|
|
17416
|
+
}
|
|
17417
|
+
function buildTaskSummary(t) {
|
|
17418
|
+
const mode = t.autonomyMode || "AUTONOMOUS";
|
|
17419
|
+
const assigned = t.assignedTo || "agent-developer";
|
|
17420
|
+
const c = t.complexity || "MEDIUM";
|
|
17421
|
+
const r = t.riskLevel || "LOW";
|
|
17422
|
+
const s = t.status || "PENDING";
|
|
17423
|
+
return `Tarea [${mode}] asignada a ${assigned}. Complejidad: ${c}, Riesgo: ${r}. Estado: ${s}.`;
|
|
17424
|
+
}
|
|
17425
|
+
function inspectDiscoveredTask(dt, graphNodes) {
|
|
17426
|
+
const t = dt.task;
|
|
17427
|
+
const upstream = buildTaskUpstreamRelations(t, dt.changeId, dt.tasksFilePath, graphNodes);
|
|
17428
|
+
const downstream = buildTaskVerificationDownstream(t);
|
|
17429
|
+
const summary = buildTaskSummary(t);
|
|
17430
|
+
const relatedItems = deduplicateRelations([...upstream, ...downstream]);
|
|
17431
|
+
return {
|
|
17432
|
+
found: true,
|
|
17433
|
+
query: t.id,
|
|
17434
|
+
id: t.id,
|
|
17435
|
+
title: t.title || t.id,
|
|
17436
|
+
type: "task",
|
|
17437
|
+
layer: "governance",
|
|
17438
|
+
filePath: dt.tasksFilePath,
|
|
17439
|
+
status: t.status || "ACTIVE",
|
|
17440
|
+
summary,
|
|
17441
|
+
upstream,
|
|
17442
|
+
downstream,
|
|
17443
|
+
relatedItems,
|
|
17444
|
+
metrics: { autonomyMode: t.autonomyMode, complexity: t.complexity, riskLevel: t.riskLevel, status: t.status }
|
|
17445
|
+
};
|
|
17446
|
+
}
|
|
17447
|
+
function inspectDirectFile(directPath, rootDir, options) {
|
|
17448
|
+
if (!fs8__namespace.existsSync(directPath) || !fs8__namespace.statSync(directPath).isFile()) {
|
|
17449
|
+
return null;
|
|
17450
|
+
}
|
|
17451
|
+
const relFile = path5__namespace.relative(rootDir, directPath).replace(/\\/g, "/");
|
|
17452
|
+
const ext = path5__namespace.extname(directPath).toLowerCase();
|
|
17453
|
+
if (ext === ".md") {
|
|
17454
|
+
try {
|
|
17455
|
+
const rawContent = fs8__namespace.readFileSync(directPath, "utf-8");
|
|
17456
|
+
const { frontmatter } = parseFrontmatter(rawContent);
|
|
17457
|
+
if (frontmatter.id && typeof frontmatter.id === "string") {
|
|
17458
|
+
const sub = inspectElement(frontmatter.id, options);
|
|
17459
|
+
sub.filePath = relFile;
|
|
17460
|
+
return sub;
|
|
17461
|
+
}
|
|
17462
|
+
} catch {
|
|
17463
|
+
}
|
|
17464
|
+
}
|
|
17465
|
+
const graphRes = buildGraphElements(rootDir);
|
|
17466
|
+
const allTasks = scanAllTasks(rootDir);
|
|
17467
|
+
return inspectSourceCodeFile(directPath, relFile, graphRes.elements, allTasks);
|
|
17468
|
+
}
|
|
17469
|
+
function findTargetNode(normQuery, nodeMap) {
|
|
17470
|
+
const direct = nodeMap.get(normQuery) || Array.from(nodeMap.values()).find((n) => n.id.toLowerCase() === normQuery);
|
|
17471
|
+
if (direct) return direct;
|
|
17472
|
+
return Array.from(nodeMap.values()).find(
|
|
17473
|
+
(n) => n.title && n.title.toLowerCase().includes(normQuery) || n.filePath && n.filePath.toLowerCase().includes(normQuery)
|
|
17474
|
+
);
|
|
17475
|
+
}
|
|
17476
|
+
function collectIncomingEdges(nodeId, edges, nodeMap) {
|
|
17477
|
+
const upstream = [];
|
|
17478
|
+
for (const e of edges) {
|
|
17479
|
+
if (e.target === nodeId) {
|
|
17480
|
+
const srcNode = nodeMap.get(e.source);
|
|
17481
|
+
upstream.push({
|
|
17482
|
+
id: e.source,
|
|
17483
|
+
type: srcNode?.type || "artifact",
|
|
17484
|
+
direction: "upstream",
|
|
17485
|
+
relation: e.relation || "derives-from",
|
|
17486
|
+
title: srcNode?.title,
|
|
17487
|
+
filePath: srcNode?.filePath
|
|
17488
|
+
});
|
|
17489
|
+
}
|
|
17490
|
+
}
|
|
17491
|
+
return upstream;
|
|
17492
|
+
}
|
|
17493
|
+
function collectOutgoingEdges(nodeId, edges, nodeMap) {
|
|
17494
|
+
const downstream = [];
|
|
17495
|
+
for (const e of edges) {
|
|
17496
|
+
if (e.source === nodeId) {
|
|
17497
|
+
const tgtNode = nodeMap.get(e.target);
|
|
17498
|
+
downstream.push({
|
|
17499
|
+
id: e.target,
|
|
17500
|
+
type: tgtNode?.type || "artifact",
|
|
17501
|
+
direction: "downstream",
|
|
17502
|
+
relation: e.relation || "satisfies",
|
|
17503
|
+
title: tgtNode?.title,
|
|
17504
|
+
filePath: tgtNode?.filePath
|
|
17505
|
+
});
|
|
17506
|
+
}
|
|
17507
|
+
}
|
|
17508
|
+
return downstream;
|
|
17509
|
+
}
|
|
17510
|
+
function collectNodeEdges(nodeId, edges, nodeMap) {
|
|
17511
|
+
return {
|
|
17512
|
+
upstream: collectIncomingEdges(nodeId, edges, nodeMap),
|
|
17513
|
+
downstream: collectOutgoingEdges(nodeId, edges, nodeMap)
|
|
17514
|
+
};
|
|
17515
|
+
}
|
|
17516
|
+
function attachTasksToNodeRelations(nodeId, allTasks, downstream) {
|
|
17517
|
+
for (const dt of allTasks) {
|
|
17518
|
+
const t = dt.task;
|
|
17519
|
+
const satisfiesThis = t.satisfiesRequirements?.includes(nodeId);
|
|
17520
|
+
const implementsThis = t.implementsComponents?.includes(nodeId);
|
|
17521
|
+
if (satisfiesThis || implementsThis) {
|
|
17522
|
+
downstream.push({
|
|
17523
|
+
id: `${t.id} (${dt.changeId})`,
|
|
17524
|
+
type: "task",
|
|
17525
|
+
direction: "downstream",
|
|
17526
|
+
relation: implementsThis ? "implements-component" : "satisfies-requirement",
|
|
17527
|
+
title: t.title,
|
|
17528
|
+
filePath: dt.tasksFilePath
|
|
17529
|
+
});
|
|
17530
|
+
}
|
|
17531
|
+
}
|
|
17532
|
+
}
|
|
17533
|
+
function buildNotFoundResult(trimmed, nodeMap) {
|
|
17534
|
+
const normQuery = trimmed.toLowerCase();
|
|
17535
|
+
const suggestions = Array.from(nodeMap.values()).filter((n) => n.id.toLowerCase().includes(normQuery.substring(0, 4)) || n.title && n.title.toLowerCase().includes(normQuery.substring(0, 4))).slice(0, 5).map((n) => ({
|
|
17536
|
+
id: n.id,
|
|
17537
|
+
type: n.type,
|
|
17538
|
+
direction: "bidirectional",
|
|
17539
|
+
relation: "suggestion",
|
|
17540
|
+
title: n.title,
|
|
17541
|
+
filePath: n.filePath
|
|
17542
|
+
}));
|
|
17543
|
+
return {
|
|
17544
|
+
found: false,
|
|
17545
|
+
query: trimmed,
|
|
17546
|
+
summary: `No se encontr\xF3 ning\xFAn elemento o archivo coincidente con "${trimmed}". Revisa el identificador o la ruta relativa.`,
|
|
17547
|
+
upstream: [],
|
|
17548
|
+
downstream: [],
|
|
17549
|
+
relatedItems: suggestions
|
|
17550
|
+
};
|
|
17551
|
+
}
|
|
17552
|
+
function inspectMatchedNode(matchedNode, trimmed, edges, nodeMap, allTasks) {
|
|
17553
|
+
const { upstream, downstream } = collectNodeEdges(matchedNode.id, edges, nodeMap);
|
|
17554
|
+
attachTasksToNodeRelations(matchedNode.id, allTasks, downstream);
|
|
17555
|
+
const summary = extractTechnicalSummary(matchedNode.content || "", matchedNode.title);
|
|
17556
|
+
const relatedItems = deduplicateRelations([...upstream, ...downstream]);
|
|
17557
|
+
return {
|
|
17558
|
+
found: true,
|
|
17559
|
+
query: trimmed,
|
|
17560
|
+
id: matchedNode.id,
|
|
17561
|
+
title: matchedNode.title || matchedNode.label || matchedNode.id,
|
|
17562
|
+
type: matchedNode.type,
|
|
17563
|
+
layer: matchedNode.layer,
|
|
17564
|
+
filePath: matchedNode.filePath,
|
|
17565
|
+
status: matchedNode.status || "COMPLIANT",
|
|
17566
|
+
summary,
|
|
17567
|
+
upstream,
|
|
17568
|
+
downstream,
|
|
17569
|
+
relatedItems,
|
|
17570
|
+
contentPreview: matchedNode.content ? matchedNode.content.substring(0, 1500) : void 0
|
|
17571
|
+
};
|
|
17572
|
+
}
|
|
17573
|
+
function resolveTargetMatch(normQuery, nodeMap, allTasks, edges, trimmed) {
|
|
17574
|
+
const matchedTask = allTasks.find(
|
|
17575
|
+
(dt) => dt.task.id.toLowerCase() === normQuery || `${dt.changeId}/${dt.task.id}`.toLowerCase() === normQuery
|
|
17576
|
+
);
|
|
17577
|
+
if (matchedTask && normQuery.startsWith("tsk-")) {
|
|
17578
|
+
return inspectDiscoveredTask(matchedTask, nodeMap);
|
|
17579
|
+
}
|
|
17580
|
+
const matchedNode = findTargetNode(normQuery, nodeMap);
|
|
17581
|
+
if (matchedNode) {
|
|
17582
|
+
return inspectMatchedNode(matchedNode, trimmed, edges, nodeMap, allTasks);
|
|
17583
|
+
}
|
|
17584
|
+
if (matchedTask) {
|
|
17585
|
+
return inspectDiscoveredTask(matchedTask, nodeMap);
|
|
17586
|
+
}
|
|
17587
|
+
return buildNotFoundResult(trimmed, nodeMap);
|
|
17588
|
+
}
|
|
17589
|
+
function inspectElement(query, options = {}) {
|
|
17590
|
+
const rootDir = options.rootDir || process.cwd();
|
|
17591
|
+
const trimmed = query.trim();
|
|
17592
|
+
const directPath = path5__namespace.isAbsolute(trimmed) ? trimmed : path5__namespace.join(rootDir, trimmed);
|
|
17593
|
+
const fileRes = inspectDirectFile(directPath, rootDir, options);
|
|
17594
|
+
if (fileRes) return fileRes;
|
|
17595
|
+
const graphRes = buildGraphElements(rootDir);
|
|
17596
|
+
const nodeMap = /* @__PURE__ */ new Map();
|
|
17597
|
+
for (const e of graphRes.elements) {
|
|
17598
|
+
if (e.group === "nodes") {
|
|
17599
|
+
const d = e.data;
|
|
17600
|
+
nodeMap.set(d.id, d);
|
|
17601
|
+
}
|
|
17602
|
+
}
|
|
17603
|
+
const edges = graphRes.elements.filter((e) => e.group === "edges").map((e) => e.data);
|
|
17604
|
+
const allTasks = scanAllTasks(rootDir);
|
|
17605
|
+
return resolveTargetMatch(trimmed.toLowerCase(), nodeMap, allTasks, edges, trimmed);
|
|
17606
|
+
}
|
|
17607
|
+
function formatRelationsBlock(title, list, arrow) {
|
|
17608
|
+
if (list.length === 0) return [];
|
|
17609
|
+
const lines = [title];
|
|
17610
|
+
for (const item of list) {
|
|
17611
|
+
const titleSuffix = item.title ? ` \u2014 *${item.title}*` : "";
|
|
17612
|
+
lines.push(`- ${arrow} **\`${item.id}\`** (\`${item.type}\`) [${item.relation}]${titleSuffix}`);
|
|
17613
|
+
}
|
|
17614
|
+
lines.push("");
|
|
17615
|
+
return lines;
|
|
17616
|
+
}
|
|
17617
|
+
function formatRelatedNavBlock(list) {
|
|
17618
|
+
if (list.length === 0) return [];
|
|
17619
|
+
const lines = ["#### \u{1F4CB} Elementos Navegables (Seleccionables para continuar navegaci\xF3n):"];
|
|
17620
|
+
let index = 1;
|
|
17621
|
+
for (const item of list) {
|
|
17622
|
+
const arrow = item.direction === "upstream" ? "\u2197\uFE0F" : item.direction === "downstream" ? "\u2198\uFE0F" : "\u2194\uFE0F";
|
|
17623
|
+
lines.push(`${index}. ${arrow} **\`${item.id}\`** (\`${item.type}\` \u2014 *${item.relation}*)`);
|
|
17624
|
+
index++;
|
|
17625
|
+
}
|
|
17626
|
+
lines.push("");
|
|
17627
|
+
return lines;
|
|
17628
|
+
}
|
|
17629
|
+
function formatNotFoundMarkdown(result) {
|
|
17630
|
+
const lines = [`### \u274C Elemento no encontrado: \`${result.query}\``, "", result.summary];
|
|
17631
|
+
if (result.relatedItems.length > 0) {
|
|
17632
|
+
lines.push("", "#### Sugerencias cercanas:");
|
|
17633
|
+
for (const s of result.relatedItems) {
|
|
17634
|
+
lines.push(`- **\`${s.id}\`** (${s.type}): ${s.title || "Sin t\xEDtulo"}`);
|
|
17635
|
+
}
|
|
17636
|
+
}
|
|
17637
|
+
return lines.join("\n");
|
|
17638
|
+
}
|
|
17639
|
+
function formatInspectResultMarkdown(result) {
|
|
17640
|
+
if (!result.found) return formatNotFoundMarkdown(result);
|
|
17641
|
+
const lines = [
|
|
17642
|
+
`### \u{1F50D} Inspecci\xF3n: \`${result.id || result.query}\`${result.title && result.title !== result.id ? ` \u2014 ${result.title}` : ""}`,
|
|
17643
|
+
"",
|
|
17644
|
+
`- **Tipo:** \`${result.type || "N/A"}\` | **Capa:** \`${result.layer || "N/A"}\` | **Estado:** \`${result.status || "COMPLIANT"}\``,
|
|
17645
|
+
result.filePath ? `- **Ubicaci\xF3n:** \`${result.filePath}\`` : "",
|
|
17646
|
+
"",
|
|
17647
|
+
"#### \u{1F4DD} Resumen T\xE9cnico:",
|
|
17648
|
+
result.summary,
|
|
17649
|
+
"",
|
|
17650
|
+
...formatRelationsBlock("#### \u{1F517} Relaciones Upstream (Deriva de / Mitiga / Alineado con):", result.upstream, "\u2197\uFE0F"),
|
|
17651
|
+
...formatRelationsBlock("#### \u{1F517} Relaciones Downstream (Satisfecho por / Verificado por / Implementado en):", result.downstream, "\u2198\uFE0F"),
|
|
17652
|
+
...formatRelatedNavBlock(result.relatedItems)
|
|
17653
|
+
].filter((l) => l !== "");
|
|
17654
|
+
return lines.join("\n");
|
|
17655
|
+
}
|
|
17045
17656
|
|
|
17046
17657
|
exports.ALL_ARCHITECTURE_TEMPLATES = ALL_ARCHITECTURE_TEMPLATES;
|
|
17047
17658
|
exports.BRANCH_PATTERNS = BRANCH_PATTERNS;
|
|
@@ -17059,6 +17670,7 @@ exports.LIFECYCLE_SKILL_TEMPLATES = LIFECYCLE_SKILL_TEMPLATES;
|
|
|
17059
17670
|
exports.OpenSpecAdapter = OpenSpecAdapter;
|
|
17060
17671
|
exports.PII_SAST_RULES = PII_SAST_RULES;
|
|
17061
17672
|
exports.PREPARE_COMMIT_MSG_SCRIPT = PREPARE_COMMIT_MSG_SCRIPT;
|
|
17673
|
+
exports.PRE_COMMIT_SCRIPT = PRE_COMMIT_SCRIPT;
|
|
17062
17674
|
exports.PROMPT_INJECTION_SIGNATURES = PROMPT_INJECTION_SIGNATURES;
|
|
17063
17675
|
exports.PROTECTED_BYPASS_PATTERNS = PROTECTED_BYPASS_PATTERNS;
|
|
17064
17676
|
exports.SARIF_SCHEMA_2_1_0 = SARIF_SCHEMA_2_1_0;
|
|
@@ -17245,6 +17857,7 @@ exports.extractSemanticContent = extractSemanticContent;
|
|
|
17245
17857
|
exports.findChangeWorkspaceDir = findChangeWorkspaceDir;
|
|
17246
17858
|
exports.findLicenseFile = findLicenseFile;
|
|
17247
17859
|
exports.formatCommitTrailers = formatCommitTrailers;
|
|
17860
|
+
exports.formatInspectResultMarkdown = formatInspectResultMarkdown;
|
|
17248
17861
|
exports.formatPrKpiMarkdown = formatPrKpiMarkdown;
|
|
17249
17862
|
exports.formatReleaseKpiMarkdown = formatReleaseKpiMarkdown;
|
|
17250
17863
|
exports.generateBranchHierarchyPlan = generateBranchHierarchyPlan;
|
|
@@ -17274,6 +17887,7 @@ exports.inferArtifactTypeFromId = inferArtifactTypeFromId;
|
|
|
17274
17887
|
exports.inferMissingTrailers = inferMissingTrailers;
|
|
17275
17888
|
exports.initProject = initProject;
|
|
17276
17889
|
exports.injectKpisIntoPrBody = injectKpisIntoPrBody;
|
|
17890
|
+
exports.inspectElement = inspectElement;
|
|
17277
17891
|
exports.installGitHooks = installGitHooks;
|
|
17278
17892
|
exports.integrateSddChange = integrateSddChange;
|
|
17279
17893
|
exports.isCliInstalled = isCliInstalled;
|