Skip to content

Commit 4b0e4df

Browse files
febrinandafebrinanda
authored andcommitted
Initial corekit seed
0 parents  commit 4b0e4df

7 files changed

Lines changed: 102 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-go@v5
14+
with:
15+
go-version: "1.24.x"
16+
- name: Test
17+
run: go test ./...

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules/
2+
.build/
3+
.wrangler/
4+
.DS_Store
5+
dist/
6+
.env
7+
.env.*

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Febrinanda and CoreBlow contributors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# CoreKit
2+
3+
Shared CoreBlow local-first toolkit.
4+
5+
CoreKit holds small reusable building blocks for CoreBlow companion apps and services. It follows the OpenClaw `crawlkit` split pattern while keeping CoreBlow's naming and enterprise-oriented boundaries.
6+
7+
## Scope
8+
9+
- Normalize local endpoint descriptors.
10+
- Keep shared client helpers independent from the core runtime.
11+
- Provide stable primitives for app, desktop, and automation repos.
12+
13+
## Development
14+
15+
```sh
16+
go test ./...
17+
```

corekit.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package corekit
2+
3+
import "strings"
4+
5+
type Endpoint struct {
6+
Name string
7+
URL string
8+
}
9+
10+
func NormalizeEndpoint(endpoint Endpoint) Endpoint {
11+
return Endpoint{
12+
Name: strings.TrimSpace(endpoint.Name),
13+
URL: strings.TrimRight(strings.TrimSpace(endpoint.URL), "/"),
14+
}
15+
}
16+
17+
func IsLocal(endpoint Endpoint) bool {
18+
normalized := NormalizeEndpoint(endpoint)
19+
return strings.HasPrefix(normalized.URL, "http://127.0.0.1") ||
20+
strings.HasPrefix(normalized.URL, "http://localhost")
21+
}

corekit_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package corekit
2+
3+
import "testing"
4+
5+
func TestNormalizeEndpoint(t *testing.T) {
6+
got := NormalizeEndpoint(Endpoint{Name: " gateway ", URL: " http://localhost:3000/ "})
7+
if got.Name != "gateway" || got.URL != "http://localhost:3000" {
8+
t.Fatalf("unexpected endpoint: %#v", got)
9+
}
10+
}
11+
12+
func TestIsLocal(t *testing.T) {
13+
if !IsLocal(Endpoint{URL: "http://127.0.0.1:3000"}) {
14+
t.Fatal("expected loopback endpoint to be local")
15+
}
16+
}

go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module github.com/coreblow/corekit
2+
3+
go 1.24

0 commit comments

Comments
 (0)