Commit graph

47 commits

Author SHA1 Message Date
Snider
d90a5be936 refactor: AX compliance sweep — replace banned stdlib imports with core primitives
Replaced fmt, strings, sort, os, io, sync, encoding/json, path/filepath,
errors, log, reflect with core.Sprintf, core.E, core.Contains, core.Trim,
core.Split, core.Join, core.JoinPath, slices.Sort, c.Fs(), c.Lock(),
core.JSONMarshal, core.ReadAll and other CoreGO v0.8.0 primitives.

Framework boundary exceptions preserved where stdlib types are required
by external interfaces (Gin, net/http, CGo, Wails, bubbletea).

Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-13 09:32:00 +01:00
Snider
e54dd2e370 fix(pr#2): address CodeRabbit major/critical review findings
Go:
- codegen: pass trimmed specPath to buildArgs instead of raw g.SpecPath
- cmd/sdk: use local resolvedSpecFile to avoid mutating flag variable per-invocation
- export: write to temp file + atomic rename to prevent destination truncation on failure
- openapi: gate effectiveGraphQLPath/SwaggerPath/WSPath/SSEPath on enable flags; use effectiveSwaggerPath in effectiveAuthentikPublicPaths
- cache: reject oversized replacement before mutating LRU state for existing keys
- ratelimit: move setRateLimitHeaders before c.Next() so headers are sent; hash credential headers with SHA-256 to avoid storing raw secrets; prefer validated principal from context
- response_meta: track size separately from body buffer so Size() is accurate after body rewrites and in passthrough mode
- bridge: limit request body reads with http.MaxBytesReader (10 MiB); allow missing data key in ValidateResponse for nil/zero success responses; update recorder status in writeErrorResponse
- pkg/provider/proxy: validate target scheme and host after url.Parse to catch hostless inputs
- cmd_test: snapshot/restore global spec registry in TestAPISpecCmd_Good_RegisteredSpecGroups

PHP:
- HasApiResponses.php, config.php: add declare(strict_types=1)
- RateLimitExceededException: validate Origin against cors.allowed_origins before reflecting in CORS header
- ApiUsageService: import and use Core\Api\Models\ApiKey instead of fully-qualified Mod\ path
- SeoReportService: add SSRF protection (scheme check, private-IP rejection); add .throw() for HTTP error handling; disable automatic redirects

Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-07 08:38:41 +01:00
Virgil
aea902ed28 fix(cmd/api): forward graphql playground path to sdk specs
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-03 05:02:47 +00:00
Virgil
a3a1c20e7a fix(api): support custom GraphQL playground paths
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-03 04:53:30 +00:00
Virgil
2b71c78c33 fix(openapi): ignore non-positive cache ttl in spec
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 14:42:01 +00:00
Virgil
5971951c87 fix(cmd/api): trim spec metadata inputs 2026-04-02 14:25:59 +00:00
Virgil
d7290c55ec fix(cmd/api): align cache metadata with runtime
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 14:22:32 +00:00
Virgil
8301d4d1c7 fix(cmd/api): ignore non-positive cache ttl in spec
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 14:18:31 +00:00
Virgil
a6693e1656 feat(api): surface effective Authentik public paths in specs
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 13:51:54 +00:00
Virgil
a07896d88e fix(cmd/api): normalise authentik spec public paths
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 13:46:45 +00:00
Virgil
f234fcba5f feat(api): surface authentik metadata in specs
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 13:25:23 +00:00
Virgil
ef51d9b1c3 refactor(cmd/api): centralize spec flag binding
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 13:01:45 +00:00
Virgil
ede71e2b1f feat(cmd/api): infer spec transport enablement from flags
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 12:56:59 +00:00
Virgil
814c1b6233 feat(cmd/api): expose cache and i18n spec flags
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 12:43:06 +00:00
Virgil
c4743a527e refactor(cmd/api): fail fast on sdk generator availability
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 09:15:03 +00:00
Virgil
c383d85923 refactor(cmd/api): centralize spec builder config
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 09:04:30 +00:00
Virgil
d225fd3178 feat(api): add openapi info summary support
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 08:16:56 +00:00
Virgil
be7616d437 fix(cmd/api): normalise spec export formats
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 08:12:47 +00:00
Virgil
e6f2d1286b refactor(cmd/api): centralise spec builder config
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 08:08:56 +00:00
Virgil
8d92ee29d4 docs(cmd/api): add AX usage example to AddAPICommands
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 08:03:24 +00:00
Virgil
8149b0abf2 refactor(api): centralise spec group iterator
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 07:57:58 +00:00
Virgil
ed5822058d refactor(api): streamline spec export paths
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 07:54:27 +00:00
Virgil
87a973a83e feat(cmd/api): add SDK security scheme parity
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 07:31:45 +00:00
Virgil
bc6a9ea0a7 feat(cmd): expose spec security schemes
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 07:26:36 +00:00
Virgil
30e610686b refactor(cmd/api): remove redundant sdk spec slice helper
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 06:47:59 +00:00
Virgil
b8fd020bb2 refactor(cmd/api): thread swagger path through sdk spec builder
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 06:26:01 +00:00
Virgil
d9ccd7c49a feat(openapi): export swagger ui path metadata
Preserve the Swagger UI mount path in generated OpenAPI output and expose it through the spec and sdk CLI builders.\n\nCo-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 03:16:08 +00:00
Virgil
8e28b0209c feat(cmd/api): add GraphQL playground spec flag
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 02:42:42 +00:00
Virgil
f0b2d8b248 feat(cmd/api): expose runtime spec metadata flags
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 02:39:02 +00:00
Virgil
1fb55c9515 fix(cmd/api): use CLI context for SDK generation
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 02:13:17 +00:00
Virgil
b4d414b702 feat(cmd/api): add SSE path spec flags
Wire "--sse-path" through the spec and SDK generators so standalone OpenAPI output can document the SSE endpoint alongside GraphQL.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 01:55:13 +00:00
Virgil
2c87fa02cb feat(cmd/api): add GraphQL path to spec generation
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-02 00:21:20 +00:00
Virgil
14eedd7f91 feat(cmd/api): dedupe sdk spec groups 2026-04-01 23:18:19 +00:00
Virgil
a89a70851f fix(api): deduplicate spec iterator groups
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-01 22:28:34 +00:00
Virgil
ec7391cb06 feat(api): add iterator-backed spec export
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-01 22:25:07 +00:00
Virgil
bb7d88f3ce feat(openapi): add external docs metadata
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-01 20:47:38 +00:00
Virgil
4d7f3a9f99 feat(openapi): add terms of service metadata
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-01 20:44:01 +00:00
Virgil
a589d3bac6 feat(api): add OpenAPI contact metadata
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-01 20:35:08 +00:00
Virgil
d45ee6598e feat(api): expose swagger licence metadata in CLI 2026-04-01 20:30:02 +00:00
Virgil
862604dc22 feat(api): expose SDK spec metadata flags
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-01 19:09:59 +00:00
Virgil
3b26a15048 feat(api): register CLI spec groups 2026-04-01 18:29:45 +00:00
Virgil
19838779ef feat(api): normalize CLI list arguments
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-01 16:31:22 +00:00
Virgil
321ced1a36 feat(api): add OpenAPI server metadata
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-01 15:13:39 +00:00
Virgil
1c9e4891e7 feat(api): add spec description flag
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-01 07:02:28 +00:00
Claude
ca9b495884
chore: migrate to dappco.re vanity import path
Change module path from forge.lthn.ai/core/api to dappco.re/go/core/api.
Update all Go imports accordingly:
- forge.lthn.ai/core/api -> dappco.re/go/core/api
- forge.lthn.ai/core/go-io -> dappco.re/go/core/io
- forge.lthn.ai/core/go-log -> dappco.re/go/core/log

forge.lthn.ai/core/cli left as-is (not yet migrated).
Local replace directives added for dappco.re paths until vanity
URL server is configured.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 23:50:37 +00:00
Snider
d510af404d refactor(api): replace fmt.Errorf and os.* with coreerr.E and coreio.Local
Replace all fmt.Errorf/errors.New in production code with coreerr.E() from
go-log. Replace os.MkdirAll with coreio.Local.EnsureDir and os.Remove with
coreio.Local.Delete. Promote go-io and go-log to direct dependencies in go.mod.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-16 21:49:02 +00:00
Snider
753812ad57 feat(api): merge go-api + php-api into polyglot repo
Go source at root level (Option B), PHP under src/php/.
Module path: forge.lthn.ai/core/api
Package name: lthn/api

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-14 10:03:29 +00:00