forked from MoonshotAI/kimi-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
140 lines (128 loc) · 6.88 KB
/
Makefile
File metadata and controls
140 lines (128 loc) · 6.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
.DEFAULT_GOAL := prepare
.PHONY: help
help: ## Show available make targets.
@echo "Available make targets:"
@awk 'BEGIN { FS = ":.*## " } /^[A-Za-z0-9_.-]+:.*## / { printf " %-20s %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
.PHONY: install-prek
install-prek: ## Install prek and repo git hooks.
@echo "==> Installing prek"
@uv tool install prek
@echo "==> Installing git hooks with prek"
@uv tool run prek install
.PHONY: prepare
prepare: download-deps install-prek ## Sync dependencies for all workspace packages and install prek hooks.
@echo "==> Syncing dependencies for all workspace packages"
@uv sync --frozen --all-extras --all-packages
.PHONY: prepare-build
prepare-build: download-deps ## Sync dependencies for releases without workspace sources.
@echo "==> Syncing dependencies for release builds (no sources)"
@uv sync --all-extras --all-packages --no-sources
.PHONY: format format-kimi-cli format-kosong format-pykaos format-kimi-sdk format-web
format: format-kimi-cli format-kosong format-pykaos format-kimi-sdk format-web ## Auto-format all workspace packages.
format-kimi-cli: ## Auto-format Kimi Code CLI sources with ruff.
@echo "==> Formatting Kimi Code CLI sources"
@uv run ruff check --fix
@uv run ruff format
format-kosong: ## Auto-format kosong sources with ruff.
@echo "==> Formatting kosong sources"
@uv run --project packages/kosong --directory packages/kosong ruff check --fix
@uv run --project packages/kosong --directory packages/kosong ruff format
format-pykaos: ## Auto-format pykaos sources with ruff.
@echo "==> Formatting pykaos sources"
@uv run --project packages/kaos --directory packages/kaos ruff check --fix
@uv run --project packages/kaos --directory packages/kaos ruff format
format-kimi-sdk: ## Auto-format kimi-sdk sources with ruff.
@echo "==> Formatting kimi-sdk sources"
@uv run --project sdks/kimi-sdk --directory sdks/kimi-sdk ruff check --fix
@uv run --project sdks/kimi-sdk --directory sdks/kimi-sdk ruff format
format-web: ## Auto-format web sources with npm run format.
@echo "==> Formatting web sources"
@if command -v npm >/dev/null 2>&1; then \
npm --prefix web run format; \
else \
echo "npm not found. Install Node.js (npm) to run web formatting."; \
exit 1; \
fi
.PHONY: check check-kimi-cli check-kosong check-pykaos check-kimi-sdk
check: check-kimi-cli check-kosong check-pykaos check-kimi-sdk ## Run linting and type checks for all packages.
check-kimi-cli: ## Run linting and type checks for Kimi Code CLI.
@echo "==> Checking Kimi Code CLI (ruff + pyright + ty; ty is non-blocking)"
@uv run ruff check
@uv run ruff format --check
@uv run pyright
@uv run ty check || true
check-kosong: ## Run linting and type checks for kosong.
@echo "==> Checking kosong (ruff + pyright + ty; ty is non-blocking)"
@uv run --project packages/kosong --directory packages/kosong ruff check
@uv run --project packages/kosong --directory packages/kosong ruff format --check
@uv run --project packages/kosong --directory packages/kosong pyright
@uv run --project packages/kosong --directory packages/kosong ty check || true
check-pykaos: ## Run linting and type checks for pykaos.
@echo "==> Checking pykaos (ruff + pyright + ty; ty is non-blocking)"
@uv run --project packages/kaos --directory packages/kaos ruff check
@uv run --project packages/kaos --directory packages/kaos ruff format --check
@uv run --project packages/kaos --directory packages/kaos pyright
@uv run --project packages/kaos --directory packages/kaos ty check || true
check-kimi-sdk: ## Run linting and type checks for kimi-sdk.
@echo "==> Checking kimi-sdk (ruff + pyright + ty; ty is non-blocking)"
@uv run --project sdks/kimi-sdk --directory sdks/kimi-sdk ruff check
@uv run --project sdks/kimi-sdk --directory sdks/kimi-sdk ruff format --check
@uv run --project sdks/kimi-sdk --directory sdks/kimi-sdk pyright
@uv run --project sdks/kimi-sdk --directory sdks/kimi-sdk ty check || true
.PHONY: test test-kimi-cli test-kosong test-pykaos test-kimi-sdk
test: test-kimi-cli test-kosong test-pykaos test-kimi-sdk ## Run all test suites.
test-kimi-cli: ## Run Kimi Code CLI tests.
@echo "==> Running Kimi Code CLI tests"
@uv run pytest tests -vv
@uv run pytest tests_e2e -vv
test-kosong: ## Run kosong tests (including doctests).
@echo "==> Running kosong tests"
@uv run --project packages/kosong --directory packages/kosong pytest --doctest-modules -vv
test-pykaos: ## Run pykaos tests.
@echo "==> Running pykaos tests"
@uv run --project packages/kaos --directory packages/kaos pytest tests -vv
test-kimi-sdk: ## Run kimi-sdk tests.
@echo "==> Running kimi-sdk tests"
@uv run --project sdks/kimi-sdk --directory sdks/kimi-sdk pytest tests -vv
.PHONY: build build-kimi-cli build-kosong build-pykaos build-kimi-sdk build-bin build-bin-onedir
build: build-web build-kimi-cli build-kosong build-pykaos build-kimi-sdk ## Build Python packages for release.
build-kimi-cli: build-web ## Build the kimi-cli and kimi-code sdists and wheels.
@echo "==> Building kimi-cli distributions"
@uv build --package kimi-cli --no-sources --out-dir dist
@echo "==> Building kimi-code distributions"
@uv build --package kimi-code --no-sources --out-dir dist
build-kosong: ## Build the kosong sdist and wheel.
@echo "==> Building kosong distributions"
@uv build --package kosong --no-sources --out-dir dist/kosong
build-pykaos: ## Build the pykaos sdist and wheel.
@echo "==> Building pykaos distributions"
@uv build --package pykaos --no-sources --out-dir dist/pykaos
build-kimi-sdk: ## Build the kimi-sdk sdist and wheel.
@echo "==> Building kimi-sdk distributions"
@uv build --package kimi-sdk --no-sources --out-dir dist/kimi-sdk
build-web: ## Build web UI and sync into kimi-cli package.
@echo "==> Building web UI"
@uv run scripts/build_web.py
build-bin: build-web ## Build the standalone executable with PyInstaller (one-file mode).
@echo "==> Building PyInstaller binary (one-file)"
@uv run pyinstaller kimi.spec
@mkdir -p dist/onefile
@if [ -f dist/kimi.exe ]; then mv dist/kimi.exe dist/onefile/; elif [ -f dist/kimi ]; then mv dist/kimi dist/onefile/; fi
build-bin-onedir: build-web ## Build the standalone executable with PyInstaller (one-dir mode).
@echo "==> Building PyInstaller binary (one-dir)"
@rm -rf dist/onedir dist/kimi
@uv run pyinstaller kimi.spec
@if [ -f dist/kimi/kimi-exe.exe ]; then mv dist/kimi/kimi-exe.exe dist/kimi/kimi.exe; elif [ -f dist/kimi/kimi-exe ]; then mv dist/kimi/kimi-exe dist/kimi/kimi; fi
@mkdir -p dist/onedir && mv dist/kimi dist/onedir/
.PHONY: ai-test
ai-test: ## Run the test suite with Kimi Code CLI.
@echo "==> Running AI test suite"
@uv run tests_ai/scripts/run.py tests_ai
.PHONY: gen-changelog gen-docs
gen-changelog: ## Generate changelog with Kimi Code CLI.
@echo "==> Generating changelog"
@uv run kimi --yolo --prompt /skill:gen-changelog
gen-docs: ## Generate user docs with Kimi Code CLI.
@echo "==> Generating user docs"
@uv run kimi --yolo --prompt /skill:gen-docs
include src/kimi_cli/deps/Makefile