@aisdlc/core 4.5.1 → 4.5.2
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 +127 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +35 -2
- package/dist/index.d.ts +35 -2
- package/dist/index.js +122 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -18785,6 +18785,53 @@ function serializeSarifDocument(doc, pretty = true) {
|
|
|
18785
18785
|
function writeSecuritySarifReport(outputPath, doc, pretty = true) {
|
|
18786
18786
|
writeReportFileIfChanged(outputPath, serializeSarifDocument(doc, pretty));
|
|
18787
18787
|
}
|
|
18788
|
+
var AISDLC_MANIFEST_FILENAME = ".aisdlc.json";
|
|
18789
|
+
function getAisdlcVersion() {
|
|
18790
|
+
try {
|
|
18791
|
+
const req = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
|
|
18792
|
+
const pkg = req("../package.json");
|
|
18793
|
+
if (pkg?.version) return pkg.version;
|
|
18794
|
+
} catch {
|
|
18795
|
+
}
|
|
18796
|
+
return "0.0.0";
|
|
18797
|
+
}
|
|
18798
|
+
function readAisdlcManifest(rootDir) {
|
|
18799
|
+
const manifestPath = path14__namespace.join(rootDir, AISDLC_MANIFEST_FILENAME);
|
|
18800
|
+
if (!fs12__namespace.existsSync(manifestPath)) return null;
|
|
18801
|
+
try {
|
|
18802
|
+
const raw = JSON.parse(fs12__namespace.readFileSync(manifestPath, "utf-8"));
|
|
18803
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return null;
|
|
18804
|
+
const record = raw;
|
|
18805
|
+
if (typeof record.version !== "string" || !record.version.trim()) return null;
|
|
18806
|
+
return { ...record, version: record.version.trim() };
|
|
18807
|
+
} catch {
|
|
18808
|
+
return null;
|
|
18809
|
+
}
|
|
18810
|
+
}
|
|
18811
|
+
function writeAisdlcManifest(rootDir, version = getAisdlcVersion()) {
|
|
18812
|
+
const manifestPath = path14__namespace.join(rootDir, AISDLC_MANIFEST_FILENAME);
|
|
18813
|
+
let data = {};
|
|
18814
|
+
if (fs12__namespace.existsSync(manifestPath)) {
|
|
18815
|
+
try {
|
|
18816
|
+
const existing = JSON.parse(fs12__namespace.readFileSync(manifestPath, "utf-8"));
|
|
18817
|
+
if (existing && typeof existing === "object" && !Array.isArray(existing)) {
|
|
18818
|
+
data = existing;
|
|
18819
|
+
}
|
|
18820
|
+
} catch {
|
|
18821
|
+
}
|
|
18822
|
+
}
|
|
18823
|
+
data.version = version;
|
|
18824
|
+
fs12__namespace.writeFileSync(manifestPath, JSON.stringify(data, null, 2) + "\n", "utf-8");
|
|
18825
|
+
}
|
|
18826
|
+
function formatAisdlcVersionOutput(rootDir = process.cwd()) {
|
|
18827
|
+
const installed = getAisdlcVersion();
|
|
18828
|
+
const manifest = readAisdlcManifest(rootDir);
|
|
18829
|
+
if (!manifest) return installed;
|
|
18830
|
+
if (manifest.version === installed) {
|
|
18831
|
+
return `${installed} (repo: ${manifest.version})`;
|
|
18832
|
+
}
|
|
18833
|
+
return `${installed} (repo: ${manifest.version} \u2014 differs from installed CLI)`;
|
|
18834
|
+
}
|
|
18788
18835
|
|
|
18789
18836
|
// src/init/agent-templates.ts
|
|
18790
18837
|
var SPECIALIZED_AGENT_TEMPLATES = [
|
|
@@ -22435,6 +22482,7 @@ function collectArchitectureTemplateFiles(archGranularity) {
|
|
|
22435
22482
|
}
|
|
22436
22483
|
function collectStarterFiles(ciProvider, agentFiles = [], archGranularity = "minimal", stacks = []) {
|
|
22437
22484
|
const files = [
|
|
22485
|
+
{ relPath: AISDLC_MANIFEST_FILENAME, content: JSON.stringify({ version: getAisdlcVersion() }, null, 2) + "\n" },
|
|
22438
22486
|
...collectPolicyAndSchemaFiles(),
|
|
22439
22487
|
...getCodingRulesFilesForStacks(stacks),
|
|
22440
22488
|
...getCiWorkflowFiles(ciProvider),
|
|
@@ -23930,6 +23978,62 @@ var SecurityToolsHealthCheck = class {
|
|
|
23930
23978
|
}
|
|
23931
23979
|
}
|
|
23932
23980
|
};
|
|
23981
|
+
var CATEGORY_TITLE = "AI-SDLC Repository Version (.aisdlc.json)";
|
|
23982
|
+
function makeFinding(id, status, message, details, remediation) {
|
|
23983
|
+
return { id, category: "aisdlc_version", status, message, remediation, details };
|
|
23984
|
+
}
|
|
23985
|
+
function compareManifestVersion(repoVersion, installedVersion) {
|
|
23986
|
+
if (repoVersion === installedVersion) {
|
|
23987
|
+
return makeFinding(
|
|
23988
|
+
"PASS_AISDLC_VERSION_MATCH",
|
|
23989
|
+
"pass",
|
|
23990
|
+
`Repository AI-SDLC version (${repoVersion}) matches installed CLI (${installedVersion}).`,
|
|
23991
|
+
{ repoVersion, installedVersion }
|
|
23992
|
+
);
|
|
23993
|
+
}
|
|
23994
|
+
return makeFinding(
|
|
23995
|
+
"WARN_AISDLC_VERSION_MISMATCH",
|
|
23996
|
+
"warn",
|
|
23997
|
+
`Repository AI-SDLC version (${repoVersion}) differs from installed CLI (${installedVersion}).`,
|
|
23998
|
+
{ repoVersion, installedVersion },
|
|
23999
|
+
`Run 'aisdlc migrate' to align repository templates/policies with v${installedVersion}, or run with @aisdlc/cli@${repoVersion}.`
|
|
24000
|
+
);
|
|
24001
|
+
}
|
|
24002
|
+
function evaluateVersionFinding(rootDir, installedVersion) {
|
|
24003
|
+
const manifestPath = path14__namespace.join(rootDir, AISDLC_MANIFEST_FILENAME);
|
|
24004
|
+
if (!fs12__namespace.existsSync(manifestPath)) {
|
|
24005
|
+
return makeFinding(
|
|
24006
|
+
"WARN_AISDLC_MANIFEST_MISSING",
|
|
24007
|
+
"warn",
|
|
24008
|
+
`Repository manifest '${AISDLC_MANIFEST_FILENAME}' not found (installed CLI: v${installedVersion}).`,
|
|
24009
|
+
{ installedVersion },
|
|
24010
|
+
`Run 'aisdlc migrate' or 'aisdlc init' to record the repository's AI-SDLC version in '${AISDLC_MANIFEST_FILENAME}'.`
|
|
24011
|
+
);
|
|
24012
|
+
}
|
|
24013
|
+
const manifest = readAisdlcManifest(rootDir);
|
|
24014
|
+
if (!manifest) {
|
|
24015
|
+
return makeFinding(
|
|
24016
|
+
"WARN_AISDLC_MANIFEST_INVALID",
|
|
24017
|
+
"warn",
|
|
24018
|
+
`Repository manifest '${AISDLC_MANIFEST_FILENAME}' is missing a valid 'version' field (installed CLI: v${installedVersion}).`,
|
|
24019
|
+
{ installedVersion },
|
|
24020
|
+
`Run 'aisdlc migrate' to repair '${AISDLC_MANIFEST_FILENAME}'.`
|
|
24021
|
+
);
|
|
24022
|
+
}
|
|
24023
|
+
return compareManifestVersion(manifest.version, installedVersion);
|
|
24024
|
+
}
|
|
24025
|
+
var AisdlcVersionCheck = class {
|
|
24026
|
+
async inspect(options) {
|
|
24027
|
+
const rootDir = options.rootDir || process.cwd();
|
|
24028
|
+
const finding = evaluateVersionFinding(rootDir, getAisdlcVersion());
|
|
24029
|
+
return {
|
|
24030
|
+
category: "aisdlc_version",
|
|
24031
|
+
title: CATEGORY_TITLE,
|
|
24032
|
+
status: finding.status,
|
|
24033
|
+
findings: [finding]
|
|
24034
|
+
};
|
|
24035
|
+
}
|
|
24036
|
+
};
|
|
23933
24037
|
|
|
23934
24038
|
// src/doctor/reporter.ts
|
|
23935
24039
|
function formatFinding(f) {
|
|
@@ -23987,6 +24091,7 @@ var DoctorOrchestrator = class {
|
|
|
23987
24091
|
toolchainCheck = new ToolchainHealthCheck();
|
|
23988
24092
|
signatureCheck = new SignatureReadinessCheck();
|
|
23989
24093
|
securityToolsCheck = new SecurityToolsHealthCheck();
|
|
24094
|
+
versionCheck = new AisdlcVersionCheck();
|
|
23990
24095
|
async runAll(options) {
|
|
23991
24096
|
const categories = [];
|
|
23992
24097
|
categories.push(await this.hooksCheck.inspect(options));
|
|
@@ -23995,6 +24100,7 @@ var DoctorOrchestrator = class {
|
|
|
23995
24100
|
categories.push(await this.toolchainCheck.inspect(options));
|
|
23996
24101
|
categories.push(await this.signatureCheck.inspect(options));
|
|
23997
24102
|
categories.push(await this.securityToolsCheck.inspect(options));
|
|
24103
|
+
categories.push(await this.versionCheck.inspect(options));
|
|
23998
24104
|
return categories;
|
|
23999
24105
|
}
|
|
24000
24106
|
};
|
|
@@ -24711,15 +24817,27 @@ var MigrationService = class {
|
|
|
24711
24817
|
const targets = this.discoverGovernedFiles(root);
|
|
24712
24818
|
const evaluation = evaluateGovernedTargets(targets, this.orchestrator, options.force);
|
|
24713
24819
|
if (isDryRun || evaluation.filesToModify.length === 0) {
|
|
24714
|
-
|
|
24715
|
-
return { success: exitCode2 === 0, exitCode: exitCode2, summary: evaluation.summary, details: evaluation.details };
|
|
24820
|
+
return this.buildCompletedResult(root, evaluation, isDryRun);
|
|
24716
24821
|
}
|
|
24717
24822
|
const tx = await this.runMutationTransaction(root, evaluation, options.backup ?? true);
|
|
24718
24823
|
if (!tx.success) {
|
|
24719
24824
|
return createTransactionFailureResult(evaluation.summary, tx.backupPath, tx.error);
|
|
24720
24825
|
}
|
|
24826
|
+
return this.buildCompletedResult(root, evaluation, isDryRun, tx.backupPath);
|
|
24827
|
+
}
|
|
24828
|
+
buildCompletedResult(root, evaluation, isDryRun, backupPath) {
|
|
24721
24829
|
const exitCode = resolveExitCode2(evaluation.summary);
|
|
24722
|
-
|
|
24830
|
+
if (!isDryRun && exitCode !== 2) {
|
|
24831
|
+
this.syncManifestVersion(root);
|
|
24832
|
+
}
|
|
24833
|
+
return { success: exitCode === 0, exitCode, summary: evaluation.summary, backupPath, details: evaluation.details };
|
|
24834
|
+
}
|
|
24835
|
+
syncManifestVersion(root) {
|
|
24836
|
+
const installedVersion = getAisdlcVersion();
|
|
24837
|
+
const existing = readAisdlcManifest(root);
|
|
24838
|
+
if (!existing || existing.version !== installedVersion) {
|
|
24839
|
+
writeAisdlcManifest(root, installedVersion);
|
|
24840
|
+
}
|
|
24723
24841
|
}
|
|
24724
24842
|
discoverGovernedFiles(root) {
|
|
24725
24843
|
const items = [];
|
|
@@ -24739,8 +24857,10 @@ var MigrationService = class {
|
|
|
24739
24857
|
}
|
|
24740
24858
|
};
|
|
24741
24859
|
|
|
24860
|
+
exports.AISDLC_MANIFEST_FILENAME = AISDLC_MANIFEST_FILENAME;
|
|
24742
24861
|
exports.ALL_ARCHITECTURE_TEMPLATES = ALL_ARCHITECTURE_TEMPLATES;
|
|
24743
24862
|
exports.ALL_QUALITY_GATES = ALL_QUALITY_GATES;
|
|
24863
|
+
exports.AisdlcVersionCheck = AisdlcVersionCheck;
|
|
24744
24864
|
exports.BRANCH_PATTERNS = BRANCH_PATTERNS;
|
|
24745
24865
|
exports.BddStepRegistry = BddStepRegistry;
|
|
24746
24866
|
exports.BranchSafetyCheck = BranchSafetyCheck;
|
|
@@ -25021,6 +25141,7 @@ exports.extractSemanticContent = extractSemanticContent;
|
|
|
25021
25141
|
exports.findChangeWorkspaceDir = findChangeWorkspaceDir;
|
|
25022
25142
|
exports.findLicenseFile = findLicenseFile;
|
|
25023
25143
|
exports.formatAgentKpisMarkdownSection = formatAgentKpisMarkdownSection;
|
|
25144
|
+
exports.formatAisdlcVersionOutput = formatAisdlcVersionOutput;
|
|
25024
25145
|
exports.formatCommitTrailers = formatCommitTrailers;
|
|
25025
25146
|
exports.formatInspectResultMarkdown = formatInspectResultMarkdown;
|
|
25026
25147
|
exports.formatPrKpiMarkdown = formatPrKpiMarkdown;
|
|
@@ -25046,6 +25167,7 @@ exports.generateSuppressionsAuditReport = generateSuppressionsAuditReport;
|
|
|
25046
25167
|
exports.generateTestingCoverageReportMarkdown = generateTestingCoverageReportMarkdown;
|
|
25047
25168
|
exports.generateThirdPartyNotices = generateThirdPartyNotices;
|
|
25048
25169
|
exports.generateTraceabilityReportMarkdown = generateTraceabilityReportMarkdown;
|
|
25170
|
+
exports.getAisdlcVersion = getAisdlcVersion;
|
|
25049
25171
|
exports.getArchitectureTemplates = getArchitectureTemplates;
|
|
25050
25172
|
exports.getCodingRulesFilesForStacks = getCodingRulesFilesForStacks;
|
|
25051
25173
|
exports.getCytoscapeScript = getCytoscapeScript;
|
|
@@ -25128,6 +25250,7 @@ exports.parseTasksFromContent = parseTasksFromContent;
|
|
|
25128
25250
|
exports.parseTrivyOutput = parseTrivyOutput;
|
|
25129
25251
|
exports.parseTrivyVulnerabilities = parseTrivyVulnerabilities;
|
|
25130
25252
|
exports.processPackageDir = processPackageDir;
|
|
25253
|
+
exports.readAisdlcManifest = readAisdlcManifest;
|
|
25131
25254
|
exports.readCodeCoverageSummary = readCodeCoverageSummary;
|
|
25132
25255
|
exports.readFailOnMissingToolFromQualityPolicy = readFailOnMissingToolFromQualityPolicy;
|
|
25133
25256
|
exports.readNormalizedCoverage = readNormalizedCoverage;
|
|
@@ -25224,6 +25347,7 @@ exports.walkMdFiles = walkMdFiles;
|
|
|
25224
25347
|
exports.walkProjectFiles = walkProjectFiles;
|
|
25225
25348
|
exports.walkSourceFiles = walkSourceFiles;
|
|
25226
25349
|
exports.walkTaskFiles = walkTaskFiles;
|
|
25350
|
+
exports.writeAisdlcManifest = writeAisdlcManifest;
|
|
25227
25351
|
exports.writeCucumberJsonReport = writeCucumberJsonReport;
|
|
25228
25352
|
exports.writeCycloneDxSbom = writeCycloneDxSbom;
|
|
25229
25353
|
exports.writeQualityBaseline = writeQualityBaseline;
|