-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
290 lines (211 loc) · 11 KB
/
Copy pathMakefile
File metadata and controls
290 lines (211 loc) · 11 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
SHELL := /bin/bash
ROOT := $(shell git rev-parse --show-toplevel 2>/dev/null || pwd)
DEVRIG_ENV := $(ROOT)/.devrig/devrig.env
MODE ?= mock
AGENT ?= codex
ROLE ?= seller
LOGION_DEVRIG_API_BASE_URL ?=
.PHONY: lint dead-code dead-code-advisory test typecheck security audit secrets mock mock-stop install-hooks companion-verify companion-bundle companion-bundle-verify public-audit \
ci-checks check-generated-lock check-root-files check-deps-lock check-doc-links check-roadmap-mirror check-protocol-specs \
check-logion-sh-urls check-skip-reasons check-forbidden-imports check-cli-http \
check-installer-security \
update-generated-lock update-deps-lock \
agent-proving-ground-lint agent-proving-ground-typecheck agent-proving-ground-dead-code agent-proving-ground-test agent-proving-ground-verify \
agent-proving-ground-smoke agent-proving-ground-release \
release-manifest release-manifest-check version-bump-cli version-bump-client version-bump-companion build-check \
npm-test npm-pack npm-build \
install-sh-lint install-sh-test install-ps1-lint install-ps1-test install-test \
scanners-lint scanners-test social-lint social-test \
bootstrap dev-up dev-api doctor companion start-companion clean-companion \
dev-logs devrig-lint devrig-test dev-rebuild dev-rebuild-cli dev-rebuild-companion dev-rebuild-npm \
release-plan release release-dry-run release-store release-smoke-input
lint:
uv run ruff check packages/
uv run ruff format --check packages/
dead-code:
uv run vulture
dead-code-advisory:
uv run vulture --min-confidence 60 || true
test:
uv run pytest packages/ tests/ --no-header -q -m "not integration and not docker"
typecheck:
uv run mypy packages/cli/cli/ packages/client/src/ packages/scanners/logion_scanners/ --ignore-missing-imports
audit:
uv run pip-audit --skip-editable
bandit:
uv run bandit -c pyproject.toml -r packages
secrets:
uv run detect-secrets scan --baseline .secrets.baseline
security: audit bandit secrets
install-hooks:
git config core.hooksPath .githooks
@echo "Configured Git hooks path to .githooks"
mock:
@mkdir -p .devrig
@if [ -f .prism.pid ] && kill -0 $$(cat .prism.pid) 2>/dev/null; then \
echo "Prism mock already running on http://127.0.0.1:4010"; \
else \
npx @stoplight/prism-cli mock contracts/openapi/v1.json --port 4010 > .devrig/prism.log 2>&1 & echo $$! > .prism.pid; \
echo "Started Prism mock on http://127.0.0.1:4010 (log: .devrig/prism.log)"; \
fi
mock-stop:
@if [ -f .prism.pid ]; then kill $$(cat .prism.pid) 2>/dev/null || true; rm -f .prism.pid; fi
public-audit:
uv run python scripts/audit_public_safe.py
check-generated-lock:
uv run python scripts/check_generated_lock.py
check-root-files:
uv run python scripts/check_root_files.py
check-deps-lock:
uv run python scripts/check_deps_lock.py
check-doc-links:
uv run python scripts/check_doc_links.py
check-roadmap-mirror:
uv run python scripts/check_roadmap_mirror.py
check-protocol-specs:
uv run python scripts/check_protocol_specs.py
check-logion-sh-urls:
uv run python scripts/check_logion_sh_urls.py
check-skip-reasons:
uv run python scripts/check_pytest_skip_reasons.py
check-forbidden-imports:
uv run python scripts/check_forbidden_imports.py
check-cli-http:
uv run python scripts/check_cli_http.py
check-installer-security:
python3 scripts/check_installer_security.py
# Umbrella target: every static guardrail. Fast (<1s total). Runs in
# CI and as part of the pre-commit hook. Slower checks (test, mypy,
# ruff, security audit) stay separate so this stays cheap.
ci-checks: public-audit check-generated-lock check-root-files check-deps-lock check-roadmap-mirror check-protocol-specs \
check-doc-links check-logion-sh-urls check-skip-reasons \
check-forbidden-imports check-cli-http check-installer-security
update-generated-lock:
uv run python scripts/check_generated_lock.py --update
update-deps-lock:
uv run python scripts/check_deps_lock.py --update
companion-verify:
uv run make -C packages/agent-companion verify
release-manifest:
uv run python scripts/release_manifest.py build --channel stable
release-manifest-check:
uv run python scripts/release_manifest.py check --in releases/manifest-stable.json
npm-test:
cd packages/npm-wrapper && npm test
npm-pack:
cd packages/npm-wrapper && npm pack
npm-build:
cd packages/npm-wrapper && npm ci --ignore-scripts && npm run build && node dist/scripts/version-from-manifest.js && npm pack --dry-run && git checkout package.json
version-bump-cli:
uv run semantic-release -c packages/cli/pyproject.toml version
version-bump-client:
uv run semantic-release -c packages/client/pyproject.toml version
version-bump-companion:
uv run semantic-release -c packages/agent-companion/pyproject.toml version
build-check:
rm -rf dist/
uv run python packages/cli/scripts/sync_docs.py
uv build --package logion-cli --wheel --sdist
uv build --package logion-client --wheel --sdist
uv run twine check dist/*
@echo "✅ Build check passed"
install-sh-lint: check-installer-security
shellcheck -s sh -x -e SC1091 scripts/install.sh scripts/install_lib.sh scripts/install_test/harness.sh
install-sh-test: install-sh-lint
bats tests/install/test_install_sh.bats tests/install/test_install_lib.bats
install-ps1-lint:
pwsh -NoLogo -NoProfile -Command '$$paths = @("scripts/install.ps1", "scripts/install_lib.ps1", "tests/install/test_install_ps1.Tests.ps1"); foreach ($$path in $$paths) { Invoke-ScriptAnalyzer -Path $$path -Severity Error -EnableExit; Invoke-ScriptAnalyzer -Path $$path -IncludeRule PSAvoidUsingInvokeExpression -EnableExit }'
install-ps1-test: install-ps1-lint
pwsh -NoLogo -NoProfile -Command 'if (-not $$env:TEMP) { $$env:TEMP = if ($$env:TMPDIR) { $$env:TMPDIR } else { [System.IO.Path]::GetTempPath() } }; $$out = Join-Path $$env:TEMP "logion-pester-results.xml"; Invoke-Pester -Path tests/install/test_install_ps1.Tests.ps1 -EnableExit -OutputFile $$out -OutputFormat NUnitXml'
install-test: install-sh-test install-ps1-test
companion-bundle:
uv run python packages/agent-companion/scripts/package_skill.py build --out dist/ --version $(shell python -c "import tomllib,pathlib; print(tomllib.loads(pathlib.Path('packages/agent-companion/pyproject.toml').read_text())['project']['version'])") --release
companion-bundle-verify:
uv run python packages/agent-companion/scripts/verify_bundle.py dist/logion-marketplace-companion-$(shell python -c "import tomllib,pathlib; print(tomllib.loads(pathlib.Path('packages/agent-companion/pyproject.toml').read_text())['project']['version'])").tar.gz
# ── scanners package targets ──────────────────────────────────
scanners-lint:
uv run ruff check packages/scanners/
uv run ruff format --check packages/scanners/
scanners-test:
uv run pytest packages/scanners/tests/ -q --no-header -m "not docker"
scanners-test-integration:
uv run pytest packages/scanners/tests/ -q --no-header -m docker
# ── social-management package targets ─────────────────────────
social-lint:
uv run ruff check packages/social-management/
uv run ruff format --check packages/social-management/
social-typecheck:
uv run mypy packages/social-management/ --ignore-missing-imports
social-test:
uv run pytest packages/social-management/tests/ -q --no-header
social-arch:
uv run pytest packages/social-management/tests/test_social_architecture.py -q --no-header
# ── agent-proving-ground package targets ───────────────────────
agent-proving-ground-lint:
uv run ruff check packages/agent-proving-ground/
uv run ruff format --check packages/agent-proving-ground/
agent-proving-ground-typecheck:
uv run mypy --config-file packages/agent-proving-ground/pyproject.toml packages/agent-proving-ground/agent_proving_ground
agent-proving-ground-dead-code:
uv run vulture packages/agent-proving-ground/agent_proving_ground packages/agent-proving-ground/tests --min-confidence 80
agent-proving-ground-test:
uv run pytest packages/agent-proving-ground/tests/ -q --no-header
agent-proving-ground-verify: agent-proving-ground-lint agent-proving-ground-typecheck agent-proving-ground-dead-code agent-proving-ground-test
# Real-agent proving-ground runs. Preconditions:
# make dev-up MODE=mock|prod ROLE=... (writes .devrig/devrig.env)
# make doctor AGENT=...
# Override the driver with LOGION_PROVING_GROUND_AGENT_DRIVER=opencode etc.
LOGION_PROVING_GROUND_AGENT_DRIVER ?= codex
agent-proving-ground-smoke:
uv run logion-agent-proving-ground run builtin:skill_report_contract \
--api-adapter local-devrig \
--devrig-root $(ROOT) \
--agent-driver $(LOGION_PROVING_GROUND_AGENT_DRIVER) \
--out .runs/proving-ground/smoke
agent-proving-ground-release:
uv run logion-agent-proving-ground run builtin:marketplace_loop \
--api-adapter local-devrig \
--devrig-root $(ROOT) \
--agent-driver $(LOGION_PROVING_GROUND_AGENT_DRIVER) \
--out .runs/proving-ground/release
bootstrap: install-hooks
uv sync --all-packages --all-groups
uv run python scripts/devrig.py bootstrap
dev-up:
uv run python scripts/devrig.py env --mode $(MODE) --role $(ROLE) $(if $(LOGION_DEVRIG_API_BASE_URL),--api-base-url $(LOGION_DEVRIG_API_BASE_URL),) --write $(DEVRIG_ENV)
@if [ "$(MODE)" = "mock" ]; then $(MAKE) mock; else echo "Using production API via personal Logion account"; fi
dev-api:
@if [ "$(MODE)" = "prod" ]; then \
uv run python scripts/devrig.py env --mode prod --role $(ROLE) $(if $(LOGION_DEVRIG_API_BASE_URL),--api-base-url $(LOGION_DEVRIG_API_BASE_URL),) --write $(DEVRIG_ENV); \
echo "Production mode does not start a local API. Current base URL:"; \
grep LOGION_BASE_URL $(DEVRIG_ENV); \
else \
npx @stoplight/prism-cli mock contracts/openapi/v1.json --port 4010; \
fi
doctor:
uv run python scripts/devrig.py doctor --env-file $(DEVRIG_ENV) --agent $(AGENT)
companion:
uv run python scripts/devrig.py companion --env-file $(DEVRIG_ENV) --agent $(AGENT) --role $(ROLE)
start-companion:
uv run python scripts/devrig.py launch --env-file $(DEVRIG_ENV) --agent $(AGENT) --role $(ROLE)
clean-companion:
uv run python scripts/devrig.py clean
dev-logs:
@if [ -f .devrig/prism.log ]; then tail -f .devrig/prism.log; else echo "No Prism log yet at .devrig/prism.log"; fi
devrig-lint: lint
devrig-test: test
dev-rebuild: bootstrap clean-companion companion
dev-rebuild-cli: bootstrap
dev-rebuild-companion: clean-companion companion
dev-rebuild-npm: npm-build
# ── release orchestration targets ───────────────────────────────
release-plan:
uv run python scripts/release_orchestrator.py plan --version $(VERSION)
release:
uv run python scripts/release_orchestrator.py release --version $(VERSION) $(if $(PUBLISH_STORE),--publish-store,)
release-dry-run:
uv run python scripts/release_orchestrator.py release --version $(VERSION) --dry-run $(if $(PUBLISH_STORE),--publish-store,)
release-store:
uv run python scripts/release_store.py publish-companion --version $(VERSION) --course-id 5ddf32c6-e139-4056-ac94-c4a231bfd932
release-smoke-input:
uv run python scripts/release_smoke.py workflow-input --version $(VERSION)