@specatlas/core 0.1.13 → 0.1.15
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.d.ts +2 -1
- package/dist/index.js +74 -0
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -810,6 +810,7 @@ declare function lintRequirement(req: Requirement, path: string, opts?: LintOpti
|
|
|
810
810
|
declare function lintDelta(delta: Delta, livingRequirements: Map<string, Requirement>, path: string, opts?: LintOptions): Diagnostic[];
|
|
811
811
|
declare function lintTasks(_tasks: TasksFile): Diagnostic[];
|
|
812
812
|
declare function lintVerify(_verify: VerifyFile): Diagnostic[];
|
|
813
|
+
declare function lintPlan(planText: string, path: string): Diagnostic[];
|
|
813
814
|
declare function lintSpec(spec: SpecFile, opts?: LintOptions): Diagnostic[];
|
|
814
815
|
|
|
815
816
|
interface TraceNode {
|
|
@@ -1709,4 +1710,4 @@ declare function livingRequirementsMap(specs: Array<{
|
|
|
1709
1710
|
}>): Map<string, Requirement>;
|
|
1710
1711
|
declare function runCiGate(opts: CiOptions): Promise<CiResult>;
|
|
1711
1712
|
|
|
1712
|
-
export { type AdoptDomain, type AdoptOptions, type AdoptResult, type AgingBucket, type AnalyzeOptions, type AnalyzePackSummary, type AnalyzeResult, type Approval, type ApprovalStatus, type ApprovalsFile, type ApprovalsIndex, type ApproveFromGithubOptions, type ApproveFromGithubResult, type ArchiveOptions, type ArchiveResult, type AtlasConfig, type AttentionItem, BLOCK_HEAD_RE, BUILTIN_PACKS, type BlockWavePlan, CONFIG_FILE, CORE_VERSION, type CaptureResult, type Change, type ChangeMeta, type ChangeMetrics, type ChangeState, type CiCheck, type CiExtraCheck, type CiOptions, type CiResult, type Delta, type DeltaOp, type DeriveInput, type DerivedState, type DetectionResult, type Diagnostic, type DoctorReport, type Domain, type Evidence, type EvidenceMethod, type EvidenceResult, type ExecOptions, type ExecResult, type FoldOutcome, type FrontmatterResult, type GhRunner, type GitHubRepo, type InitOptions, type InitResult, type IssueBodyInput, type Lane, type Language, type LinkedIssue, type LintOptions, type LoadedConfig, type MockupCheckResult, type MockupManifest, type MockupPlan, type MockupPlanScreen, type MockupScreen, type MoveOps, type NewChangeOptions, type NewChangeResult, type NextAction, type Override, type Pack, type PackCheck, type PackCheckResult, type PackCheckType, type PackEvaluation, type PresentOptions, type PresentResult, type ProfileMatch, REQ_HEAD_RE, REQ_ID_RE, RULE_ID_RE, RULE_RE, RUN_EVENT_TYPES, type RecordEvidenceOptions, type RecordEvidenceResult, type Rename, type Requirement, type RiskLevel, type Rule, type RunEvent, type RunEventType, type RunRecord, type RunState, type RunStatus, SCENARIO_HEAD_RE, SCENARIO_ID_RE, SDD_DIR, SLUG_RE, type Scenario, type Severity, type SignApprovalOptions, type SignApprovalResult, type SpecFile, type SpecRef, type StackProfile, type SyncGithubOptions, type SyncGithubResult, TASK_ID_RE, TASK_LINE_RE, type Task, type TaskBlock, type TasksFile, type TemplateSet, type TraceEdge, type TraceFinding, type TraceGraph, type TraceInput, type TraceNode, type TraceResult, type VerifyFile, type WalkEntry, type WavePlan, type Workspace, type WorkspaceMetrics, adoptWorkspace, appendRunEvent, approvalsSchema, approveFromGithub, archiveChange, artifactHash, atlasConfigSchema, buildTraceGraph, canonicalizeMarkdown, captureMockups, changeMarker, changeMetaSchema, changeMetaYaml, checkMockups, checkTrace, collectMetrics, commentIssue, compareTaskIds, computeInputsHash, configToYaml, copyFile, countBySeverity, createChange, createIssue, createRun, defaultConfig, deriveState, detectProfiles, detectRepo, detectionToYaml, diag, editIssue, emitFrontmatter, ensureDir, ensureSddDirs, esc, evaluatePacks, evidenceSummary, exists, findLinkedIssue, findWorkspaceRoot, firstToken, foldDelta, generatePresentation, generateRunId, getNumber, getString, ghAuthStatus, ghAvailable, hasErrors, hasShellMetacharacters, indexMarkdown, initWorkspace, inline, isCommandAllowed, isDirectory, issueBody, issueLabels, laneOrDefault, lintDelta, lintMockupHtml, lintMockupManifest, lintRequirement, lintSpec, lintTasks, lintVerify, listChangeSlugs, listDir, listDirs, listRuns, livingRequirementsMap, loadActiveProfile, loadApprovals, loadChange, loadConfig, loadDetectedBest, loadProfileFile, loadProfilesFromDir, loadProjectPacks, loadSpecs, loadWorkspace, localCompact, localDate, localMonth, localOffset, localStamp, matchGlob, mockupManifestSchema, mockupsDir, mockupsReady, moveDirectory, packFindings, parseApprovals, parseChangeMeta, parseConfig, parseDelta, parseFrontmatter, parseGitHubRemote, parseIssueUrl, parseRequirementBlocks, parseSpecFile, parseTasksFile, parseVerifyFile, patchChangeMeta, planBlock, planMockups, planWaves, profileSchema, readMockupManifest, readRun, readText, readTextIfExists, recordEvidence, regenerateIndex, renderMarkdown, renderRequirement, renderTemplate, requiresMockups, resolvePacks, runAnalyze, runCiGate, runDoctor, runProcess, setMockupRequirement, sha256, shortHash, signApproval, specHashOf, splitCommand, stateLabel, syncGithubIssue, templatesFor, toPosix, tokensFile, updateMockupScreenshots, updateRunStatus, verifyApproval, walkFiles, writeConfig, writeMockupManifest, writeMockupPlan, writeText };
|
|
1713
|
+
export { type AdoptDomain, type AdoptOptions, type AdoptResult, type AgingBucket, type AnalyzeOptions, type AnalyzePackSummary, type AnalyzeResult, type Approval, type ApprovalStatus, type ApprovalsFile, type ApprovalsIndex, type ApproveFromGithubOptions, type ApproveFromGithubResult, type ArchiveOptions, type ArchiveResult, type AtlasConfig, type AttentionItem, BLOCK_HEAD_RE, BUILTIN_PACKS, type BlockWavePlan, CONFIG_FILE, CORE_VERSION, type CaptureResult, type Change, type ChangeMeta, type ChangeMetrics, type ChangeState, type CiCheck, type CiExtraCheck, type CiOptions, type CiResult, type Delta, type DeltaOp, type DeriveInput, type DerivedState, type DetectionResult, type Diagnostic, type DoctorReport, type Domain, type Evidence, type EvidenceMethod, type EvidenceResult, type ExecOptions, type ExecResult, type FoldOutcome, type FrontmatterResult, type GhRunner, type GitHubRepo, type InitOptions, type InitResult, type IssueBodyInput, type Lane, type Language, type LinkedIssue, type LintOptions, type LoadedConfig, type MockupCheckResult, type MockupManifest, type MockupPlan, type MockupPlanScreen, type MockupScreen, type MoveOps, type NewChangeOptions, type NewChangeResult, type NextAction, type Override, type Pack, type PackCheck, type PackCheckResult, type PackCheckType, type PackEvaluation, type PresentOptions, type PresentResult, type ProfileMatch, REQ_HEAD_RE, REQ_ID_RE, RULE_ID_RE, RULE_RE, RUN_EVENT_TYPES, type RecordEvidenceOptions, type RecordEvidenceResult, type Rename, type Requirement, type RiskLevel, type Rule, type RunEvent, type RunEventType, type RunRecord, type RunState, type RunStatus, SCENARIO_HEAD_RE, SCENARIO_ID_RE, SDD_DIR, SLUG_RE, type Scenario, type Severity, type SignApprovalOptions, type SignApprovalResult, type SpecFile, type SpecRef, type StackProfile, type SyncGithubOptions, type SyncGithubResult, TASK_ID_RE, TASK_LINE_RE, type Task, type TaskBlock, type TasksFile, type TemplateSet, type TraceEdge, type TraceFinding, type TraceGraph, type TraceInput, type TraceNode, type TraceResult, type VerifyFile, type WalkEntry, type WavePlan, type Workspace, type WorkspaceMetrics, adoptWorkspace, appendRunEvent, approvalsSchema, approveFromGithub, archiveChange, artifactHash, atlasConfigSchema, buildTraceGraph, canonicalizeMarkdown, captureMockups, changeMarker, changeMetaSchema, changeMetaYaml, checkMockups, checkTrace, collectMetrics, commentIssue, compareTaskIds, computeInputsHash, configToYaml, copyFile, countBySeverity, createChange, createIssue, createRun, defaultConfig, deriveState, detectProfiles, detectRepo, detectionToYaml, diag, editIssue, emitFrontmatter, ensureDir, ensureSddDirs, esc, evaluatePacks, evidenceSummary, exists, findLinkedIssue, findWorkspaceRoot, firstToken, foldDelta, generatePresentation, generateRunId, getNumber, getString, ghAuthStatus, ghAvailable, hasErrors, hasShellMetacharacters, indexMarkdown, initWorkspace, inline, isCommandAllowed, isDirectory, issueBody, issueLabels, laneOrDefault, lintDelta, lintMockupHtml, lintMockupManifest, lintPlan, lintRequirement, lintSpec, lintTasks, lintVerify, listChangeSlugs, listDir, listDirs, listRuns, livingRequirementsMap, loadActiveProfile, loadApprovals, loadChange, loadConfig, loadDetectedBest, loadProfileFile, loadProfilesFromDir, loadProjectPacks, loadSpecs, loadWorkspace, localCompact, localDate, localMonth, localOffset, localStamp, matchGlob, mockupManifestSchema, mockupsDir, mockupsReady, moveDirectory, packFindings, parseApprovals, parseChangeMeta, parseConfig, parseDelta, parseFrontmatter, parseGitHubRemote, parseIssueUrl, parseRequirementBlocks, parseSpecFile, parseTasksFile, parseVerifyFile, patchChangeMeta, planBlock, planMockups, planWaves, profileSchema, readMockupManifest, readRun, readText, readTextIfExists, recordEvidence, regenerateIndex, renderMarkdown, renderRequirement, renderTemplate, requiresMockups, resolvePacks, runAnalyze, runCiGate, runDoctor, runProcess, setMockupRequirement, sha256, shortHash, signApproval, specHashOf, splitCommand, stateLabel, syncGithubIssue, templatesFor, toPosix, tokensFile, updateMockupScreenshots, updateRunStatus, verifyApproval, walkFiles, writeConfig, writeMockupManifest, writeMockupPlan, writeText };
|
package/dist/index.js
CHANGED
|
@@ -732,6 +732,71 @@ function lintTasks(_tasks) {
|
|
|
732
732
|
function lintVerify(_verify) {
|
|
733
733
|
return [];
|
|
734
734
|
}
|
|
735
|
+
var MERMAID_KEYWORDS = [
|
|
736
|
+
"flowchart",
|
|
737
|
+
"graph",
|
|
738
|
+
"sequenceDiagram",
|
|
739
|
+
"stateDiagram-v2",
|
|
740
|
+
"stateDiagram",
|
|
741
|
+
"classDiagram",
|
|
742
|
+
"erDiagram",
|
|
743
|
+
"journey",
|
|
744
|
+
"gantt",
|
|
745
|
+
"pie",
|
|
746
|
+
"mindmap",
|
|
747
|
+
"timeline",
|
|
748
|
+
"quadrantChart",
|
|
749
|
+
"xychart-beta",
|
|
750
|
+
"block-beta",
|
|
751
|
+
"architecture-beta"
|
|
752
|
+
];
|
|
753
|
+
var MERMAID_BLOCKS = /^\s*(alt|loop|opt|par|rect|critical|break|subgraph)\b/;
|
|
754
|
+
function lintPlan(planText, path19) {
|
|
755
|
+
const out = [];
|
|
756
|
+
const blocks = [...planText.matchAll(/```mermaid\r?\n([\s\S]*?)```/g)];
|
|
757
|
+
for (const [index, block] of blocks.entries()) {
|
|
758
|
+
const code = (block[1] ?? "").replace(/\r\n?/g, "\n");
|
|
759
|
+
const lines = code.split("\n");
|
|
760
|
+
const first = (lines.find((line) => line.trim().length > 0) ?? "").trim();
|
|
761
|
+
if (!MERMAID_KEYWORDS.some((keyword) => first.startsWith(keyword))) {
|
|
762
|
+
out.push(
|
|
763
|
+
diag("LINT-PLN-002", "error", `Diagrama mermaid ${index + 1}: la primera l\xEDnea debe declarar el tipo (${MERMAID_KEYWORDS.slice(0, 5).join(", ")}\u2026) y empieza por "${first.slice(0, 30)}"`, {
|
|
764
|
+
path: path19,
|
|
765
|
+
suggestion: "Corrige el tipo del diagrama o elimina el bloque"
|
|
766
|
+
})
|
|
767
|
+
);
|
|
768
|
+
continue;
|
|
769
|
+
}
|
|
770
|
+
let open = 0;
|
|
771
|
+
for (const line of lines) {
|
|
772
|
+
if (MERMAID_BLOCKS.test(line)) open += 1;
|
|
773
|
+
else if (/^\s*end\b/.test(line)) open -= 1;
|
|
774
|
+
}
|
|
775
|
+
if (open !== 0) {
|
|
776
|
+
out.push(
|
|
777
|
+
diag("LINT-PLN-002", "error", `Diagrama mermaid ${index + 1}: faltan ${Math.abs(open)} \`end\` (bloques alt/loop/subgraph sin cerrar)`, {
|
|
778
|
+
path: path19,
|
|
779
|
+
suggestion: "Cierra cada bloque alt/loop/opt/par/rect/subgraph con `end`"
|
|
780
|
+
})
|
|
781
|
+
);
|
|
782
|
+
}
|
|
783
|
+
if (first.startsWith("sequenceDiagram")) {
|
|
784
|
+
for (const line of lines) {
|
|
785
|
+
if (!/^\s*[^\s:]+-{1,2}>{1,2}[^\s:]*\s*:\s*/.test(line)) continue;
|
|
786
|
+
const message = line.slice(line.indexOf(":") + 1);
|
|
787
|
+
if (message.includes(";")) {
|
|
788
|
+
out.push(
|
|
789
|
+
diag("LINT-PLN-003", "error", `Diagrama mermaid ${index + 1}: el mensaje "${message.trim().slice(0, 40)}\u2026" usa \`;\` y mermaid lo interpreta como fin de sentencia`, {
|
|
790
|
+
path: path19,
|
|
791
|
+
suggestion: "Sustituye `;` por `\xB7` o `,` en los mensajes de sequenceDiagram"
|
|
792
|
+
})
|
|
793
|
+
);
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
return out;
|
|
799
|
+
}
|
|
735
800
|
function lintSpec(spec, opts = {}) {
|
|
736
801
|
const out = [...spec.diagnostics];
|
|
737
802
|
for (const req of spec.requirements) {
|
|
@@ -2903,6 +2968,10 @@ async function runAnalyze(opts) {
|
|
|
2903
2968
|
if (lane !== "fix" && !change.planPath) {
|
|
2904
2969
|
findings.push(diag("ATLAS-ANALYZE-001", "warning", "El cambio no tiene plan.md (plan t\xE9cnico)", { suggestion: "Ejecuta la fase /satlas-plan" }));
|
|
2905
2970
|
}
|
|
2971
|
+
if (change.planPath) {
|
|
2972
|
+
const planText = await readTextIfExists(change.planPath) ?? "";
|
|
2973
|
+
findings.push(...lintPlan(planText, change.planPath));
|
|
2974
|
+
}
|
|
2906
2975
|
const deltaScenarios = [...change.delta?.added ?? [], ...change.delta?.modified ?? []].flatMap((r) => r.scenarios);
|
|
2907
2976
|
const passed = new Set((change.verify?.evidence ?? []).filter((e) => e.result === "pass").map((e) => e.scenario));
|
|
2908
2977
|
const evidence = { done: deltaScenarios.filter((s) => passed.has(s.id)).length, total: deltaScenarios.length };
|
|
@@ -4016,6 +4085,10 @@ async function runCiGate(opts) {
|
|
|
4016
4085
|
requireEvidence: config.gates.verify.mode !== "off" && config.gates.verify.require_evidence
|
|
4017
4086
|
});
|
|
4018
4087
|
const changeDiags = [...lintFindings, ...trace.findings];
|
|
4088
|
+
if (change.planPath) {
|
|
4089
|
+
const planText = await readTextIfExists(change.planPath) ?? "";
|
|
4090
|
+
changeDiags.push(...lintPlan(planText, change.planPath));
|
|
4091
|
+
}
|
|
4019
4092
|
if (change.tasks && change.tasks.counts.total > 0) {
|
|
4020
4093
|
const plan = planWaves(change.tasks, { maxParallel: config.waves.max_parallel });
|
|
4021
4094
|
changeDiags.push(...plan.blocks.flatMap((block) => block.diagnostics));
|
|
@@ -4127,6 +4200,7 @@ export {
|
|
|
4127
4200
|
lintDelta,
|
|
4128
4201
|
lintMockupHtml,
|
|
4129
4202
|
lintMockupManifest,
|
|
4203
|
+
lintPlan,
|
|
4130
4204
|
lintRequirement,
|
|
4131
4205
|
lintSpec,
|
|
4132
4206
|
lintTasks,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@specatlas/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
4
|
"description": "Kernel determinista de SpecAtlas: parsing, validación, trazabilidad, olas y ciclo de vida",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@specatlas/render": "0.1.
|
|
37
|
+
"@specatlas/render": "0.1.4",
|
|
38
38
|
"yaml": "^2.6.1",
|
|
39
39
|
"zod": "^3.24.1"
|
|
40
40
|
},
|