Compare commits
4
Commits
v0.1.0
...
a2f8451135
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a2f8451135 | ||
|
|
39a38bfd74 | ||
|
|
3018bae23e | ||
|
|
f533bb107c |
@@ -0,0 +1,17 @@
|
|||||||
|
# Нормализация переводов строк: в репозитории — LF.
|
||||||
|
* text=auto eol=lf
|
||||||
|
|
||||||
|
*.go text eol=lf
|
||||||
|
*.md text eol=lf
|
||||||
|
*.mod text eol=lf
|
||||||
|
*.sum text eol=lf
|
||||||
|
*.yml text eol=lf
|
||||||
|
*.yaml text eol=lf
|
||||||
|
*.json text eol=lf
|
||||||
|
|
||||||
|
# Бинарные типы (на будущее) — не трогаем.
|
||||||
|
*.png binary
|
||||||
|
*.jpg binary
|
||||||
|
*.jpeg binary
|
||||||
|
*.gif binary
|
||||||
|
*.webp binary
|
||||||
+17
-4
@@ -1,7 +1,11 @@
|
|||||||
name: ci
|
name: ci
|
||||||
|
|
||||||
# Гейт качества на PR и push в main: vet, тесты с race-детектором, линт,
|
# Гейт качества на PR и push в main: vet, тесты с race-детектором, линт,
|
||||||
# gofmt и карантин зависимостей тулкита.
|
# gofmt, go mod tidy и карантин зависимостей тулкита.
|
||||||
|
#
|
||||||
|
# ВАЖНО: job-контейнер golang:1.27 не содержит Node.js, поэтому
|
||||||
|
# actions/checkout (Node-action) в нём не работает — checkout делается
|
||||||
|
# вручную через git.
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
push:
|
push:
|
||||||
@@ -12,7 +16,10 @@ jobs:
|
|||||||
runs-on: backend
|
runs-on: backend
|
||||||
container: golang:1.27
|
container: golang:1.27
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: checkout
|
||||||
|
run: |
|
||||||
|
git clone "https://x-access-token:${{ github.token }}@git.totmin.ru/${{ github.repository }}.git" .
|
||||||
|
git checkout -q "${{ github.sha }}"
|
||||||
- name: vet
|
- name: vet
|
||||||
run: go vet ./...
|
run: go vet ./...
|
||||||
- name: test (race)
|
- name: test (race)
|
||||||
@@ -22,7 +29,10 @@ jobs:
|
|||||||
runs-on: backend
|
runs-on: backend
|
||||||
container: golang:1.27
|
container: golang:1.27
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: checkout
|
||||||
|
run: |
|
||||||
|
git clone "https://x-access-token:${{ github.token }}@git.totmin.ru/${{ github.repository }}.git" .
|
||||||
|
git checkout -q "${{ github.sha }}"
|
||||||
- name: install golangci-lint
|
- name: install golangci-lint
|
||||||
run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.13.2
|
run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.13.2
|
||||||
- name: lint
|
- name: lint
|
||||||
@@ -31,11 +41,14 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
unformatted=$(gofmt -l .)
|
unformatted=$(gofmt -l .)
|
||||||
[ -z "$unformatted" ] || { echo "gofmt: требуется форматирование: $unformatted"; exit 1; }
|
[ -z "$unformatted" ] || { echo "gofmt: требуется форматирование: $unformatted"; exit 1; }
|
||||||
|
- name: go mod tidy check
|
||||||
|
run: go mod tidy -diff
|
||||||
- name: toolkit dependency quarantine
|
- name: toolkit dependency quarantine
|
||||||
run: |
|
run: |
|
||||||
direct=$(go list -m -f '{{if not .Main}}{{if not .Indirect}}{{.Path}}{{end}}{{end}}' all)
|
direct=$(go list -m -f '{{if not .Main}}{{if not .Indirect}}{{.Path}}{{end}}{{end}}' all)
|
||||||
allowed='^(github.com/modelcontextprotocol/go-sdk|gopkg.in/yaml.v3|github.com/BurntSushi/toml)$'
|
allowed='^(github.com/modelcontextprotocol/go-sdk|gopkg.in/yaml.v3|github.com/BurntSushi/toml)$'
|
||||||
bad=$(echo "$direct" | grep -vE "$allowed" | grep -v '^$')
|
bad=$(echo "$direct" | grep -vE "$allowed" | grep -v '^$' || true)
|
||||||
if [ -n "$bad" ]; then
|
if [ -n "$bad" ]; then
|
||||||
echo "недопустимые прямые зависимости:"; echo "$bad"; exit 1
|
echo "недопустимые прямые зависимости:"; echo "$bad"; exit 1
|
||||||
fi
|
fi
|
||||||
|
echo "toolkit-deps: ok"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
GO ?= go
|
GO ?= go
|
||||||
GOLANGCI_LINT ?= golangci-lint
|
GOLANGCI_LINT ?= golangci-lint
|
||||||
|
|
||||||
.PHONY: test test-fast lint fmt tidy toolkit-deps ci
|
.PHONY: test test-fast lint fmt tidy tidy-check toolkit-deps ci
|
||||||
|
|
||||||
# Тесты с race-детектором (основной гейт).
|
# Тесты с race-детектором (основной гейт).
|
||||||
test:
|
test:
|
||||||
@@ -27,16 +27,21 @@ fmt:
|
|||||||
tidy:
|
tidy:
|
||||||
$(GO) mod tidy
|
$(GO) mod tidy
|
||||||
|
|
||||||
|
# Проверка, что go.mod/go.sum в tidy-состоянии (дрейф ловим в CI).
|
||||||
|
tidy-check:
|
||||||
|
@$(GO) mod tidy -diff >/dev/null 2>&1 || { echo "go.mod не tidy — запусти make tidy"; $(GO) mod tidy -diff; exit 1; }
|
||||||
|
@echo "tidy: ok"
|
||||||
|
|
||||||
# Карантин зависимостей: тулкит обязан оставаться stdlib + go-sdk
|
# Карантин зависимостей: тулкит обязан оставаться stdlib + go-sdk
|
||||||
# (+ yaml/toml в validate). Любая другая ПРЯМАЯ зависимость — ошибка.
|
# (+ yaml/toml в validate). Любая другая ПРЯМАЯ зависимость — ошибка.
|
||||||
toolkit-deps:
|
toolkit-deps:
|
||||||
@direct=$$($(GO) list -m -f '{{if not .Main}}{{if not .Indirect}}{{.Path}}{{end}}{{end}}' all); \
|
@direct=$$($(GO) list -m -f '{{if not .Main}}{{if not .Indirect}}{{.Path}}{{end}}{{end}}' all); \
|
||||||
allowed='^(github.com/modelcontextprotocol/go-sdk|gopkg.in/yaml.v3|github.com/BurntSushi/toml)$$'; \
|
allowed='^(github.com/modelcontextprotocol/go-sdk|gopkg.in/yaml.v3|github.com/BurntSushi/toml)$$'; \
|
||||||
bad=$$(echo "$$direct" | grep -vE "$$allowed" | grep -v '^$$'); \
|
bad=$$(echo "$$direct" | grep -vE "$$allowed" | grep -v '^$$' || true); \
|
||||||
if [ -n "$$bad" ]; then \
|
if [ -n "$$bad" ]; then \
|
||||||
echo "недопустимые прямые зависимости (разрешены только go-sdk/yaml/toml):"; \
|
echo "недопустимые прямые зависимости (разрешены только go-sdk/yaml/toml):"; \
|
||||||
echo "$$bad"; exit 1; \
|
echo "$$bad"; exit 1; \
|
||||||
fi; \
|
fi; \
|
||||||
echo "toolkit-deps: ok"
|
echo "toolkit-deps: ok"
|
||||||
|
|
||||||
ci: test lint toolkit-deps
|
ci: test lint tidy-check toolkit-deps
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ go 1.27.0
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/BurntSushi/toml v1.6.0
|
github.com/BurntSushi/toml v1.6.0
|
||||||
github.com/modelcontextprotocol/go-sdk v1.7.0
|
github.com/modelcontextprotocol/go-sdk v1.8.0
|
||||||
gopkg.in/yaml.v3 v3.0.1
|
gopkg.in/yaml.v3 v3.0.1
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ github.com/google/jsonschema-go v0.4.3 h1:/DBOLZTfDow7pe2GmaJNhltueGTtDKICi8V8p+
|
|||||||
github.com/google/jsonschema-go v0.4.3/go.mod h1:r5quNTdLOYEz95Ru18zA0ydNbBuYoo9tgaYcxEYhJVE=
|
github.com/google/jsonschema-go v0.4.3/go.mod h1:r5quNTdLOYEz95Ru18zA0ydNbBuYoo9tgaYcxEYhJVE=
|
||||||
github.com/modelcontextprotocol/go-sdk v1.7.0 h1:yqjY2dsbKAC0LSuWZVBMrHgiG8ukXv6NRo0JiALay44=
|
github.com/modelcontextprotocol/go-sdk v1.7.0 h1:yqjY2dsbKAC0LSuWZVBMrHgiG8ukXv6NRo0JiALay44=
|
||||||
github.com/modelcontextprotocol/go-sdk v1.7.0/go.mod h1:dL7u98E/zjJTGzEq+j30jQ8K2k1mb6LeAH4inEcSGts=
|
github.com/modelcontextprotocol/go-sdk v1.7.0/go.mod h1:dL7u98E/zjJTGzEq+j30jQ8K2k1mb6LeAH4inEcSGts=
|
||||||
|
github.com/modelcontextprotocol/go-sdk v1.8.0 h1:KIvahhYqwtbeniWVPs3TcXEA7b8jEtwfBpOTAI+Urx4=
|
||||||
|
github.com/modelcontextprotocol/go-sdk v1.8.0/go.mod h1:dL7u98E/zjJTGzEq+j30jQ8K2k1mb6LeAH4inEcSGts=
|
||||||
github.com/segmentio/asm v1.1.3 h1:WM03sfUOENvvKexOLp+pCqgb/WDjsi7EK8gIsICtzhc=
|
github.com/segmentio/asm v1.1.3 h1:WM03sfUOENvvKexOLp+pCqgb/WDjsi7EK8gIsICtzhc=
|
||||||
github.com/segmentio/asm v1.1.3/go.mod h1:Ld3L4ZXGNcSLRg4JBsZ3//1+f/TjYl0Mzen/DQy1EJg=
|
github.com/segmentio/asm v1.1.3/go.mod h1:Ld3L4ZXGNcSLRg4JBsZ3//1+f/TjYl0Mzen/DQy1EJg=
|
||||||
github.com/segmentio/encoding v0.5.4 h1:OW1VRern8Nw6ITAtwSZ7Idrl3MXCFwXHPgqESYfvNt0=
|
github.com/segmentio/encoding v0.5.4 h1:OW1VRern8Nw6ITAtwSZ7Idrl3MXCFwXHPgqESYfvNt0=
|
||||||
|
|||||||
+4
-2
@@ -7,8 +7,10 @@
|
|||||||
|
|
||||||
1. Скопируйте каталог и переименуйте модуль в `go.mod`
|
1. Скопируйте каталог и переименуйте модуль в `go.mod`
|
||||||
(`example.com/forge-tool` → ваш путь).
|
(`example.com/forge-tool` → ваш путь).
|
||||||
2. Замените доменную логику в `internal/tools/tools.go`.
|
2. Удалите из `go.mod` строку `replace git.totmin.ru/en2zmax/forge-toolkit => ..`
|
||||||
3. Соберите и проверьте:
|
(она нужна только для сборки внутри этого репозитория).
|
||||||
|
3. Замените доменную логику в `internal/tools/tools.go`.
|
||||||
|
4. Соберите и проверьте:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
go mod tidy
|
go mod tidy
|
||||||
|
|||||||
Reference in New Issue
Block a user