Documentation
¶
Index ¶
- func CountPreserveFuncs(dir string) int
- func Hash7(input string) string
- func HashClaims(claims map[string]manifest.ClaimDef) string
- func HashModelMethod(name string, params []string, returns []string) string
- func HashServiceFunc(sf ssacparser.ServiceFunc) string
- func HashStateDiagram(sd *statemachine.StateDiagram) string
- func IsDirective(comment string) bool
- func Summary(funcs []FuncStatus) (gen, preserve, broken, orphan int)
- type Directive
- type FuncStatus
- type PreserveSnapshot
- type PreservedFunc
- type SpliceResult
- type Warning
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CountPreserveFuncs ¶
CountPreserveFuncs counts all preserved functions and files in a directory.
func HashClaims ¶
HashClaims computes a contract hash for middleware claims (CurrentUser). Based on: sorted field:key:type triples.
func HashModelMethod ¶
HashModelMethod computes a contract hash for a model implementation method. Based on: method name + parameter types + return types.
func HashServiceFunc ¶
func HashServiceFunc(sf ssacparser.ServiceFunc) string
HashServiceFunc computes a contract hash for an SSaC service function. The hash is derived from: operationId + sequence types + request fields + response fields.
func HashStateDiagram ¶
func HashStateDiagram(sd *statemachine.StateDiagram) string
HashStateDiagram computes a contract hash for a state machine. Based on: sorted states + sorted transitions (from:event:to).
func IsDirective ¶
IsDirective checks if a comment line is a fullend directive.
func Summary ¶
func Summary(funcs []FuncStatus) (gen, preserve, broken, orphan int)
Summary returns counts by status.
Types ¶
type Directive ¶
type Directive struct {
Ownership string // "gen" or "preserve"
SSOT string // SSOT file relative path (e.g. "service/gig/create_gig.ssac")
Contract string // 7-char SHA256 hex prefix
}
Directive represents a //fullend: ownership directive attached to generated code.
func Parse ¶
Parse extracts a Directive from a Go comment string. Expected format: "//fullend:gen ssot=service/gig/create_gig.ssac contract=a3f8c1"
type FuncStatus ¶
type FuncStatus struct {
File string // relative path from artifacts dir
Function string
Directive Directive
Status string // "gen", "preserve", "broken", "orphan"
Detail string // violation detail
}
FuncStatus describes the contract status of a single function.
func ScanDir ¶
func ScanDir(artifactsDir string) ([]FuncStatus, error)
ScanDir scans artifacts directory for all Go files with //fullend: directives.
func Verify ¶
func Verify(specsDir string, funcs []FuncStatus) []FuncStatus
Verify checks each FuncStatus against the current SSOT files. Updates Status to "broken" (hash mismatch) or "orphan" (SSOT deleted).
type PreserveSnapshot ¶
type PreserveSnapshot struct {
FilePreserves map[string]string // path → saved whole file content
FuncPreserves map[string]map[string]*PreservedFunc // path → funcName → preserved body
}
PreserveSnapshot captures all preserved functions/files before code generation.
func ScanPreserveSnapshot ¶
func ScanPreserveSnapshot(dir string) *PreserveSnapshot
ScanPreserveSnapshot walks a directory and captures all preserved content.
type PreservedFunc ¶
type PreservedFunc struct {
Directive Directive
BodyText string // raw source between { and }, excluding the braces themselves
}
PreservedFunc holds a preserved function's directive and body text.
type SpliceResult ¶
SpliceResult holds the merged content and any warnings.
func SpliceWithPreserved ¶
func SpliceWithPreserved(newContent string, preserved map[string]*PreservedFunc, filePath string) (*SpliceResult, error)
SpliceWithPreserved merges preserved function bodies into new content.
type Warning ¶
Warning records a contract mismatch between preserved body and regenerated contract.
func RestorePreserved ¶
func RestorePreserved(snap *PreserveSnapshot) []Warning
RestorePreserved restores all preserved content after code generation.
Source Files
¶
- add_status_count.go
- build_directive_replacement.go
- collect_req_fields.go
- collect_req_fields_from_seq.go
- collect_resp_fields.go
- collect_seq_types.go
- count_preserve_funcs.go
- directive_string.go
- directive_stringjs.go
- directive_type.go
- extract_directive_from_doc.go
- extract_preserved_func.go
- find_file_level_directive.go
- func_status.go
- has_file_preserve.go
- hash7.go
- hash_claims.go
- hash_model_method.go
- hash_service_func.go
- hash_state_diagram.go
- is_directive.go
- parse.go
- parse_directive_fields.go
- preserve_snapshot.go
- preserved_func.go
- restore_file_funcs.go
- restore_preserved.go
- scan_dir.go
- scan_func_directives.go
- scan_preserve_snapshot.go
- scan_preserved_from_source.go
- splice_func.go
- splice_replacement.go
- splice_result.go
- splice_with_preserved.go
- strip_directive_prefix.go
- summary.go
- verify_funcs.go
- warning.go