-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·267 lines (221 loc) · 7.33 KB
/
Copy pathMakefile
File metadata and controls
executable file
·267 lines (221 loc) · 7.33 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
.PHONY: help install install-dev install-docs install-llm install-security install-all test test-cov lint format type-check check-deps security-check docs serve clean check pre-commit install-hooks update outdated build publish run info env debug
# Colors
GREEN := $(shell tput -Txterm setaf 2)
YELLOW := $(shell tput -Txterm setaf 3)
WHITE := $(shell tput -Txterm setaf 7)
RESET := $(shell tput -Txterm sgr0)
TARGET_MAX_CHAR_NUM=20
# Default target
.DEFAULT_GOAL := help
## Show help
help:
@echo ''
@echo '${YELLOW}TaskGuard Development Commands${RESET}'
@echo ''
@echo 'Usage:'
@echo ' ${YELLOW}make${RESET} ${GREEN}<target>${RESET}'
@echo ''
@echo 'Targets:'
@awk '/^[a-zA-Z\-\_0-9]+:/ { \
helpMessage = match(lastLine, /^## (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":")-1); \
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
printf " ${YELLOW}%-$(TARGET_MAX_CHAR_NUM)s${RESET} ${GREEN}%s${RESET}\n", helpCommand, helpMessage; \
} \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)
## Install the package in development mode
install:
pip install -e .
## Install development dependencies
install-dev:
pip install -e ".[dev]"
## Install documentation dependencies
install-docs:
pip install -e ".[docs]"
## Install LLM dependencies
install-llm:
pip install -e ".[llm]"
## Install security dependencies
install-security:
pip install -e ".[security]"
## Install all dependencies
install-all:
pip install -e ".[all]"
## Run tests
test:
python -m pytest tests/ -v
## Run tests with coverage report
test-cov:
python -m pytest --cov=taskguard --cov-report=term-missing --cov-report=html tests/
## Run linter
lint:
@echo "${YELLOW}Running flake8...${RESET}"
flake8 src/taskguard tests/
@echo "${YELLOW}Running black check...${RESET}"
black --check src/taskguard tests/
@echo "${YELLOW}Running isort check...${RESET}"
isort --check-only src/taskguard tests/
## Format code
format:
@echo "${YELLOW}Formatting code with black...${RESET}"
black src/taskguard tests/
@echo "${YELLOW}Sorting imports with isort...${RESET}"
isort src/taskguard tests/
## Run type checking
type-check:
@echo "${YELLOW}Running mypy...${RESET}"
mypy src/taskguard/
## Check for security vulnerabilities
security-check:
@echo "${YELLOW}Running bandit...${RESET}"
bandit -r src/taskguard/
@echo "${YELLOW}Running safety check...${RESET}"
safety check
## Build documentation
docs:
@echo "${YELLOW}Building documentation...${RESET}"
@if command -v mkdocs >/dev/null 2>&1; then \
mkdocs build --clean; \
else \
echo "${YELLOW}mkdocs not installed. Install with: pip install mkdocs mkdocs-material${RESET}"; \
fi
## Serve documentation locally
serve:
@echo "${YELLOW}Serving documentation at http://localhost:8000${RESET}"
@if command -v mkdocs >/dev/null 2>&1; then \
mkdocs serve; \
else \
echo "${YELLOW}mkdocs not installed. Install with: pip install mkdocs mkdocs-material${RESET}"; \
fi
## Clean up build artifacts
clean:
@echo "${YELLOW}Cleaning build artifacts...${RESET}"
rm -rf build/ dist/ *.egg-info .pytest_cache/ .mypy_cache/ .coverage htmlcov/ site/
find . -type d -name __pycache__ -exec rm -rf {} +
find . -type f -name "*.pyc" -delete
## Run all checks
check: lint type-check test-cov security-check
@echo "${GREEN}All checks passed!${RESET}"
## Prepare for commit (format, lint, test)
pre-commit: format lint test
@echo "${GREEN}Ready for commit!${RESET}"
## Install pre-commit hooks
install-hooks:
@if command -v pre-commit >/dev/null 2>&1; then \
pre-commit install; \
else \
echo "${YELLOW}pre-commit not installed. Installing...${RESET}"; \
pip install pre-commit; \
pre-commit install; \
fi
## Update dependencies
update:
pip install --upgrade pip
pip install --upgrade -e ".[all]"
## Show outdated dependencies
outdated:
pip list --outdated
## Build package
build:
@echo "${YELLOW}Building package...${RESET}"
python -m build
## Publish to PyPI (test)
publish-test:
@echo "${YELLOW}Publishing to Test PyPI...${RESET}"
python -m twine upload --repository testpypi dist/*
## Publish to PyPI
publish:
@echo "${YELLOW}Publishing to PyPI...${RESET}"
python -m twine upload dist/*
## Run the application
run:
@echo "${YELLOW}Running TaskGuard...${RESET}"
python -m taskguard.cli
## Run TaskGuard with arguments
run-args:
@echo "${YELLOW}Running TaskGuard with args: $(ARGS)${RESET}"
python -m taskguard.cli $(ARGS)
## Show package info
info:
@echo "${YELLOW}Package Information:${RESET}"
@python -c "import taskguard; print(f'Version: {taskguard.__version__}')"
@python -c "import taskguard; print(f'Description: {taskguard.__description__}')"
@python -c "import taskguard; taskguard.system_info()"
## Show environment info
env:
@echo "${YELLOW}Environment Information:${RESET}"
@echo "Python: $(shell python --version)"
@echo "Pip: $(shell pip --version)"
@echo "Python Path: $(shell which python)"
@echo "TaskGuard installed: $(shell pip show taskguard >/dev/null 2>&1 && echo 'Yes' || echo 'No')"
## Show debug information
debug:
@echo "${YELLOW}Debug Information:${RESET}"
@echo "PYTHONPATH: $(PYTHONPATH)"
@echo "PWD: $(PWD)"
@echo "Shell: $(SHELL)"
@echo "User: $(USER)"
@echo "Python executable: $(shell which python)"
@echo "Pip executable: $(shell which pip)"
@echo "TaskGuard module location:"
@python -c "try: import taskguard; print(taskguard.__file__); except ImportError: print('Not installed')"
## Initialize TaskGuard project
init:
@echo "${YELLOW}Initializing TaskGuard project...${RESET}"
python -m taskguard.cli init
## Setup shell integration
setup-shell:
@echo "${YELLOW}Setting up shell integration...${RESET}"
python -m taskguard.cli setup shell
@echo "${GREEN}Shell integration ready! Run: source ~/.llmtask_shell.sh${RESET}"
## Setup with Ollama
setup-ollama:
@echo "${YELLOW}Setting up Ollama...${RESET}"
python -m taskguard.cli setup ollama
## Test LLM connection
test-llm:
@echo "${YELLOW}Testing LLM connection...${RESET}"
python -m taskguard.cli test-llm
## Show TaskGuard status
status:
@echo "${YELLOW}TaskGuard Status:${RESET}"
python -m taskguard.cli status
## Show TaskGuard tasks
tasks:
@echo "${YELLOW}Current Tasks:${RESET}"
python -m taskguard.cli show-tasks
## Run smart analysis
analyze:
@echo "${YELLOW}Running AI analysis...${RESET}"
python -m taskguard.cli smart-analysis
## Show TaskGuard help
taskguard-help:
python -m taskguard.cli --help
## Development setup (install + setup shell + test)
dev-setup: install-dev setup-shell
@echo "${GREEN}Development environment ready!${RESET}"
@echo "Next steps:"
@echo "1. source ~/.llmtask_shell.sh"
@echo "2. make tasks"
@echo "3. Start coding!"
## Production setup (install + setup everything)
prod-setup: install-all setup-shell setup-ollama
@echo "${GREEN}Production environment ready!${RESET}"
## Full test suite
test-all: clean install-dev test-cov lint type-check security-check
@echo "${GREEN}All tests completed!${RESET}"
## Release preparation
prepare-release: clean test-all build
@echo "${GREEN}Release ready!${RESET}"
@echo "Next: make publish-test or make publish"
## Quick development cycle
dev: format test
@echo "${GREEN}Development cycle complete!${RESET}"
## Emergency clean (nuclear option)
nuke: clean
@echo "${YELLOW}Nuclear clean...${RESET}"
pip uninstall -y taskguard
rm -rf ~/.llmtask_shell.sh ~/.llmcontrol.yaml .llmstate.json TODO.yaml CHANGELOG.md
@echo "${GREEN}Everything cleaned!${RESET}"