From 319cb82906a24b7882eb6800523e5d89d8f060c6 Mon Sep 17 00:00:00 2001 From: SIN CI Date: Tue, 16 Jun 2026 22:12:25 +0200 Subject: [PATCH] style: gofmt + goimports + skill-code-lazy frontmatter lifecycle --- cmd/sin-code/chat_tools_extra.go | 15 +++++----- cmd/sin-code/compile_spec_cmd.go | 10 +++---- cmd/sin-code/goal_cmd.go | 6 ++-- cmd/sin-code/grill_cmd.go | 10 +++---- cmd/sin-code/internal/agentloop/loop.go | 10 +++---- cmd/sin-code/internal/apiweb/coverage_test.go | 2 +- cmd/sin-code/internal/assets/coverage_test.go | 20 ++++++------- cmd/sin-code/internal/assets/importer.go | 4 +-- cmd/sin-code/internal/assets/loader.go | 2 +- cmd/sin-code/internal/dox/dox.go | 10 +++---- .../internal/ghbridge/ghbridge_test.go | 1 - cmd/sin-code/internal/ghbridge/mcpserver.go | 1 - cmd/sin-code/internal/grill/catalog.go | 6 ++-- cmd/sin-code/internal/grill/manager.go | 12 ++++---- cmd/sin-code/internal/grill/types.go | 16 +++++----- .../internal/hooklife/coverage_test.go | 4 +-- .../internal/learning/coverage_test.go | 4 +-- .../internal/memory/memory_more_test.go | 3 +- .../notifications_coverage_test.go | 3 +- .../internal/orchestrator/stcov_test.go | 11 +++++-- .../internal/plugins/plugins_coverage_test.go | 3 +- cmd/sin-code/internal/rag/worker.go | 12 ++++---- cmd/sin-code/internal/spec/author.go | 26 ++++++++-------- cmd/sin-code/internal/spec/check.go | 22 +++++++------- cmd/sin-code/internal/spec/compiler/doc.go | 6 ++-- cmd/sin-code/internal/spec/compiler/emit.go | 6 ++-- cmd/sin-code/internal/spec/compiler/schema.go | 14 ++++----- .../internal/spec/compiler/validate.go | 16 +++++----- cmd/sin-code/internal/spec/drift.go | 30 +++++++++---------- cmd/sin-code/internal/spec/json.go | 6 ++-- cmd/sin-code/internal/spec/pr4_test.go | 4 +-- cmd/sin-code/internal/triage/loader.go | 10 +++---- cmd/sin-code/internal/triage/score.go | 18 +++++------ cmd/sin-code/internal/triage/triage_test.go | 10 +++---- cmd/sin-code/internal/wiring/spec.go | 8 ++--- cmd/sin-code/main.go | 30 +++++++++---------- cmd/sin-code/spec_cmd.go | 4 +-- pkg/browser/cdp/findings.go | 2 +- .../process-skills/skill-code-lazy/SKILL.md | 2 +- 39 files changed, 194 insertions(+), 185 deletions(-) diff --git a/cmd/sin-code/chat_tools_extra.go b/cmd/sin-code/chat_tools_extra.go index 15dfb507..d03ccc15 100644 --- a/cmd/sin-code/chat_tools_extra.go +++ b/cmd/sin-code/chat_tools_extra.go @@ -22,8 +22,9 @@ import ( "strings" "time" - "github.com/OpenSIN-Code/SIN-Code/pkg/browser/cdp" "github.com/chromedp/chromedp" + + "github.com/OpenSIN-Code/SIN-Code/pkg/browser/cdp" ) const ( @@ -362,12 +363,12 @@ func toolBrowserSnapshot() (string, error) { } snap := map[string]interface{}{ - "total_events": len(events), - "first_wall": events[0].WallTime, - "last_wall": events[len(events)-1].WallTime, - "event_counts": counts, - "report": report, - "jsonl": browserSession.jsonlPath, + "total_events": len(events), + "first_wall": events[0].WallTime, + "last_wall": events[len(events)-1].WallTime, + "event_counts": counts, + "report": report, + "jsonl": browserSession.jsonlPath, } b, err := json.MarshalIndent(snap, "", " ") if err != nil { diff --git a/cmd/sin-code/compile_spec_cmd.go b/cmd/sin-code/compile_spec_cmd.go index 76554844..e5d26b4b 100644 --- a/cmd/sin-code/compile_spec_cmd.go +++ b/cmd/sin-code/compile_spec_cmd.go @@ -3,10 +3,10 @@ // .sin-code.yml, validates it, and writes the four derived // JSON outputs to disk. Has three modes: // -// sin-code compile-spec # compile .sin-code.yml in cwd -// sin-code compile-spec --init # write a starter .sin-code.yml -// sin-code compile-spec --check # check that derived files are in sync -// sin-code compile-spec --out # override the output directory +// sin-code compile-spec # compile .sin-code.yml in cwd +// sin-code compile-spec --init # write a starter .sin-code.yml +// sin-code compile-spec --check # check that derived files are in sync +// sin-code compile-spec --out # override the output directory // // Docs: docs/SPEC-COMPILER.md package main @@ -25,7 +25,7 @@ import ( // NewCompileSpecCmd builds the `compile-spec` cobra subcommand. func NewCompileSpecCmd() *cobra.Command { var ( - outDir string + outDir string initMode bool check bool dryRun bool diff --git a/cmd/sin-code/goal_cmd.go b/cmd/sin-code/goal_cmd.go index 5da36641..c618455b 100644 --- a/cmd/sin-code/goal_cmd.go +++ b/cmd/sin-code/goal_cmd.go @@ -291,9 +291,9 @@ func NewGoalCmd() *cobra.Command { switch reportFormat { case "json": payload := map[string]any{ - "total": len(goals), - "by_status": byStatus, - "goals": goals, + "total": len(goals), + "by_status": byStatus, + "goals": goals, } enc := json.NewEncoder(cmd.OutOrStdout()) enc.SetIndent("", " ") diff --git a/cmd/sin-code/grill_cmd.go b/cmd/sin-code/grill_cmd.go index 3dd49c31..7d227b4f 100644 --- a/cmd/sin-code/grill_cmd.go +++ b/cmd/sin-code/grill_cmd.go @@ -6,11 +6,11 @@ // // Subcommands: // -// sin-code grill start begin a grilling session -// sin-code grill next ask the next adversarial question -// sin-code grill answer record the operator's response -// sin-code grill status show resolved + open decision branches -// sin-code grill synthesize produce a summary of decisions +// sin-code grill start begin a grilling session +// sin-code grill next ask the next adversarial question +// sin-code grill answer record the operator's response +// sin-code grill status show resolved + open decision branches +// sin-code grill synthesize produce a summary of decisions // // Sessions are stored in $SIN_CODE_HOME/grill/.json as // content-addressed JSON files. v0 ships in-memory + JSON storage; diff --git a/cmd/sin-code/internal/agentloop/loop.go b/cmd/sin-code/internal/agentloop/loop.go index 500cd40c..f00e6e1f 100644 --- a/cmd/sin-code/internal/agentloop/loop.go +++ b/cmd/sin-code/internal/agentloop/loop.go @@ -67,11 +67,11 @@ type StopDecision struct { type StopGate func(ctx context.Context, snap StopSnapshot) StopDecision type Loop struct { - Gate *verify.Gate - LocalTool LocalToolFunc - LocalSpec []ToolSpec - Workspace string - MaxTurns int + Gate *verify.Gate + LocalTool LocalToolFunc + LocalSpec []ToolSpec + Workspace string + MaxTurns int // MaxStopRejects caps how many times the stop-gate can reject // completion before the run errors. Zero falls back to the // default of 3. Independent of StallThreshold (issue #150): diff --git a/cmd/sin-code/internal/apiweb/coverage_test.go b/cmd/sin-code/internal/apiweb/coverage_test.go index faaaa9de..5a2f0781 100644 --- a/cmd/sin-code/internal/apiweb/coverage_test.go +++ b/cmd/sin-code/internal/apiweb/coverage_test.go @@ -24,7 +24,7 @@ type nonFlusherRecorder struct { rec *httptest.ResponseRecorder } -func (n nonFlusherRecorder) Header() http.Header { return n.rec.Header() } +func (n nonFlusherRecorder) Header() http.Header { return n.rec.Header() } func (n nonFlusherRecorder) Write(b []byte) (int, error) { return n.rec.Write(b) } func (n nonFlusherRecorder) WriteHeader(code int) { n.rec.WriteHeader(code) } diff --git a/cmd/sin-code/internal/assets/coverage_test.go b/cmd/sin-code/internal/assets/coverage_test.go index f9faead6..4076f682 100644 --- a/cmd/sin-code/internal/assets/coverage_test.go +++ b/cmd/sin-code/internal/assets/coverage_test.go @@ -281,29 +281,29 @@ func TestValidate_AllIssueBranches(t *testing.T) { want: 1, }, { - name: "short body", + name: "short body", asset: &Asset{Kind: KindSkill, Name: "n", Description: "d", Path: "x.md", Body: "short"}, - want: 2, + want: 2, }, { - name: "agent no model", + name: "agent no model", asset: &Asset{Kind: KindAgent, Name: "n", Description: "d", Path: "x.md", Body: strings.Repeat("x", 20)}, - want: 2, + want: 2, }, { - name: "command no dollar", + name: "command no dollar", asset: &Asset{Kind: KindCommand, Name: "n", Description: "d", Path: "x.md", Argument: "arg", Body: "no placeholder"}, - want: 2, + want: 2, }, { - name: "skill no sections", + name: "skill no sections", asset: &Asset{Kind: KindSkill, Name: "n", Description: "d", Path: "x.md", Body: strings.Repeat("x", 20)}, - want: 1, + want: 1, }, { - name: "unsafe unicode", + name: "unsafe unicode", asset: &Asset{Kind: KindSkill, Name: "n", Description: "d", Path: "x.md", Body: "## S\n" + "\u200B"}, - want: 2, + want: 2, }, } for _, tc := range cases { diff --git a/cmd/sin-code/internal/assets/importer.go b/cmd/sin-code/internal/assets/importer.go index 68e3733b..65e1b03c 100644 --- a/cmd/sin-code/internal/assets/importer.go +++ b/cmd/sin-code/internal/assets/importer.go @@ -15,8 +15,8 @@ import ( // package-level hooks to make import error branches testable. var ( - osMkdirAllHook = os.MkdirAll - osWriteFileHook = os.WriteFile + osMkdirAllHook = os.MkdirAll + osWriteFileHook = os.WriteFile loadSourceSkillsHook = loadSourceSkills ) diff --git a/cmd/sin-code/internal/assets/loader.go b/cmd/sin-code/internal/assets/loader.go index 4a2f5976..0e38b01a 100644 --- a/cmd/sin-code/internal/assets/loader.go +++ b/cmd/sin-code/internal/assets/loader.go @@ -13,7 +13,7 @@ import ( // package-level hooks to make filesystem error branches testable. var ( - walkDirHook = filepath.WalkDir + walkDirHook = filepath.WalkDir osReadFileHook = os.ReadFile ) diff --git a/cmd/sin-code/internal/dox/dox.go b/cmd/sin-code/internal/dox/dox.go index 8211d71b..062be6e5 100644 --- a/cmd/sin-code/internal/dox/dox.go +++ b/cmd/sin-code/internal/dox/dox.go @@ -19,12 +19,12 @@ import ( // Filesystem hooks for deterministic error-path testing. Set only in tests. var ( - fsReadFile = os.ReadFile + fsReadFile = os.ReadFile fsWriteFile = os.WriteFile - fsStat = os.Stat - fsMkdirAll = os.MkdirAll - fsReadDir = os.ReadDir - fsAbsPath = filepath.Abs + fsStat = os.Stat + fsMkdirAll = os.MkdirAll + fsReadDir = os.ReadDir + fsAbsPath = filepath.Abs ) // ── Markers ──────────────────────────────────────────────────────────── diff --git a/cmd/sin-code/internal/ghbridge/ghbridge_test.go b/cmd/sin-code/internal/ghbridge/ghbridge_test.go index 9bb82d03..da795490 100644 --- a/cmd/sin-code/internal/ghbridge/ghbridge_test.go +++ b/cmd/sin-code/internal/ghbridge/ghbridge_test.go @@ -1590,4 +1590,3 @@ type errWriter struct { func (e *errWriter) Write([]byte) (int, error) { return 0, e.err } - diff --git a/cmd/sin-code/internal/ghbridge/mcpserver.go b/cmd/sin-code/internal/ghbridge/mcpserver.go index d23857df..126db21f 100644 --- a/cmd/sin-code/internal/ghbridge/mcpserver.go +++ b/cmd/sin-code/internal/ghbridge/mcpserver.go @@ -492,4 +492,3 @@ func writeJSONAtomic(path string, v any) error { } return os.Rename(tmpName, path) } - diff --git a/cmd/sin-code/internal/grill/catalog.go b/cmd/sin-code/internal/grill/catalog.go index 72f1490f..b4b5c67d 100644 --- a/cmd/sin-code/internal/grill/catalog.go +++ b/cmd/sin-code/internal/grill/catalog.go @@ -6,9 +6,9 @@ // // The catalog is intentionally a Go slice (not a YAML file) so // that: -// 1. The CLI has zero file-deps for `grill next`. -// 2. The questions are typed (no string-template magic). -// 3. Operators can grep the binary for the question set. +// 1. The CLI has zero file-deps for `grill next`. +// 2. The questions are typed (no string-template magic). +// 3. Operators can grep the binary for the question set. package grill // AntiPattern is one entry in the catalog: the "what to look for" diff --git a/cmd/sin-code/internal/grill/manager.go b/cmd/sin-code/internal/grill/manager.go index e932b225..bfabf843 100644 --- a/cmd/sin-code/internal/grill/manager.go +++ b/cmd/sin-code/internal/grill/manager.go @@ -19,7 +19,7 @@ import ( // `grill answer` in parallel from a TUI shell, for example). type Manager struct { mu sync.Mutex - dir string // JSON file directory (e.g. ~/.local/share/sin-code/grill) + dir string // JSON file directory (e.g. ~/.local/share/sin-code/grill) sessions map[string]*Session // keyed by ID } @@ -109,11 +109,11 @@ func (m *Manager) Next(id string) (decision Decision, parentID string, err error // Append a sub-question from the catalog. q := catalogQuestion(s.Topic, len(s.Decisions)) child := Decision{ - ID: fmt.Sprintf("d%d", len(s.Decisions)), - ParentID: d.ID, - Question: q, - Status: "open", - AskedAt: time.Now().UTC(), + ID: fmt.Sprintf("d%d", len(s.Decisions)), + ParentID: d.ID, + Question: q, + Status: "open", + AskedAt: time.Now().UTC(), } s.Decisions = append(s.Decisions, child) s.UpdatedAt = child.AskedAt diff --git a/cmd/sin-code/internal/grill/types.go b/cmd/sin-code/internal/grill/types.go index 41d9b1c4..4927dd51 100644 --- a/cmd/sin-code/internal/grill/types.go +++ b/cmd/sin-code/internal/grill/types.go @@ -37,12 +37,12 @@ type Session struct { // - "resolved" — operator is satisfied, the decision is final // - "deferred" — operator wants to come back later type Decision struct { - ID string `json:"id"` - ParentID string `json:"parent_id,omitempty"` - Question string `json:"question"` - Answer string `json:"answer,omitempty"` - Status string `json:"status"` - AskedAt time.Time `json:"asked_at"` + ID string `json:"id"` + ParentID string `json:"parent_id,omitempty"` + Question string `json:"question"` + Answer string `json:"answer,omitempty"` + Status string `json:"status"` + AskedAt time.Time `json:"asked_at"` ResolvedAt time.Time `json:"resolved_at,omitempty"` } @@ -51,8 +51,8 @@ type Decision struct { // during the interview. The CLI emits this in both human-readable // text and JSON. type Synthesize struct { - Resolved []string `json:"resolved"` - Open []string `json:"open"` + Resolved []string `json:"resolved"` + Open []string `json:"open"` Assumptions []string `json:"assumptions"` } diff --git a/cmd/sin-code/internal/hooklife/coverage_test.go b/cmd/sin-code/internal/hooklife/coverage_test.go index 21f2ed2f..fb8a8745 100644 --- a/cmd/sin-code/internal/hooklife/coverage_test.go +++ b/cmd/sin-code/internal/hooklife/coverage_test.go @@ -20,8 +20,8 @@ type mockHook struct { run func(context.Context, Event) Decision } -func (m mockHook) ID() string { return m.id } -func (m mockHook) Phases() []Phase { return m.phases } +func (m mockHook) ID() string { return m.id } +func (m mockHook) Phases() []Phase { return m.phases } func (m mockHook) Run(ctx context.Context, ev Event) Decision { if m.run != nil { return m.run(ctx, ev) diff --git a/cmd/sin-code/internal/learning/coverage_test.go b/cmd/sin-code/internal/learning/coverage_test.go index 8580886a..9ec017bc 100644 --- a/cmd/sin-code/internal/learning/coverage_test.go +++ b/cmd/sin-code/internal/learning/coverage_test.go @@ -82,8 +82,8 @@ func TestBeforeTool_allowAndBlock(t *testing.T) { type warnHook struct{} -func (warnHook) ID() string { return "test-warn" } -func (warnHook) Phases() []hooklife.Phase { return []hooklife.Phase{hooklife.PostToolUse} } +func (warnHook) ID() string { return "test-warn" } +func (warnHook) Phases() []hooklife.Phase { return []hooklife.Phase{hooklife.PostToolUse} } func (warnHook) Run(context.Context, hooklife.Event) hooklife.Decision { return hooklife.Decision{Verdict: hooklife.Warn, Message: "test warning"} } diff --git a/cmd/sin-code/internal/memory/memory_more_test.go b/cmd/sin-code/internal/memory/memory_more_test.go index c2bb5b69..42537524 100644 --- a/cmd/sin-code/internal/memory/memory_more_test.go +++ b/cmd/sin-code/internal/memory/memory_more_test.go @@ -1,5 +1,6 @@ -// SPDX-License-Identifier: MIT //go:build coverage + +// SPDX-License-Identifier: MIT // Purpose: targeted coverage tests for the memory package. These hit the // error branches and edge cases that require package-level hooks. // Docs: memory.doc.md diff --git a/cmd/sin-code/internal/notifications/notifications_coverage_test.go b/cmd/sin-code/internal/notifications/notifications_coverage_test.go index 96f5ba0d..61925e7e 100644 --- a/cmd/sin-code/internal/notifications/notifications_coverage_test.go +++ b/cmd/sin-code/internal/notifications/notifications_coverage_test.go @@ -1,5 +1,6 @@ -// SPDX-License-Identifier: MIT //go:build coverage + +// SPDX-License-Identifier: MIT // Purpose: coverage tests for the remaining branches in the notifications package. package notifications diff --git a/cmd/sin-code/internal/orchestrator/stcov_test.go b/cmd/sin-code/internal/orchestrator/stcov_test.go index a1f46db3..d77cfda8 100644 --- a/cmd/sin-code/internal/orchestrator/stcov_test.go +++ b/cmd/sin-code/internal/orchestrator/stcov_test.go @@ -1,5 +1,6 @@ -// SPDX-License-Identifier: MIT //go:build coverage + +// SPDX-License-Identifier: MIT // Purpose: targeted coverage tests for remaining uncovered statements in the // orchestrator package. Uses the package-level test hooks added to files that // call external subprocesses. @@ -4503,7 +4504,9 @@ func TestGovernorRunRungSpecRunError(t *testing.T) { Ladder: []Rung{{Name: "multi", Agents: 2, RepairRounds: 1, Timeout: time.Second}}, Verifier: NewVerifier(t.TempDir()), Checks: []Check{{Kind: CheckBuild, Name: "c", Cmd: []string{"true"}}}, - Factory: func(rung Rung) []Agent { return []Agent{stcovAgent{name: "a1", out: "ok"}, stcovAgent{name: "a2", out: "ok"}} }, + Factory: func(rung Rung) []Agent { + return []Agent{stcovAgent{name: "a1", out: "ok"}, stcovAgent{name: "a2", out: "ok"}} + }, } res, err := g.Execute(context.Background(), &Task{ID: "t"}, NewScratchpad()) if err == nil || !strings.Contains(err.Error(), "spec run fail") { @@ -4522,7 +4525,9 @@ func TestGovernorRunRungNoWinner(t *testing.T) { Ladder: []Rung{{Name: "multi", Agents: 2, RepairRounds: 1, Timeout: time.Second}}, Verifier: NewVerifier(t.TempDir()), Checks: []Check{{Kind: CheckBuild, Name: "c", Cmd: []string{"true"}}}, - Factory: func(rung Rung) []Agent { return []Agent{stcovAgent{name: "a1", out: "ok"}, stcovAgent{name: "a2", out: "ok"}} }, + Factory: func(rung Rung) []Agent { + return []Agent{stcovAgent{name: "a1", out: "ok"}, stcovAgent{name: "a2", out: "ok"}} + }, } res, err := g.Execute(context.Background(), &Task{ID: "t"}, NewScratchpad()) if err != nil { diff --git a/cmd/sin-code/internal/plugins/plugins_coverage_test.go b/cmd/sin-code/internal/plugins/plugins_coverage_test.go index f43763e3..965b982a 100644 --- a/cmd/sin-code/internal/plugins/plugins_coverage_test.go +++ b/cmd/sin-code/internal/plugins/plugins_coverage_test.go @@ -1,5 +1,6 @@ -// SPDX-License-Identifier: MIT //go:build coverage + +// SPDX-License-Identifier: MIT // Purpose: targeted coverage tests for the remaining error branches in the // plugin manifest and registry packages. package plugins diff --git a/cmd/sin-code/internal/rag/worker.go b/cmd/sin-code/internal/rag/worker.go index 2aacddd6..86d4e4f0 100644 --- a/cmd/sin-code/internal/rag/worker.go +++ b/cmd/sin-code/internal/rag/worker.go @@ -22,9 +22,9 @@ var ErrPoolClosed = errors.New("rag: worker pool closed") // (size 1) so the worker can send without blocking, and the // caller can read without coordinating with the worker. type job struct { - ctx context.Context - text string - done chan result + ctx context.Context + text string + done chan result } type result struct { @@ -34,9 +34,9 @@ type result struct { // WorkerPool is the bounded-concurrency embedder. type WorkerPool struct { - embedder Embedder - queue chan job - wg sync.WaitGroup + embedder Embedder + queue chan job + wg sync.WaitGroup closeOnce sync.Once closed chan struct{} } diff --git a/cmd/sin-code/internal/spec/author.go b/cmd/sin-code/internal/spec/author.go index ffc1142e..36b32a0d 100644 --- a/cmd/sin-code/internal/spec/author.go +++ b/cmd/sin-code/internal/spec/author.go @@ -25,10 +25,10 @@ type Completer interface { // with safe defaults; production wires a real Completer and a longer // timeout. type AuthorOptions struct { - Completer Completer // nil = dry-run (returns a stub spec for testing) - Timeout time.Duration // per-call; default 60s - MaxRetries int // default 3 - Workdir string // for the working tree the implementer sees + Completer Completer // nil = dry-run (returns a stub spec for testing) + Timeout time.Duration // per-call; default 60s + MaxRetries int // default 3 + Workdir string // for the working tree the implementer sees } // AuthorResult is the outcome of one Author call. Either the loop @@ -41,20 +41,20 @@ type AuthorResult struct { // AuthorStep is one iteration of the loop. type AuthorStep struct { - Attempt int - PlannerOut string // raw planner output (for debugging) + Attempt int + PlannerOut string // raw planner output (for debugging) ImplementerOut string - Drift *CheckReport // nil if the implementer didn't change the tree - Verdict string // "ok" | "drift" | "planner-empty" | "implementer-empty" + Drift *CheckReport // nil if the implementer didn't change the tree + Verdict string // "ok" | "drift" | "planner-empty" | "implementer-empty" } // Author runs the self-authoring loop for desc. The loop: // -// 1. Planner LLM call: produce a *.spec.md from desc -// 2. Implementer LLM call: write code that satisfies the spec -// 3. Drift check: run every criterion's verify: command -// 4. On must-priority failure: feed the failing criterion back to -// the Implementer LLM and retry (up to MaxRetries). +// 1. Planner LLM call: produce a *.spec.md from desc +// 2. Implementer LLM call: write code that satisfies the spec +// 3. Drift check: run every criterion's verify: command +// 4. On must-priority failure: feed the failing criterion back to +// the Implementer LLM and retry (up to MaxRetries). // // The returned Spec is the version that passed. Trace is non-nil even // on failure so the operator can see what the loop tried. diff --git a/cmd/sin-code/internal/spec/check.go b/cmd/sin-code/internal/spec/check.go index 62910f26..61e2d412 100644 --- a/cmd/sin-code/internal/spec/check.go +++ b/cmd/sin-code/internal/spec/check.go @@ -20,15 +20,15 @@ const DefaultCheckTimeout = 60 * time.Second // CheckResult is the outcome of running a single criterion's verify // command. The ID matches the Criterion.ID from the parsed spec. type CheckResult struct { - ID string `json:"id"` - Text string `json:"text"` - Command string `json:"command,omitempty"` - Passed bool `json:"passed"` - Skipped bool `json:"skipped,omitempty"` - ExitCode int `json:"exit_code,omitempty"` - Duration time.Duration `json:"duration_ns"` - Output string `json:"output,omitempty"` // truncated stdout+stderr - Priority Priority `json:"priority,omitempty"` + ID string `json:"id"` + Text string `json:"text"` + Command string `json:"command,omitempty"` + Passed bool `json:"passed"` + Skipped bool `json:"skipped,omitempty"` + ExitCode int `json:"exit_code,omitempty"` + Duration time.Duration `json:"duration_ns"` + Output string `json:"output,omitempty"` // truncated stdout+stderr + Priority Priority `json:"priority,omitempty"` } // CheckReport aggregates per-criterion results into a summary. @@ -84,8 +84,8 @@ func (s *Spec) Check(ctx context.Context, timeout time.Duration) (*CheckReport, for _, c := range s.Criteria { res := CheckResult{ - ID: c.ID, - Text: c.Text, + ID: c.ID, + Text: c.Text, Priority: Must, // conservative until the parser learns priorities } if strings.TrimSpace(c.Verify) == "" { diff --git a/cmd/sin-code/internal/spec/compiler/doc.go b/cmd/sin-code/internal/spec/compiler/doc.go index ce697f2d..6c5652ca 100644 --- a/cmd/sin-code/internal/spec/compiler/doc.go +++ b/cmd/sin-code/internal/spec/compiler/doc.go @@ -3,9 +3,9 @@ // Reads a single .sin-code.yml and produces the three derived // artifacts the SIN-Code binary needs: // -// .sin/hooks.json for internal/hooks/ -// internal/verify/config.json for internal/verify/ -// internal/permission/policies.json for internal/permission/ +// .sin/hooks.json for internal/hooks/ +// internal/verify/config.json for internal/verify/ +// internal/permission/policies.json for internal/permission/ // // v0 scope (this PR): // - schema + parser + validator + 3 output emitters diff --git a/cmd/sin-code/internal/spec/compiler/emit.go b/cmd/sin-code/internal/spec/compiler/emit.go index 5abdd8a1..e9d30679 100644 --- a/cmd/sin-code/internal/spec/compiler/emit.go +++ b/cmd/sin-code/internal/spec/compiler/emit.go @@ -30,9 +30,9 @@ type HookEntry struct { // VerifyOutput is the contract for internal/verify/config.json. type VerifyOutput struct { - Version int `json:"version"` - Mode string `json:"mode"` - Predicates []VerifyPredicate `json:"predicates"` + Version int `json:"version"` + Mode string `json:"mode"` + Predicates []VerifyPredicate `json:"predicates"` } // VerifyPredicate is one predicate in the verify contract. diff --git a/cmd/sin-code/internal/spec/compiler/schema.go b/cmd/sin-code/internal/spec/compiler/schema.go index 01aff9bb..b2de1832 100644 --- a/cmd/sin-code/internal/spec/compiler/schema.go +++ b/cmd/sin-code/internal/spec/compiler/schema.go @@ -12,12 +12,12 @@ package compiler // Config is the top-level .sin-code.yml document. type Config struct { - Version int `yaml:"version"` - Project Project `yaml:"project"` - Verify Verify `yaml:"verify"` - Hooks Hooks `yaml:"hooks"` - Permissions Permissions `yaml:"permissions"` - Loop Loop `yaml:"loop"` // v1.1 follow-up, ignored in v0 + Version int `yaml:"version"` + Project Project `yaml:"project"` + Verify Verify `yaml:"verify"` + Hooks Hooks `yaml:"hooks"` + Permissions Permissions `yaml:"permissions"` + Loop Loop `yaml:"loop"` // v1.1 follow-up, ignored in v0 } // Project is the project's metadata. @@ -28,7 +28,7 @@ type Project struct { // Verify is the verify-gate configuration. type Verify struct { - Mode string `yaml:"mode"` // minimal|standard|strict + Mode string `yaml:"mode"` // minimal|standard|strict Predicates []Predicate `yaml:"predicates"` } diff --git a/cmd/sin-code/internal/spec/compiler/validate.go b/cmd/sin-code/internal/spec/compiler/validate.go index ddaf7c58..f80d5f96 100644 --- a/cmd/sin-code/internal/spec/compiler/validate.go +++ b/cmd/sin-code/internal/spec/compiler/validate.go @@ -23,11 +23,11 @@ func (e *ValidationError) Error() string { // ValidProjectTypes are the values accepted by project.type. var ValidProjectTypes = map[string]bool{ - "go": true, - "python": true, - "rust": true, - "node": true, - "polyglot": true, + "go": true, + "python": true, + "rust": true, + "node": true, + "polyglot": true, } // ValidVerifyModes are the values accepted by verify.mode. @@ -63,7 +63,7 @@ func Validate(c *Config) error { // Project: type must be a known value. if c.Project.Type != "" && !ValidProjectTypes[c.Project.Type] { return &ValidationError{ - Path: "project.type", + Path: "project.type", Message: fmt.Sprintf("invalid value %q (expected one of %s)", c.Project.Type, strings.Join(ValidProjectTypeValues, ", ")), } @@ -71,7 +71,7 @@ func Validate(c *Config) error { // Verify: mode must be a known value. if c.Verify.Mode != "" && !ValidVerifyModes[c.Verify.Mode] { return &ValidationError{ - Path: "verify.mode", + Path: "verify.mode", Message: fmt.Sprintf("invalid value %q (expected one of %s)", c.Verify.Mode, strings.Join(ValidVerifyModeValues, ", ")), } @@ -93,7 +93,7 @@ func Validate(c *Config) error { } if seen[p.Name] { return &ValidationError{ - Path: fmt.Sprintf("verify.predicates[%d].name", i), + Path: fmt.Sprintf("verify.predicates[%d].name", i), Message: fmt.Sprintf("duplicate name %q", p.Name), } } diff --git a/cmd/sin-code/internal/spec/drift.go b/cmd/sin-code/internal/spec/drift.go index 3fb804f2..9ca5b840 100644 --- a/cmd/sin-code/internal/spec/drift.go +++ b/cmd/sin-code/internal/spec/drift.go @@ -36,14 +36,14 @@ var pySignaturePattern = regexp.MustCompile("`def\\s+([A-Za-z_][A-Za-z0-9_]*)\\s // Kind discriminates Go vs Python (JSON shapes use JSONShapeHit // instead because their structure is different). type SignatureHit struct { - Kind string // "go" or "python" + Kind string // "go" or "python" RequirementID string FuncName string RawParamText string RawResultText string - Code string - Match bool - Note string + Code string + Match bool + Note string } // JSONShapeHit is one requirement that names a JSON object shape @@ -121,11 +121,11 @@ func (s *Spec) DetectSignatureDriftWithPython(root, pythonBin string) (*DriftRep // 2a. Go signatures. for _, m := range signaturePattern.FindAllStringSubmatch(r.Text, -1) { hit := SignatureHit{ - Kind: "go", - RequirementID: r.ID, - FuncName: m[1], - RawParamText: strings.TrimSpace(m[2]), - RawResultText: strings.TrimSpace(m[3]), + Kind: "go", + RequirementID: r.ID, + FuncName: m[1], + RawParamText: strings.TrimSpace(m[2]), + RawResultText: strings.TrimSpace(m[3]), } candidates, ok := gofuncs[hit.FuncName] if !ok { @@ -152,11 +152,11 @@ func (s *Spec) DetectSignatureDriftWithPython(root, pythonBin string) (*DriftRep // 2b. Python signatures. for _, m := range pySignaturePattern.FindAllStringSubmatch(r.Text, -1) { hit := SignatureHit{ - Kind: "python", - RequirementID: r.ID, - FuncName: m[1], - RawParamText: strings.TrimSpace(m[2]), - RawResultText: strings.TrimSpace(m[3]), + Kind: "python", + RequirementID: r.ID, + FuncName: m[1], + RawParamText: strings.TrimSpace(m[2]), + RawResultText: strings.TrimSpace(m[3]), } if pyfuncs == nil { hit.Note = "python3 not available; skipping Python signature check" @@ -298,7 +298,7 @@ func receiverTypeName(expr ast.Expr) string { case *ast.IndexExpr: // Generic receiver: T[int] -> "T[int]" return exprText(v.X) + "[" + exprText(v.Index) + "]" -} + } return "" } diff --git a/cmd/sin-code/internal/spec/json.go b/cmd/sin-code/internal/spec/json.go index 7f5d9335..3a99a512 100644 --- a/cmd/sin-code/internal/spec/json.go +++ b/cmd/sin-code/internal/spec/json.go @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT // Purpose: JSON-Schema signature matching. A spec requirement that -// names a JSON object shape (e.g. `\`{"name": str, "id": int}\``) +// names a JSON object shape (e.g. `\`{"name": str, "id": int}\“) // is checked against the .json files in the source tree. // // v0 is intentionally simple: we don't pull in a full JSON-Schema @@ -164,7 +164,9 @@ func typeCompatible(want string, got any) bool { // object literals in requirements and returns them as jsonFunc // records. The strict mode is set per-shape via a trailing // "strict!" marker inside the body, e.g.: -// `{"name": str, "id": int} strict!` +// +// `{"name": str, "id": int} strict!` +// // (Useful for hand-edited specs that need extras forbidden.) func extractJSONShapes(text string) []jsonFunc { var out []jsonFunc diff --git a/cmd/sin-code/internal/spec/pr4_test.go b/cmd/sin-code/internal/spec/pr4_test.go index b1006ffc..ba799a7c 100644 --- a/cmd/sin-code/internal/spec/pr4_test.go +++ b/cmd/sin-code/internal/spec/pr4_test.go @@ -167,8 +167,8 @@ func TestDrift_JSONNonStrictIgnoresExtras(t *testing.T) { func TestExtractJSONShapes_StrictMarker(t *testing.T) { cases := []struct { - text string - wantKeys int // how many shapes to extract + text string + wantKeys int // how many shapes to extract wantStrict bool }{ {`{"name": "str", "id": "int"} strict!`, 1, true}, diff --git a/cmd/sin-code/internal/triage/loader.go b/cmd/sin-code/internal/triage/loader.go index dc591611..25173b9a 100644 --- a/cmd/sin-code/internal/triage/loader.go +++ b/cmd/sin-code/internal/triage/loader.go @@ -37,11 +37,11 @@ func loadFromGH(ctx context.Context, repo string) ([]Issue, error) { return nil, fmt.Errorf("gh issue list: %w", err) } var raw []struct { - Number int `json:"number"` - Title string `json:"title"` - Body string `json:"body"` - State string `json:"state"` - Author struct { + Number int `json:"number"` + Title string `json:"title"` + Body string `json:"body"` + State string `json:"state"` + Author struct { Login string `json:"login"` } `json:"author"` Labels []struct { diff --git a/cmd/sin-code/internal/triage/score.go b/cmd/sin-code/internal/triage/score.go index be477386..c9fa32d5 100644 --- a/cmd/sin-code/internal/triage/score.go +++ b/cmd/sin-code/internal/triage/score.go @@ -16,15 +16,15 @@ import ( // (not config) so they are auditable and reviewable like the rest of // the agent. const ( - wEpic = 10 - wBlocked = 5 - wAcceptance = 3 - wNoV0 = 5 - wGoodFirst = -3 - wStale30d = -2 - wFresh7d = 1 - wLoopSystem = 4 - wFusion = 2 + wEpic = 10 + wBlocked = 5 + wAcceptance = 3 + wNoV0 = 5 + wGoodFirst = -3 + wStale30d = -2 + wFresh7d = 1 + wLoopSystem = 4 + wFusion = 2 wMemoryOrSkill = 2 ) diff --git a/cmd/sin-code/internal/triage/triage_test.go b/cmd/sin-code/internal/triage/triage_test.go index ecaad25a..52515603 100644 --- a/cmd/sin-code/internal/triage/triage_test.go +++ b/cmd/sin-code/internal/triage/triage_test.go @@ -105,11 +105,11 @@ func TestContainsRef(t *testing.T) { }{ {"see #1", "#1", true}, {"#1 wins", "#1", true}, - {"x#1y", "#1", true}, // adjacent non-digit both sides - {"#12 contains #1", "#1", true}, // #1 at end after space - {"#12", "#1", false}, // #1 followed by digit - {"prefix0#1", "#1", false}, // #1 preceded by digit - {"#1234", "#123", false}, // #123 in #1234: digit boundary rejects prefix + {"x#1y", "#1", true}, // adjacent non-digit both sides + {"#12 contains #1", "#1", true}, // #1 at end after space + {"#12", "#1", false}, // #1 followed by digit + {"prefix0#1", "#1", false}, // #1 preceded by digit + {"#1234", "#123", false}, // #123 in #1234: digit boundary rejects prefix {"#1234", "#1234", true}, {"#1234", "#12345", false}, {"", "#1", false}, diff --git a/cmd/sin-code/internal/wiring/spec.go b/cmd/sin-code/internal/wiring/spec.go index 812aeb86..0b242d22 100644 --- a/cmd/sin-code/internal/wiring/spec.go +++ b/cmd/sin-code/internal/wiring/spec.go @@ -69,11 +69,11 @@ func NewSpecCompleter(client *llm.Client, model string) spec.Completer { // loop; with nil, the CLI runs in dry-run mode (stubs out the // spec). type SpecAuthorOptions struct { - Completer spec.Completer - Model string - Timeout time.Duration + Completer spec.Completer + Model string + Timeout time.Duration MaxRetries int - Workdir string + Workdir string } // AuthorSpec is a thin wrapper that runs spec.Author with the diff --git a/cmd/sin-code/main.go b/cmd/sin-code/main.go index 9710c526..745045db 100644 --- a/cmd/sin-code/main.go +++ b/cmd/sin-code/main.go @@ -79,27 +79,27 @@ func init() { rootCmd.AddCommand(tuiCmd) rootCmd.AddCommand(webuiCmd) rootCmd.AddCommand(NewChatCmd(), NewSessionsCmd(), NewMCPCmd(), - NewGoalCmd(), NewDaemonCmd(), NewSkillCmd(), NewSwarmCmd(), NewSuperpowersCmd(), NewDoxCmd(), + NewGoalCmd(), NewDaemonCmd(), NewSkillCmd(), NewSwarmCmd(), NewSuperpowersCmd(), NewDoxCmd(), NewVaneCmd(), NewStackCmd(), NewGhCmd(), NewHubCmd(), NewLedgerCmd(), NewSummaryCmd(), NewAutodevCmd(), // v3.4.0 + v3.5.0 + v3.6.0 + v3.7.0 + v3.8.0 + v3.9.0 + v3.12.0 + v3.13.0 + autodev-bridge (Python MIT v0.4.0, stdio MCP via autodev-mcp) - NewCompressCmd(), // v3.18.0 — deterministic + LLM compaction (issue #172) + NewCompressCmd(), // v3.18.0 — deterministic + LLM compaction (issue #172) NewLedgerCmd(), NewSummaryCmd(), NewAutodevCmd(), NewReviewCmd(), // v3.4.0 + v3.5.0 + v3.6.0 + v3.7.0 + v3.8.0 + v3.9.0 + v3.12.0 + v3.13.0 + autodev-bridge + review --complexity (issue #179) NewSkillsCmd(), // bundled project-local agent skills NewEvalCmd(), NewTraceCmd(), // v3.18.0: Eval & Observability System (issue #75) - NewProfileCmd(), // v3.18.0: single-source-of-truth per-agent profile renderer (issue #175) + NewProfileCmd(), // v3.18.0: single-source-of-truth per-agent profile renderer (issue #175) NewEvalCmd(), NewTraceCmd(), // v3.18.0: Eval + Observability System (issue #75) - NewRtkCmd(), // rtk (Rust Token Killer) bridge (issue #123) - NewCodeGraphCmd(), // CodeGraph multi-language analysis bridge (issue #126) - NewSpecCmd(), // Spec-Layer: *.spec.md contracts (issue #122) - NewInstallCmd(), // v3.18.0: `sin-code install` — single-binary installer entrypoint (issue #170) - NewTriageCmd(), // v3.18.0: `sin-code triage` — backlog auto-prioritizer via gh (issue #162) - NewCatalogCmd(), // v3.18.0: `sin-code catalog` — unified tool catalog (issue #163, supersedes `hub` + `assets`) - NewCompileSpecCmd(), // v3.21.0: `sin-code compile-spec` — declarative .sin-code.yml → hooks/verify/perm (issue #164) - NewGrillCmd(), // v3.18.0: `sin-code grill` — native adversarial design-review (issue #141 fusion) - NewRtkCmd(), // rtk (Rust Token Killer) bridge (issue #123) - NewCodeGraphCmd(), // CodeGraph multi-language analysis bridge (issue #126) - NewSpecCmd(), // Spec-Layer: *.spec.md contracts (issue #122) - NewDebtCmd(), // issue #177: sin-debt marker manager (`// sin-debt: , upgrade: `) + NewRtkCmd(), // rtk (Rust Token Killer) bridge (issue #123) + NewCodeGraphCmd(), // CodeGraph multi-language analysis bridge (issue #126) + NewSpecCmd(), // Spec-Layer: *.spec.md contracts (issue #122) + NewInstallCmd(), // v3.18.0: `sin-code install` — single-binary installer entrypoint (issue #170) + NewTriageCmd(), // v3.18.0: `sin-code triage` — backlog auto-prioritizer via gh (issue #162) + NewCatalogCmd(), // v3.18.0: `sin-code catalog` — unified tool catalog (issue #163, supersedes `hub` + `assets`) + NewCompileSpecCmd(), // v3.21.0: `sin-code compile-spec` — declarative .sin-code.yml → hooks/verify/perm (issue #164) + NewGrillCmd(), // v3.18.0: `sin-code grill` — native adversarial design-review (issue #141 fusion) + NewRtkCmd(), // rtk (Rust Token Killer) bridge (issue #123) + NewCodeGraphCmd(), // CodeGraph multi-language analysis bridge (issue #126) + NewSpecCmd(), // Spec-Layer: *.spec.md contracts (issue #122) + NewDebtCmd(), // issue #177: sin-debt marker manager (`// sin-debt: , upgrade: `) NewRtkCmd(), // rtk (Rust Token Killer) bridge (issue #123) NewCodeGraphCmd(), // CodeGraph multi-language analysis bridge (issue #126) NewSpecCmd(), // Spec-Layer: *.spec.md contracts (issue #122) diff --git a/cmd/sin-code/spec_cmd.go b/cmd/sin-code/spec_cmd.go index 4c7d133c..7a471fb1 100644 --- a/cmd/sin-code/spec_cmd.go +++ b/cmd/sin-code/spec_cmd.go @@ -223,8 +223,8 @@ source tree under --root (default: current dir). // union type would need a discriminator. PR 3 adds // the JSON envelope if a downstream tool needs it. if err := enc.Encode(struct { - Path string `json:"-"` - Files []*spec.CheckReport `json:"files"` + Path string `json:"-"` + Files []*spec.CheckReport `json:"files"` }{Files: nil}); err != nil { return err } diff --git a/pkg/browser/cdp/findings.go b/pkg/browser/cdp/findings.go index 03509b3d..b43f4863 100644 --- a/pkg/browser/cdp/findings.go +++ b/pkg/browser/cdp/findings.go @@ -203,7 +203,7 @@ func Analyze(events []*Event) []*Finding { // ---- Security state degradation ------------------------------------ case e.Domain == "Security" && e.Method == "securityStateChanged": var raw struct { - SecurityState string `json:"securityState"` + SecurityState string `json:"securityState"` SchemeIsCryptographic bool `json:"schemeIsCryptographic"` } if json.Unmarshal(e.Params, &raw) != nil { diff --git a/skills/process-skills/skill-code-lazy/SKILL.md b/skills/process-skills/skill-code-lazy/SKILL.md index 2aed79d7..dd04511f 100644 --- a/skills/process-skills/skill-code-lazy/SKILL.md +++ b/skills/process-skills/skill-code-lazy/SKILL.md @@ -7,6 +7,7 @@ description: >- Triggers include: be lazy, lazy mode, minimal solution, yagni, simplest, do less, ship the lazy version. license: MIT +lifecycle: external compatibility: - opencode - sin-code @@ -16,7 +17,6 @@ metadata: ponytail-version: 1.0 derived_from: github.com/DietrichGebert/ponytail ponytail-anchor: skills/ponytail/SKILL.md:1-80 - lifecycle: external sources: - https://github.com/DietrichGebert/ponytail/blob/main/skills/ponytail/SKILL.md sin-mandate: M3 (verification gate is sacred)