From 76b87574a5b1f5be4840e838053e35db9bc5f2c7 Mon Sep 17 00:00:00 2001 From: Snider Date: Wed, 25 Mar 2026 19:48:41 +0000 Subject: [PATCH] =?UTF-8?q?feat(rfc):=20add=20Sections=2014-17=20=E2=80=94?= =?UTF-8?q?=20string=20ops,=20comments,=20examples,=20full=20quality=20gat?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Section 14: String operations — Println, Sprintf, Concat, Path, Contains, Split, Trim - Section 15: AX Principle 2 — every exported function needs usage-example comment - Section 16: Example tests — one {source}_example_test.go per source file - Section 17: Quality gates — all 10 disallowed imports + string concat check The next session agent loads this RFC and knows exactly what v0.8.0 looks like. Co-Authored-By: Virgil --- docs/RFC.md | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 3 deletions(-) diff --git a/docs/RFC.md b/docs/RFC.md index 4aa9ed7..20a3f08 100644 --- a/docs/RFC.md +++ b/docs/RFC.md @@ -281,16 +281,67 @@ TestMCP_ActionAggregator_Good — Actions appear as MCP tools --- -## 14. Quality Gates (AX Principle 9) +## 14. String Operations + +No `fmt`, no `strings`, no `+` concat. Core provides everything: + +```go +core.Println(value) // not fmt.Println +core.Sprintf("port: %d", port) // not fmt.Sprintf +core.Concat("hello ", name) // not "hello " + name +core.Path(dir, "status.json") // not dir + "/status.json" +core.Contains(s, "prefix") // not strings.Contains +core.Split(s, "/") // not strings.Split +core.Trim(s) // not strings.TrimSpace +``` + +--- + +## 15. Comments (AX Principle 2) + +Every exported function MUST have a usage-example comment: + +```go +// gitCmd runs a git command in a directory. +// +// r := s.gitCmd(ctx, "/repo", "log", "--oneline") +func (s *PrepSubsystem) gitCmd(ctx context.Context, dir string, args ...string) core.Result { +``` + +No exceptions. The comment is for every model that will ever read the code. + +--- + +## 16. Example Tests (AX Principle 7b) + +One `{source}_example_test.go` per source file. Examples serve as test + documentation + godoc. + +```go +// file: dispatch_example_test.go + +func ExamplePrepSubsystem_handleDispatch() { + c := core.New(core.WithService(agentic.Register)) + r := c.Action("agentic.dispatch").Run(ctx, opts) + core.Println(r.OK) + // Output: true +} +``` + +--- + +## 17. Quality Gates (AX Principle 9) ```bash -# No disallowed imports -grep -rn '"os/exec"\|"unsafe"\|"encoding/json"\|"fmt"\|"errors"' pkg/**/*.go \ +# No disallowed imports (all 10) +grep -rn '"os"\|"os/exec"\|"io"\|"fmt"\|"errors"\|"log"\|"encoding/json"\|"path/filepath"\|"unsafe"\|"strings"' pkg/**/*.go \ | grep -v _test.go # Test naming grep "^func Test" pkg/**/*_test.go \ | grep -v "Test[A-Z][a-z]*_.*_\(Good\|Bad\|Ugly\)" + +# String concat +grep -n '" + \| + "' pkg/**/*.go | grep -v _test.go | grep -v "//" ``` ---