zima-blue-cli 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- zima_blue_cli-0.1.0/.claude/agents/test-reviewer.md +45 -0
- zima_blue_cli-0.1.0/.claude/settings.json +15 -0
- zima_blue_cli-0.1.0/.claude/skills/gen-test/SKILL.md +67 -0
- zima_blue_cli-0.1.0/.claude/skills/new-entity/SKILL.md +77 -0
- zima_blue_cli-0.1.0/.github/workflows/integration-test.yml +210 -0
- zima_blue_cli-0.1.0/.github/workflows/publish.yml +27 -0
- zima_blue_cli-0.1.0/.gitignore +52 -0
- zima_blue_cli-0.1.0/AGENTS.md +487 -0
- zima_blue_cli-0.1.0/CLAUDE.md +177 -0
- zima_blue_cli-0.1.0/ISSUES_TO_FIX.md +265 -0
- zima_blue_cli-0.1.0/LICENSE +21 -0
- zima_blue_cli-0.1.0/PKG-INFO +270 -0
- zima_blue_cli-0.1.0/README.md +242 -0
- zima_blue_cli-0.1.0/SESSION.md +194 -0
- zima_blue_cli-0.1.0/ZIMA_CLI_ISSUES.md +221 -0
- zima_blue_cli-0.1.0/agents/example-agent/agent.yaml +41 -0
- zima_blue_cli-0.1.0/agents/example-agent/daemon.log +0 -0
- zima_blue_cli-0.1.0/agents/example-agent/workspace/README.md +20 -0
- zima_blue_cli-0.1.0/agents/example-agent/workspace/src/calculator.py +23 -0
- zima_blue_cli-0.1.0/agents/example-agent/workspace/src/hello_world.py +11 -0
- zima_blue_cli-0.1.0/agents/example-agent/workspace/tests/test_calculator.py +53 -0
- zima_blue_cli-0.1.0/agents/jfox-coverage-agent/README.md +118 -0
- zima_blue_cli-0.1.0/agents/jfox-coverage-agent/agent.yaml +22 -0
- zima_blue_cli-0.1.0/agents/jfox-coverage-agent/agent_state.json +106 -0
- zima_blue_cli-0.1.0/agents/jfox-coverage-agent/tasks/analyze.txt +99 -0
- zima_blue_cli-0.1.0/agents/jfox-coverage-agent/tasks/execute.txt +112 -0
- zima_blue_cli-0.1.0/agents/jfox-coverage-agent/tasks/fix.txt +160 -0
- zima_blue_cli-0.1.0/agents/jfox-coverage-agent/tasks/main.txt +147 -0
- zima_blue_cli-0.1.0/agents/jfox-coverage-agent/tasks/verify.txt +140 -0
- zima_blue_cli-0.1.0/cleanup.bat +14 -0
- zima_blue_cli-0.1.0/cleanup.sh +14 -0
- zima_blue_cli-0.1.0/docs/API-INTERFACE.md +701 -0
- zima_blue_cli-0.1.0/docs/architecture/README.md +214 -0
- zima_blue_cli-0.1.0/docs/architecture/progress-recovery.md +567 -0
- zima_blue_cli-0.1.0/docs/decisions/001-use-subprocess.md +66 -0
- zima_blue_cli-0.1.0/docs/decisions/002-15min-cycle.md +74 -0
- zima_blue_cli-0.1.0/docs/decisions/003-early-completion.md +80 -0
- zima_blue_cli-0.1.0/docs/decisions/004-single-execution.md +108 -0
- zima_blue_cli-0.1.0/docs/design/AGENT-PHASE-TASKS.md +505 -0
- zima_blue_cli-0.1.0/docs/design/CLI-INTERFACE.md +1155 -0
- zima_blue_cli-0.1.0/docs/design/CONFIG-ENTITIES.md +657 -0
- zima_blue_cli-0.1.0/docs/design/ENV-DESIGN.md +697 -0
- zima_blue_cli-0.1.0/docs/design/IMPLEMENTATION-PLAN.md +522 -0
- zima_blue_cli-0.1.0/docs/design/PJOB-DESIGN.md +1437 -0
- zima_blue_cli-0.1.0/docs/design/PMG-DESIGN.md +824 -0
- zima_blue_cli-0.1.0/docs/design/TEST-STRATEGY.md +984 -0
- zima_blue_cli-0.1.0/docs/design/WORKFLOW-DESIGN.md +691 -0
- zima_blue_cli-0.1.0/docs/guides/AGENT-PROMPT-TEMPLATE-DETAIL.md +631 -0
- zima_blue_cli-0.1.0/docs/guides/AGENT-PROMPT-TEMPLATE.md +488 -0
- zima_blue_cli-0.1.0/docs/history/agent-cycle-timeline.md +1559 -0
- zima_blue_cli-0.1.0/docs/history/kimiworld-design.md +757 -0
- zima_blue_cli-0.1.0/docs/history/ralph-loop-design.md +368 -0
- zima_blue_cli-0.1.0/docs/reports/test-report-kimi-real.md +321 -0
- zima_blue_cli-0.1.0/docs/superpowers/plans/2026-04-16-github-code-review-skill.md +366 -0
- zima_blue_cli-0.1.0/docs/superpowers/plans/2026-04-19-ci-adaptation.md +398 -0
- zima_blue_cli-0.1.0/docs/superpowers/specs/2026-04-16-daemon-scheduler-design.md +359 -0
- zima_blue_cli-0.1.0/docs/superpowers/specs/2026-04-16-github-code-review-skill-design.md +234 -0
- zima_blue_cli-0.1.0/docs/superpowers/specs/2026-04-19-ci-adaptation-design.md +152 -0
- zima_blue_cli-0.1.0/docs/vision/story.md +221 -0
- zima_blue_cli-0.1.0/examples/sdd/agents/sdd-cc-agent.yaml +17 -0
- zima_blue_cli-0.1.0/examples/sdd/agents/sdd-cc-implement-agent.yaml +17 -0
- zima_blue_cli-0.1.0/examples/sdd/agents/sdd-kimi-agent.yaml +19 -0
- zima_blue_cli-0.1.0/examples/sdd/agents/sdd-kimi-implement-agent.yaml +19 -0
- zima_blue_cli-0.1.0/examples/sdd/envs/sdd-env.yaml +16 -0
- zima_blue_cli-0.1.0/examples/sdd/pjobs/sdd-cc-clarify.yaml +23 -0
- zima_blue_cli-0.1.0/examples/sdd/pjobs/sdd-cc-fix.yaml +23 -0
- zima_blue_cli-0.1.0/examples/sdd/pjobs/sdd-cc-implement.yaml +23 -0
- zima_blue_cli-0.1.0/examples/sdd/pjobs/sdd-cc-plan.yaml +23 -0
- zima_blue_cli-0.1.0/examples/sdd/pjobs/sdd-cc-research.yaml +23 -0
- zima_blue_cli-0.1.0/examples/sdd/pjobs/sdd-cc-review.yaml +23 -0
- zima_blue_cli-0.1.0/examples/sdd/pjobs/sdd-clarify.yaml +21 -0
- zima_blue_cli-0.1.0/examples/sdd/pjobs/sdd-fix.yaml +21 -0
- zima_blue_cli-0.1.0/examples/sdd/pjobs/sdd-implement.yaml +21 -0
- zima_blue_cli-0.1.0/examples/sdd/pjobs/sdd-plan.yaml +21 -0
- zima_blue_cli-0.1.0/examples/sdd/pjobs/sdd-research.yaml +22 -0
- zima_blue_cli-0.1.0/examples/sdd/pjobs/sdd-review.yaml +21 -0
- zima_blue_cli-0.1.0/examples/sdd/workflows/sdd-clarify.yaml +77 -0
- zima_blue_cli-0.1.0/examples/sdd/workflows/sdd-fix.yaml +85 -0
- zima_blue_cli-0.1.0/examples/sdd/workflows/sdd-implement.yaml +86 -0
- zima_blue_cli-0.1.0/examples/sdd/workflows/sdd-plan.yaml +107 -0
- zima_blue_cli-0.1.0/examples/sdd/workflows/sdd-research.yaml +76 -0
- zima_blue_cli-0.1.0/examples/sdd/workflows/sdd-review.yaml +85 -0
- zima_blue_cli-0.1.0/examples/workflows/coverage-workflow-v2.yaml +425 -0
- zima_blue_cli-0.1.0/pyproject.toml +76 -0
- zima_blue_cli-0.1.0/requirements.txt +5 -0
- zima_blue_cli-0.1.0/scripts/README.md +171 -0
- zima_blue_cli-0.1.0/scripts/cleanup.py +305 -0
- zima_blue_cli-0.1.0/test_readme.txt +0 -0
- zima_blue_cli-0.1.0/tests/__init__.py +1 -0
- zima_blue_cli-0.1.0/tests/base.py +144 -0
- zima_blue_cli-0.1.0/tests/conftest.py +98 -0
- zima_blue_cli-0.1.0/tests/integration/__init__.py +1 -0
- zima_blue_cli-0.1.0/tests/integration/test_agent_commands.py +361 -0
- zima_blue_cli-0.1.0/tests/integration/test_env_commands.py +833 -0
- zima_blue_cli-0.1.0/tests/integration/test_example_flag.py +70 -0
- zima_blue_cli-0.1.0/tests/integration/test_kimi_agent_integration.py +661 -0
- zima_blue_cli-0.1.0/tests/integration/test_kimi_agent_real.py +417 -0
- zima_blue_cli-0.1.0/tests/integration/test_pjob_lifecycle.py +601 -0
- zima_blue_cli-0.1.0/tests/integration/test_pmg_commands.py +654 -0
- zima_blue_cli-0.1.0/tests/integration/test_variable_commands.py +475 -0
- zima_blue_cli-0.1.0/tests/integration/test_workflow_commands.py +464 -0
- zima_blue_cli-0.1.0/tests/unit/__init__.py +1 -0
- zima_blue_cli-0.1.0/tests/unit/test_claude_runner.py +281 -0
- zima_blue_cli-0.1.0/tests/unit/test_config_bundle.py +307 -0
- zima_blue_cli-0.1.0/tests/unit/test_config_manager.py +296 -0
- zima_blue_cli-0.1.0/tests/unit/test_daemon_scheduler.py +78 -0
- zima_blue_cli-0.1.0/tests/unit/test_examples.py +215 -0
- zima_blue_cli-0.1.0/tests/unit/test_executor_fixes.py +98 -0
- zima_blue_cli-0.1.0/tests/unit/test_models_agent.py +375 -0
- zima_blue_cli-0.1.0/tests/unit/test_models_base.py +272 -0
- zima_blue_cli-0.1.0/tests/unit/test_models_env.py +692 -0
- zima_blue_cli-0.1.0/tests/unit/test_models_pjob.py +331 -0
- zima_blue_cli-0.1.0/tests/unit/test_models_pmg.py +509 -0
- zima_blue_cli-0.1.0/tests/unit/test_models_schedule.py +67 -0
- zima_blue_cli-0.1.0/tests/unit/test_models_variable.py +339 -0
- zima_blue_cli-0.1.0/tests/unit/test_models_workflow.py +508 -0
- zima_blue_cli-0.1.0/tests/unit/test_utils.py +229 -0
- zima_blue_cli-0.1.0/tests/unit/test_utils_utf8.py +40 -0
- zima_blue_cli-0.1.0/zima/__init__.py +3 -0
- zima_blue_cli-0.1.0/zima/cli.py +471 -0
- zima_blue_cli-0.1.0/zima/commands/__init__.py +1 -0
- zima_blue_cli-0.1.0/zima/commands/agent.py +450 -0
- zima_blue_cli-0.1.0/zima/commands/env.py +563 -0
- zima_blue_cli-0.1.0/zima/commands/pjob.py +1045 -0
- zima_blue_cli-0.1.0/zima/commands/pmg.py +505 -0
- zima_blue_cli-0.1.0/zima/commands/schedule.py +248 -0
- zima_blue_cli-0.1.0/zima/commands/variable.py +483 -0
- zima_blue_cli-0.1.0/zima/commands/workflow.py +757 -0
- zima_blue_cli-0.1.0/zima/config/__init__.py +5 -0
- zima_blue_cli-0.1.0/zima/config/manager.py +274 -0
- zima_blue_cli-0.1.0/zima/core/__init__.py +7 -0
- zima_blue_cli-0.1.0/zima/core/claude_runner.py +316 -0
- zima_blue_cli-0.1.0/zima/core/daemon.py +106 -0
- zima_blue_cli-0.1.0/zima/core/daemon_scheduler.py +240 -0
- zima_blue_cli-0.1.0/zima/core/kimi_runner.py +249 -0
- zima_blue_cli-0.1.0/zima/core/runner.py +75 -0
- zima_blue_cli-0.1.0/zima/core/scheduler.py +352 -0
- zima_blue_cli-0.1.0/zima/core/state_manager.py +131 -0
- zima_blue_cli-0.1.0/zima/daemon_runner.py +69 -0
- zima_blue_cli-0.1.0/zima/execution/__init__.py +12 -0
- zima_blue_cli-0.1.0/zima/execution/background_runner.py +71 -0
- zima_blue_cli-0.1.0/zima/execution/executor.py +641 -0
- zima_blue_cli-0.1.0/zima/execution/history.py +276 -0
- zima_blue_cli-0.1.0/zima/models/__init__.py +52 -0
- zima_blue_cli-0.1.0/zima/models/agent.py +516 -0
- zima_blue_cli-0.1.0/zima/models/base.py +219 -0
- zima_blue_cli-0.1.0/zima/models/config_bundle.py +321 -0
- zima_blue_cli-0.1.0/zima/models/env.py +612 -0
- zima_blue_cli-0.1.0/zima/models/pjob.py +428 -0
- zima_blue_cli-0.1.0/zima/models/pmg.py +604 -0
- zima_blue_cli-0.1.0/zima/models/schedule.py +197 -0
- zima_blue_cli-0.1.0/zima/models/variable.py +238 -0
- zima_blue_cli-0.1.0/zima/models/workflow.py +552 -0
- zima_blue_cli-0.1.0/zima/templates/__init__.py +4 -0
- zima_blue_cli-0.1.0/zima/templates/examples.py +190 -0
- zima_blue_cli-0.1.0/zima/utils.py +277 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-reviewer
|
|
3
|
+
description: Reviews test files for proper isolation, coverage, and conventions
|
|
4
|
+
model: haiku
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Test Reviewer
|
|
8
|
+
|
|
9
|
+
You are a specialized test reviewer for the Zima Blue CLI project. Review test files against the project's testing conventions.
|
|
10
|
+
|
|
11
|
+
## Review Checklist
|
|
12
|
+
|
|
13
|
+
For each test file, check:
|
|
14
|
+
|
|
15
|
+
1. **Isolation**: Tests using filesystem/config operations must inherit from `TestIsolator` (in `tests/base.py`). This provides automatic `ZIMA_HOME` isolation via `monkeypatch`.
|
|
16
|
+
|
|
17
|
+
2. **Fixture usage**: Use shared fixtures from `tests/conftest.py`:
|
|
18
|
+
- `isolated_zima_home` — temp ZIMA_HOME directory
|
|
19
|
+
- `config_manager` — pre-configured ConfigManager
|
|
20
|
+
- `cli_runner` — Typer CliRunner instance
|
|
21
|
+
- `unique_code` — unique test identifier generator
|
|
22
|
+
|
|
23
|
+
3. **Test placement**:
|
|
24
|
+
- Pure unit tests (no subprocess, no filesystem) → `tests/unit/`
|
|
25
|
+
- CLI command tests, subprocess tests → `tests/integration/`
|
|
26
|
+
|
|
27
|
+
4. **Naming convention**:
|
|
28
|
+
- File: `test_<module_path>.py` (e.g., `zima/models/agent.py` → `test_models_agent.py`)
|
|
29
|
+
- Class: `Test<ClassName>`
|
|
30
|
+
- Method: `test_<behavior>_<condition>`
|
|
31
|
+
|
|
32
|
+
5. **Coverage quality**:
|
|
33
|
+
- Happy path + edge cases + error handling
|
|
34
|
+
- Use `pytest.raises` for expected exceptions
|
|
35
|
+
- No trivial tests (e.g., only testing that an object exists)
|
|
36
|
+
|
|
37
|
+
6. **Docstrings**: Google-style docstrings on test classes, concise descriptions on methods.
|
|
38
|
+
|
|
39
|
+
## Output Format
|
|
40
|
+
|
|
41
|
+
Report issues grouped by severity:
|
|
42
|
+
|
|
43
|
+
- **MUST FIX**: Missing isolation, wrong placement, broken fixtures
|
|
44
|
+
- **SHOULD FIX**: Missing edge cases, poor naming, missing docstrings
|
|
45
|
+
- **NICE TO HAVE**: Style improvements, additional coverage suggestions
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"hooks": {
|
|
3
|
+
"PostToolUse": [
|
|
4
|
+
{
|
|
5
|
+
"matcher": "Edit|Write",
|
|
6
|
+
"hooks": [
|
|
7
|
+
{
|
|
8
|
+
"type": "command",
|
|
9
|
+
"command": "FILE=\"$CLAUDE_FILE_PATH\"; if [[ \"$FILE\" == *.py ]]; then black \"$FILE\" --line-length 100 --quiet 2>/dev/null; ruff check \"$FILE\" --fix --quiet 2>/dev/null; fi"
|
|
10
|
+
}
|
|
11
|
+
]
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: gen-test
|
|
3
|
+
description: Generate pytest unit tests for a given source module or function
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Generate Tests
|
|
7
|
+
|
|
8
|
+
Generate pytest unit tests for a target Python module or function.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
- `/gen-test zima/models/agent.py` — generate tests for the agent model
|
|
13
|
+
- `/gen-test zima/config/manager.py::ConfigManager.save_config` — generate tests for a specific method
|
|
14
|
+
|
|
15
|
+
## Instructions
|
|
16
|
+
|
|
17
|
+
1. **Read the target source file** to understand its public API, classes, and functions.
|
|
18
|
+
|
|
19
|
+
2. **Determine the test file path** using the project convention:
|
|
20
|
+
- Source: `zima/foo/bar.py` -> Test: `tests/unit/test_foo_bar.py` (flattened with underscores)
|
|
21
|
+
- But check existing naming first: `zima/models/agent.py` -> `tests/unit/test_models_agent.py`
|
|
22
|
+
- If the test file already exists, **append** new test classes/methods rather than overwriting.
|
|
23
|
+
|
|
24
|
+
3. **Generate tests** following these conventions:
|
|
25
|
+
- Test classes inherit from `TestIsolator` (from `tests/base.py`) when filesystem/config isolation is needed
|
|
26
|
+
- Use `monkeypatch` for `ZIMA_HOME` isolation (handled by `TestIsolator`)
|
|
27
|
+
- Use fixtures from `tests/conftest.py` (`config_manager`, `cli_runner`, `unique_code`, `isolated_zima_home`)
|
|
28
|
+
- Google-style docstrings on test classes
|
|
29
|
+
- Cover: happy path, edge cases, error handling
|
|
30
|
+
- Use `pytest.raises` for expected exceptions
|
|
31
|
+
- Use `tmp_path` or `TestIsolator.get_test_path()` for temp files
|
|
32
|
+
|
|
33
|
+
4. **Example test structure**:
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
"""Tests for <module description>."""
|
|
37
|
+
|
|
38
|
+
import pytest
|
|
39
|
+
|
|
40
|
+
from zima.<module> import <TargetClass>
|
|
41
|
+
from tests.base import TestIsolator
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class Test<TargetClass>(TestIsolator):
|
|
45
|
+
"""Tests for <TargetClass>."""
|
|
46
|
+
|
|
47
|
+
def test_<behavior>_success(self):
|
|
48
|
+
"""Test <behavior> with valid input."""
|
|
49
|
+
# arrange
|
|
50
|
+
...
|
|
51
|
+
# act
|
|
52
|
+
result = ...
|
|
53
|
+
# assert
|
|
54
|
+
assert result == expected
|
|
55
|
+
|
|
56
|
+
def test_<behavior>_invalid_input(self):
|
|
57
|
+
"""Test <behavior> raises on invalid input."""
|
|
58
|
+
with pytest.raises(ValueError):
|
|
59
|
+
...
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
5. **After generating**, run the test to verify it passes:
|
|
63
|
+
```bash
|
|
64
|
+
pytest <test_file> -v
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
6. **Report** the test file path, number of tests generated, and pass/fail status.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: new-entity
|
|
3
|
+
description: Scaffold a new configuration entity type (model, commands, manager integration, CLI registration)
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# New Config Entity Scaffold
|
|
8
|
+
|
|
9
|
+
Scaffold a new configuration entity type for the Zima Blue CLI platform.
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
- `/new-entity Trigger` — create a new entity called "Trigger"
|
|
14
|
+
- `/new-entity Schedule` — create a new entity called "Schedule"
|
|
15
|
+
|
|
16
|
+
## Instructions
|
|
17
|
+
|
|
18
|
+
Follow the 4-step extension pattern documented in CLAUDE.md:
|
|
19
|
+
|
|
20
|
+
### Step 1: Create Model
|
|
21
|
+
|
|
22
|
+
Create `zima/models/<entity>.py`:
|
|
23
|
+
|
|
24
|
+
- Follow the pattern from existing models (e.g., `zima/models/agent.py`)
|
|
25
|
+
- Inherit from `BaseConfig` or create a standalone dataclass
|
|
26
|
+
- Include `Metadata` with `code`, `name`, `description`
|
|
27
|
+
- YAML structure: `apiVersion: zima.io/v1` / `kind: <Entity>` / `metadata` / `spec`
|
|
28
|
+
- Add `KIND = "<entity>"` class constant
|
|
29
|
+
- Implement `from_dict` classmethod and `to_dict` method
|
|
30
|
+
- Add validation for `metadata.code`: lowercase letters, numbers, hyphens only, max 64 chars
|
|
31
|
+
|
|
32
|
+
### Step 2: Register in ConfigManager
|
|
33
|
+
|
|
34
|
+
Edit `zima/config/manager.py`:
|
|
35
|
+
|
|
36
|
+
- Add the new kind string to `ConfigManager.KINDS` set
|
|
37
|
+
- No other changes needed — `ConfigManager` handles all entity types generically
|
|
38
|
+
|
|
39
|
+
### Step 3: Create Commands
|
|
40
|
+
|
|
41
|
+
Create `zima/commands/<entity>.py`:
|
|
42
|
+
|
|
43
|
+
- Follow the pattern from existing commands (e.g., `zima/commands/agent.py`)
|
|
44
|
+
- Use Typer `app = typer.Typer(help="<Entity> management commands")`
|
|
45
|
+
- Implement standard CRUD: `list`, `get`, `create`, `delete`
|
|
46
|
+
- For `create`: accept YAML file via `--file` option, validate and save
|
|
47
|
+
- Use `ConfigManager` for all config operations
|
|
48
|
+
- Use `rich` for formatted output
|
|
49
|
+
|
|
50
|
+
### Step 4: Register CLI Subcommand
|
|
51
|
+
|
|
52
|
+
Edit `zima/cli.py`:
|
|
53
|
+
|
|
54
|
+
- Import the new command app: `from zima.commands.<entity> import app as <entity>_app`
|
|
55
|
+
- Register: `app.add_typer(<entity>_app, name="<entity>")`
|
|
56
|
+
|
|
57
|
+
### Step 5: Create Test Fixtures (Optional)
|
|
58
|
+
|
|
59
|
+
Create sample YAML config in `tests/fixtures/configs/`:
|
|
60
|
+
|
|
61
|
+
```yaml
|
|
62
|
+
apiVersion: zima.io/v1
|
|
63
|
+
kind: <Entity>
|
|
64
|
+
metadata:
|
|
65
|
+
code: sample-<entity>
|
|
66
|
+
name: Sample <Entity>
|
|
67
|
+
description: For testing
|
|
68
|
+
spec:
|
|
69
|
+
# entity-specific fields
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Verification
|
|
73
|
+
|
|
74
|
+
After scaffolding, verify:
|
|
75
|
+
1. `python -c "from zima.models.<entity> import <Entity>Config"` — import works
|
|
76
|
+
2. `zima <entity> --help` — CLI registered correctly
|
|
77
|
+
3. `pytest tests/` — no existing tests broken
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
name: Integration Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, master]
|
|
6
|
+
paths:
|
|
7
|
+
- 'zima/**'
|
|
8
|
+
- 'tests/**'
|
|
9
|
+
- 'pyproject.toml'
|
|
10
|
+
- '.github/workflows/integration-test.yml'
|
|
11
|
+
pull_request:
|
|
12
|
+
branches: [main, master]
|
|
13
|
+
paths:
|
|
14
|
+
- 'zima/**'
|
|
15
|
+
- 'tests/**'
|
|
16
|
+
- 'pyproject.toml'
|
|
17
|
+
- '.github/workflows/integration-test.yml'
|
|
18
|
+
workflow_dispatch:
|
|
19
|
+
inputs:
|
|
20
|
+
test_type:
|
|
21
|
+
description: 'Test type to run'
|
|
22
|
+
required: true
|
|
23
|
+
default: 'fast'
|
|
24
|
+
type: choice
|
|
25
|
+
options:
|
|
26
|
+
- fast
|
|
27
|
+
- full
|
|
28
|
+
|
|
29
|
+
env:
|
|
30
|
+
PYTHONIOENCODING: utf-8
|
|
31
|
+
PYTHONUTF8: 1
|
|
32
|
+
|
|
33
|
+
jobs:
|
|
34
|
+
# ============ Lint ============
|
|
35
|
+
lint:
|
|
36
|
+
runs-on: ubuntu-latest
|
|
37
|
+
steps:
|
|
38
|
+
- name: Checkout code
|
|
39
|
+
uses: actions/checkout@v4
|
|
40
|
+
|
|
41
|
+
- name: Set up Python
|
|
42
|
+
uses: actions/setup-python@v5
|
|
43
|
+
with:
|
|
44
|
+
python-version: '3.13'
|
|
45
|
+
|
|
46
|
+
- name: Cache pip packages
|
|
47
|
+
uses: actions/cache@v4
|
|
48
|
+
with:
|
|
49
|
+
path: ~/.cache/pip
|
|
50
|
+
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
|
|
51
|
+
restore-keys: ${{ runner.os }}-pip-
|
|
52
|
+
|
|
53
|
+
- name: Install dependencies
|
|
54
|
+
run: pip install -e ".[dev]"
|
|
55
|
+
|
|
56
|
+
- name: Run ruff check
|
|
57
|
+
run: ruff check zima/ tests/
|
|
58
|
+
|
|
59
|
+
- name: Run black check
|
|
60
|
+
run: black --check zima/ tests/ --line-length 100
|
|
61
|
+
|
|
62
|
+
# ============ Fast Tests (PR + push) ============
|
|
63
|
+
test-fast:
|
|
64
|
+
runs-on: ${{ matrix.os }}
|
|
65
|
+
needs: lint
|
|
66
|
+
if: github.event_name != 'workflow_dispatch' || github.event.inputs.test_type == 'fast'
|
|
67
|
+
strategy:
|
|
68
|
+
fail-fast: false
|
|
69
|
+
matrix:
|
|
70
|
+
os: [ubuntu-latest, windows-latest]
|
|
71
|
+
python-version: ['3.13']
|
|
72
|
+
|
|
73
|
+
steps:
|
|
74
|
+
- name: Checkout code
|
|
75
|
+
uses: actions/checkout@v4
|
|
76
|
+
|
|
77
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
78
|
+
uses: actions/setup-python@v5
|
|
79
|
+
with:
|
|
80
|
+
python-version: ${{ matrix.python-version }}
|
|
81
|
+
|
|
82
|
+
- name: Cache pip packages
|
|
83
|
+
uses: actions/cache@v4
|
|
84
|
+
with:
|
|
85
|
+
path: ~/.cache/pip
|
|
86
|
+
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
|
|
87
|
+
restore-keys: ${{ runner.os }}-pip-
|
|
88
|
+
|
|
89
|
+
- name: Install dependencies
|
|
90
|
+
run: pip install -e ".[dev]"
|
|
91
|
+
|
|
92
|
+
- name: Run tests (Ubuntu)
|
|
93
|
+
if: runner.os == 'Linux'
|
|
94
|
+
run: pytest tests/ -m "not slow" --cov=zima --cov-report=xml --cov-fail-under=60 --tb=short -v
|
|
95
|
+
timeout-minutes: 10
|
|
96
|
+
|
|
97
|
+
- name: Run tests (Windows)
|
|
98
|
+
if: runner.os == 'Windows'
|
|
99
|
+
run: pytest tests/ -m "not slow" --tb=short -v
|
|
100
|
+
timeout-minutes: 20
|
|
101
|
+
|
|
102
|
+
- name: Upload coverage data
|
|
103
|
+
if: runner.os == 'Linux'
|
|
104
|
+
uses: actions/upload-artifact@v4
|
|
105
|
+
with:
|
|
106
|
+
name: coverage-data
|
|
107
|
+
path: coverage.xml
|
|
108
|
+
retention-days: 1
|
|
109
|
+
|
|
110
|
+
# ============ Full Tests (manual only) ============
|
|
111
|
+
test-full:
|
|
112
|
+
runs-on: ${{ matrix.os }}
|
|
113
|
+
needs: lint
|
|
114
|
+
if: github.event.inputs.test_type == 'full'
|
|
115
|
+
strategy:
|
|
116
|
+
fail-fast: false
|
|
117
|
+
matrix:
|
|
118
|
+
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
119
|
+
python-version: ['3.13']
|
|
120
|
+
|
|
121
|
+
steps:
|
|
122
|
+
- name: Checkout code
|
|
123
|
+
uses: actions/checkout@v4
|
|
124
|
+
|
|
125
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
126
|
+
uses: actions/setup-python@v5
|
|
127
|
+
with:
|
|
128
|
+
python-version: ${{ matrix.python-version }}
|
|
129
|
+
|
|
130
|
+
- name: Cache pip packages
|
|
131
|
+
uses: actions/cache@v4
|
|
132
|
+
with:
|
|
133
|
+
path: ~/.cache/pip
|
|
134
|
+
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
|
|
135
|
+
restore-keys: ${{ runner.os }}-pip-
|
|
136
|
+
|
|
137
|
+
- name: Install dependencies
|
|
138
|
+
run: pip install -e ".[dev]"
|
|
139
|
+
|
|
140
|
+
- name: Run full test suite
|
|
141
|
+
run: pytest tests/ -v --tb=short
|
|
142
|
+
timeout-minutes: 20
|
|
143
|
+
|
|
144
|
+
# ============ Quality Gate ============
|
|
145
|
+
quality-gate:
|
|
146
|
+
runs-on: ubuntu-latest
|
|
147
|
+
needs: [lint, test-fast]
|
|
148
|
+
if: always()
|
|
149
|
+
steps:
|
|
150
|
+
- name: Check all jobs passed
|
|
151
|
+
run: |
|
|
152
|
+
echo "lint: ${{ needs.lint.result }}"
|
|
153
|
+
echo "test-fast: ${{ needs.test-fast.result }}"
|
|
154
|
+
fast_ok="${{ needs.test-fast.result }}"
|
|
155
|
+
if [[ "${{ needs.lint.result }}" == "success" && ("$fast_ok" == "success" || "$fast_ok" == "skipped") ]]; then
|
|
156
|
+
echo "Quality gate passed!"
|
|
157
|
+
exit 0
|
|
158
|
+
else
|
|
159
|
+
echo "Quality gate FAILED!"
|
|
160
|
+
exit 1
|
|
161
|
+
fi
|
|
162
|
+
|
|
163
|
+
# ============ Coverage Report ============
|
|
164
|
+
coverage:
|
|
165
|
+
runs-on: ubuntu-latest
|
|
166
|
+
needs: [test-fast]
|
|
167
|
+
if: always() && needs.test-fast.result == 'success' && github.event_name == 'pull_request'
|
|
168
|
+
permissions:
|
|
169
|
+
pull-requests: write
|
|
170
|
+
|
|
171
|
+
steps:
|
|
172
|
+
- name: Checkout code
|
|
173
|
+
uses: actions/checkout@v4
|
|
174
|
+
|
|
175
|
+
- name: Download coverage data
|
|
176
|
+
uses: actions/download-artifact@v4
|
|
177
|
+
with:
|
|
178
|
+
name: coverage-data
|
|
179
|
+
|
|
180
|
+
- name: Post coverage comment on PR
|
|
181
|
+
env:
|
|
182
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
183
|
+
run: |
|
|
184
|
+
python -c "
|
|
185
|
+
import xml.etree.ElementTree as ET
|
|
186
|
+
import subprocess
|
|
187
|
+
|
|
188
|
+
tree = ET.parse('coverage.xml')
|
|
189
|
+
root = tree.getroot()
|
|
190
|
+
rate = float(root.attrib['line-rate'])
|
|
191
|
+
lines_covered = int(root.attrib['lines-covered'])
|
|
192
|
+
lines_valid = int(root.attrib['lines-valid'])
|
|
193
|
+
|
|
194
|
+
rows = []
|
|
195
|
+
for cls in root.iter('class'):
|
|
196
|
+
name = cls.attrib['filename']
|
|
197
|
+
r = float(cls.attrib['line-rate'])
|
|
198
|
+
rows.append((name, r))
|
|
199
|
+
rows.sort(key=lambda x: x[1])
|
|
200
|
+
|
|
201
|
+
comment = '## Test Coverage\n\n'
|
|
202
|
+
comment += '**Overall: {:.1f}%** ({}/{} lines)\n\n'.format(rate * 100, lines_covered, lines_valid)
|
|
203
|
+
comment += '| Module | Coverage | Status |\n|--------|----------|--------|\n'
|
|
204
|
+
for name, r in rows:
|
|
205
|
+
icon = ':green_circle:' if r >= 0.8 else ':yellow_circle:' if r >= 0.5 else ':red_circle:'
|
|
206
|
+
comment += '| {} | {:.1f}% | {} |\n'.format(name, r * 100, icon)
|
|
207
|
+
|
|
208
|
+
pr = '${{ github.event.pull_request.number }}'
|
|
209
|
+
subprocess.run(['gh', 'pr', 'comment', pr, '--body', comment])
|
|
210
|
+
"
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
pypi-publish:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
environment: pypi
|
|
11
|
+
permissions:
|
|
12
|
+
id-token: write
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- name: Checkout code
|
|
16
|
+
uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Set up uv
|
|
19
|
+
uses: astral-sh/setup-uv@v4
|
|
20
|
+
with:
|
|
21
|
+
version: "latest"
|
|
22
|
+
|
|
23
|
+
- name: Build package
|
|
24
|
+
run: uv build
|
|
25
|
+
|
|
26
|
+
- name: Publish to PyPI
|
|
27
|
+
run: uv publish
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
.Python
|
|
7
|
+
build/
|
|
8
|
+
develop-eggs/
|
|
9
|
+
dist/
|
|
10
|
+
downloads/
|
|
11
|
+
eggs/
|
|
12
|
+
.eggs/
|
|
13
|
+
lib/
|
|
14
|
+
lib64/
|
|
15
|
+
parts/
|
|
16
|
+
sdist/
|
|
17
|
+
var/
|
|
18
|
+
wheels/
|
|
19
|
+
*.egg-info/
|
|
20
|
+
.installed.cfg
|
|
21
|
+
*.egg
|
|
22
|
+
|
|
23
|
+
# Virtual environments
|
|
24
|
+
venv/
|
|
25
|
+
ENV/
|
|
26
|
+
env/
|
|
27
|
+
.venv
|
|
28
|
+
|
|
29
|
+
# IDE
|
|
30
|
+
.vscode/
|
|
31
|
+
.idea/
|
|
32
|
+
*.swp
|
|
33
|
+
*.swo
|
|
34
|
+
*~
|
|
35
|
+
|
|
36
|
+
# Agent logs and sessions (user data)
|
|
37
|
+
agents/*/logs/
|
|
38
|
+
agents/*/sessions/
|
|
39
|
+
agents/*/prompts/
|
|
40
|
+
agents/*/checkpoints/
|
|
41
|
+
agents/*/state.json
|
|
42
|
+
|
|
43
|
+
# ZimaBlue runtime
|
|
44
|
+
.zima/
|
|
45
|
+
|
|
46
|
+
# OS
|
|
47
|
+
.DS_Store
|
|
48
|
+
Thumbs.db
|
|
49
|
+
|
|
50
|
+
# Git worktrees
|
|
51
|
+
.worktrees/
|
|
52
|
+
|