Add SpeckDL compiler scaffold

- CLI entry point with yargs parsing for speckl-compile <file> --output-dir --bom-format
- TypeScript parser with AST types for all SpeckDL primitives
- Generator for PROV-O JSON-LD provenance graphs
- Generator for CycloneDX v1.6 BOMs
- Generator for SPDX 3.0.1 BOMs
- E2E test verifying RetryHandler.speck parsing and all output formats

All tests pass.
This commit is contained in:
Scott Scoble 2026-04-29 15:12:08 -07:00
parent 448819104a
commit f19a43fd5f
1295 changed files with 1037389 additions and 0 deletions

121
compiler/dist/parser.d.ts vendored Normal file
View file

@ -0,0 +1,121 @@
export interface SpeckNode {
type: 'speck';
name: string;
members: MemberNode[];
}
export interface ImportNode {
type: 'import';
path: string;
alias?: string;
version?: string;
hash?: string;
}
export interface InputNode {
type: 'input';
typeExpr: TypeExpr;
}
export interface OutputNode {
type: 'output';
typeExpr: TypeExpr;
}
export interface ConstraintNode {
type: 'constraint';
expr: string;
}
export interface VerifyNode {
type: 'verify';
temporalExpr: string;
}
export interface InterfaceNode {
type: 'interface';
name: string;
methods: MethodSignature[];
}
export interface MethodSignature {
name: string;
params: {
name: string;
type: TypeExpr;
}[];
returnType: TypeExpr;
}
export interface EventNode {
type: 'event';
name: string;
fields: {
name: string;
type: TypeExpr;
}[];
}
export interface ProvenanceNode {
type: 'provenance';
clauses: ProvenanceClause[];
}
export interface ProvenanceClause {
type: 'regulation' | 'design_decision' | 'parent_spec' | 'external_doc';
value: string;
location?: string;
}
export interface ReviewNode {
type: 'review';
kind: 'manual' | 'auto' | 'hybrid';
}
export interface DerivesNode {
type: 'derives';
from: string;
via?: string;
}
export interface SatisfiesNode {
type: 'satisfies';
requirement: string;
clause?: string;
}
export interface AuthorNode {
type: 'author';
name: string;
email?: string;
}
export interface SourceNode {
type: 'source';
kind: 'conversation' | 'meeting' | 'document' | 'regulation' | 'architecture_review' | 'threat_model' | 'compliance_audit';
ref?: string;
}
export interface BOMNode {
type: 'bom';
compiler?: {
name: string;
version?: string;
};
solver?: {
name: string;
version?: string;
};
runtime?: {
name: string;
version?: string;
};
license?: string;
hash?: string;
}
export type MemberNode = ImportNode | InputNode | OutputNode | ConstraintNode | VerifyNode | InterfaceNode | EventNode | ProvenanceNode | ReviewNode | DerivesNode | SatisfiesNode | AuthorNode | SourceNode | BOMNode;
export interface TypeExpr {
type: 'primitive' | 'record' | 'list' | 'ident';
name?: string;
fields?: {
name: string;
type: TypeExpr;
}[];
elementType?: TypeExpr;
}
export interface AST {
specks: SpeckNode[];
}
/**
* Parse a .speck file and return the AST
*/
export declare function parseSpeckFile(filePath: string): AST;
/**
* Parse SpeckDL content and return the AST
*/
export declare function parseSpeckContent(content: string, filePath?: string): AST;
//# sourceMappingURL=parser.d.ts.map