continuum-code 0.2.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.
Files changed (26) hide show
  1. continuum_code-0.2.0/PKG-INFO +209 -0
  2. continuum_code-0.2.0/README.md +193 -0
  3. continuum_code-0.2.0/pyproject.toml +37 -0
  4. continuum_code-0.2.0/setup.cfg +4 -0
  5. continuum_code-0.2.0/src/continuum/__init__.py +8 -0
  6. continuum_code-0.2.0/src/continuum/change_summary.py +416 -0
  7. continuum_code-0.2.0/src/continuum/cli.py +414 -0
  8. continuum_code-0.2.0/src/continuum/contracts.py +183 -0
  9. continuum_code-0.2.0/src/continuum/engine.py +214 -0
  10. continuum_code-0.2.0/src/continuum/mcp_server.py +127 -0
  11. continuum_code-0.2.0/src/continuum/packs/data-dbt-airflow/README.md +42 -0
  12. continuum_code-0.2.0/src/continuum/packs/data-dbt-airflow/continuum.yaml +42 -0
  13. continuum_code-0.2.0/src/continuum/packs/node-backend/continuum.yaml +29 -0
  14. continuum_code-0.2.0/src/continuum/packs/python-fastapi/continuum.yaml +29 -0
  15. continuum_code-0.2.0/src/continuum/packs/typescript-monorepo/continuum.yaml +29 -0
  16. continuum_code-0.2.0/src/continuum/recommend.py +63 -0
  17. continuum_code-0.2.0/src/continuum/scan.py +129 -0
  18. continuum_code-0.2.0/src/continuum_code.egg-info/PKG-INFO +209 -0
  19. continuum_code-0.2.0/src/continuum_code.egg-info/SOURCES.txt +24 -0
  20. continuum_code-0.2.0/src/continuum_code.egg-info/dependency_links.txt +1 -0
  21. continuum_code-0.2.0/src/continuum_code.egg-info/entry_points.txt +2 -0
  22. continuum_code-0.2.0/src/continuum_code.egg-info/requires.txt +8 -0
  23. continuum_code-0.2.0/src/continuum_code.egg-info/top_level.txt +1 -0
  24. continuum_code-0.2.0/tests/test_change_summary.py +210 -0
  25. continuum_code-0.2.0/tests/test_contracts.py +53 -0
  26. continuum_code-0.2.0/tests/test_engine.py +101 -0
@@ -0,0 +1,209 @@
1
+ Metadata-Version: 2.4
2
+ Name: continuum-code
3
+ Version: 0.2.0
4
+ Summary: Rule engine so coding agents obey repo rules (block/warn/ask) with clear explanations.
5
+ Author: Continuum
6
+ License-Expression: MIT
7
+ Requires-Python: >=3.10
8
+ Description-Content-Type: text/markdown
9
+ Requires-Dist: pyyaml>=6.0
10
+ Requires-Dist: pydantic>=2.0
11
+ Requires-Dist: click>=8.0
12
+ Requires-Dist: mcp>=1.0
13
+ Provides-Extra: dev
14
+ Requires-Dist: pytest>=7.0; extra == "dev"
15
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
16
+
17
+ # Continuum
18
+
19
+ Rule engine so coding agents **obey repo rules** across Cursor, Claude, and ChatGPT: they get **blocked**, **warned**, or **asked** before breaking rules, with clear explanations of which rule fired and how to fix.
20
+
21
+ ## v0.1 promise
22
+
23
+ - Add `continuum.yaml` to your repo.
24
+ - Run `continuum check` locally and in CI.
25
+ - Cursor (MCP) agents are gated: **blocked** / **warned** / **clarification_required** before breaking rules.
26
+ - The system **explains** which rule fired and how to fix it.
27
+
28
+ ## Install
29
+
30
+ ```bash
31
+ pip install -e . # from repo
32
+ # or when published:
33
+ pip install continuum-code
34
+ ```
35
+
36
+ Requires Python 3.10+.
37
+
38
+ ### Development on Windows (WSL2)
39
+
40
+ Keep the repo on the WSL filesystem (e.g. `~/repos/continuum`) for best compatibility.
41
+
42
+ **One-time (PowerShell as Admin):**
43
+
44
+ ```powershell
45
+ wsl --install -d Ubuntu-24.04
46
+ ```
47
+
48
+ After WSL install, open Ubuntu and run:
49
+
50
+ ```bash
51
+ # Base (keep repo under WSL, e.g. ~/repos/continuum)
52
+ sudo apt update && sudo apt install -y build-essential git curl
53
+
54
+ # Python via uv (fast, clean venvs)
55
+ curl -LsSf https://astral.sh/uv/install.sh | sh
56
+ source ~/.local/bin/env # or restart shell
57
+ ```
58
+
59
+ **Per clone (inside WSL, in repo root):**
60
+
61
+ ```bash
62
+ cd ~/repos/continuum # or your path
63
+ uv venv
64
+ source .venv/bin/activate
65
+ uv pip install -e ".[dev]"
66
+ ```
67
+
68
+ **Run tests:**
69
+
70
+ ```bash
71
+ pytest
72
+ ```
73
+
74
+ **Run CLI:**
75
+
76
+ ```bash
77
+ continuum check
78
+ continuum init --pack python-fastapi
79
+ ```
80
+
81
+ For a broader Windows + WSL2 dev setup (Terminal, Docker, Antigravity safety), see your preferred guide.
82
+
83
+ ## Quick start
84
+
85
+ ```bash
86
+ # Create config (optional: use a pack)
87
+ continuum init
88
+ continuum init --pack python-fastapi # or node-backend, typescript-monorepo
89
+
90
+ # Check current changes (git diff)
91
+ continuum check
92
+ continuum check --staged # only staged
93
+ continuum check --base origin/main # diff against branch
94
+
95
+ # Explain why a rule fired
96
+ continuum explain
97
+ continuum explain ban_lodash
98
+
99
+ # List active contracts
100
+ continuum inspect
101
+ ```
102
+
103
+ ## Config: `continuum.yaml`
104
+
105
+ ```yaml
106
+ version: 0.1
107
+ scopes:
108
+ - id: repo
109
+ match: ["**/*"]
110
+ contracts:
111
+ - type: ban
112
+ id: ban_lodash
113
+ match:
114
+ deps: ["lodash"]
115
+ message: "Use native JS or approved utils."
116
+ - type: ask_first
117
+ id: confirm_migrations
118
+ match:
119
+ paths: ["**/migrations/**"]
120
+ prompt: "Touching migrations. Confirm: (A) add-only (B) destructive (C) refactor"
121
+ - id: backend
122
+ match: ["backend/**"]
123
+ precedence: 10
124
+ contracts:
125
+ - type: require
126
+ id: require_tests
127
+ match:
128
+ paths: ["backend/**"]
129
+ require:
130
+ - kind: tests
131
+ hint: "Add or adjust unit tests for changed modules."
132
+ ```
133
+
134
+ Contract types: **ban** (deps/paths/commands), **require** (tests/logging/ADR), **ask_first** (confirmation gate), **define** (metadata).
135
+
136
+ ## Escape hatch
137
+
138
+ To skip checks (e.g. emergency hotfix), set `CONTINUUM_SKIP=1`; `continuum check` will exit 0 without running contracts. Prefer adjusting rules (e.g. `severity: warn`) in `continuum.yaml` when possible. See [docs/adoption.md](docs/adoption.md).
139
+
140
+ ## CI (GitHub Action)
141
+
142
+ ```yaml
143
+ - uses: actions/checkout@v4
144
+ with:
145
+ fetch-depth: 0
146
+ - uses: ./actions/continuum-check
147
+ with:
148
+ base_ref: ${{ github.event.pull_request.base.sha }}
149
+ ```
150
+
151
+ Or in another repo: `uses: your-org/continuum/actions/continuum-check@v0.1` (and install `continuum` via pip in the action).
152
+
153
+ ## Cursor / MCP
154
+
155
+ Run the MCP server so the Cursor agent can call `continuum_check` before applying changes:
156
+
157
+ ```bash
158
+ continuum mcp --transport stdio
159
+ ```
160
+
161
+ Add to Cursor MCP config:
162
+
163
+ ```json
164
+ {
165
+ "mcpServers": {
166
+ "continuum": {
167
+ "command": "continuum",
168
+ "args": ["mcp", "--transport", "stdio"]
169
+ }
170
+ }
171
+ }
172
+ ```
173
+
174
+ See [docs/cursor-mcp.md](docs/cursor-mcp.md) and [docs/demo.md](docs/demo.md) for setup and the “Refactor auth middleware” demo.
175
+
176
+ **Golden demo:** Run the 3 scenarios in [demo/README.md](demo/README.md) (dbt marts require, airflow ask-first, banned command) in under 10 minutes.
177
+
178
+ ## Packs
179
+
180
+ Starter configs:
181
+
182
+ - **node-backend** – Node/JS backend (ban lodash, require tests, ask on migrations).
183
+ - **python-fastapi** – FastAPI app (ban requests in favor of httpx, require tests, ask on migrations).
184
+ - **typescript-monorepo** – TS monorepo (ban lodash, require tests in packages).
185
+ - **data-dbt-airflow** – dbt + Airflow repos (ask_first on marts/DAGs, require tests on marts, ban risky commands).
186
+
187
+ ```bash
188
+ continuum init --pack python-fastapi
189
+ continuum init --pack data-dbt-airflow # dbt + Airflow
190
+ ```
191
+
192
+ ### 5-minute adoption (dbt + Airflow)
193
+
194
+ 1. `pip install continuum-code` (or `pip install -e .` from repo).
195
+ 2. `continuum init --pack data-dbt-airflow` → writes `continuum.yaml`.
196
+ 3. `continuum validate` → confirm the file is valid.
197
+ 4. `continuum check` (or `continuum check --base origin/main` for PRs).
198
+ 5. Add the GitHub Action for CI; optionally run `continuum mcp --transport stdio` for Cursor.
199
+
200
+ ## Next steps (after v0.1)
201
+
202
+ - Richer dependency detection (poetry, pnpm, pip-tools).
203
+ - Pattern bans (regex on diffs).
204
+ - Stricter “require” checks (e.g. tests touched when src touched).
205
+ - Decision diffs / supersession (v0.2).
206
+
207
+ ## License
208
+
209
+ MIT.
@@ -0,0 +1,193 @@
1
+ # Continuum
2
+
3
+ Rule engine so coding agents **obey repo rules** across Cursor, Claude, and ChatGPT: they get **blocked**, **warned**, or **asked** before breaking rules, with clear explanations of which rule fired and how to fix.
4
+
5
+ ## v0.1 promise
6
+
7
+ - Add `continuum.yaml` to your repo.
8
+ - Run `continuum check` locally and in CI.
9
+ - Cursor (MCP) agents are gated: **blocked** / **warned** / **clarification_required** before breaking rules.
10
+ - The system **explains** which rule fired and how to fix it.
11
+
12
+ ## Install
13
+
14
+ ```bash
15
+ pip install -e . # from repo
16
+ # or when published:
17
+ pip install continuum-code
18
+ ```
19
+
20
+ Requires Python 3.10+.
21
+
22
+ ### Development on Windows (WSL2)
23
+
24
+ Keep the repo on the WSL filesystem (e.g. `~/repos/continuum`) for best compatibility.
25
+
26
+ **One-time (PowerShell as Admin):**
27
+
28
+ ```powershell
29
+ wsl --install -d Ubuntu-24.04
30
+ ```
31
+
32
+ After WSL install, open Ubuntu and run:
33
+
34
+ ```bash
35
+ # Base (keep repo under WSL, e.g. ~/repos/continuum)
36
+ sudo apt update && sudo apt install -y build-essential git curl
37
+
38
+ # Python via uv (fast, clean venvs)
39
+ curl -LsSf https://astral.sh/uv/install.sh | sh
40
+ source ~/.local/bin/env # or restart shell
41
+ ```
42
+
43
+ **Per clone (inside WSL, in repo root):**
44
+
45
+ ```bash
46
+ cd ~/repos/continuum # or your path
47
+ uv venv
48
+ source .venv/bin/activate
49
+ uv pip install -e ".[dev]"
50
+ ```
51
+
52
+ **Run tests:**
53
+
54
+ ```bash
55
+ pytest
56
+ ```
57
+
58
+ **Run CLI:**
59
+
60
+ ```bash
61
+ continuum check
62
+ continuum init --pack python-fastapi
63
+ ```
64
+
65
+ For a broader Windows + WSL2 dev setup (Terminal, Docker, Antigravity safety), see your preferred guide.
66
+
67
+ ## Quick start
68
+
69
+ ```bash
70
+ # Create config (optional: use a pack)
71
+ continuum init
72
+ continuum init --pack python-fastapi # or node-backend, typescript-monorepo
73
+
74
+ # Check current changes (git diff)
75
+ continuum check
76
+ continuum check --staged # only staged
77
+ continuum check --base origin/main # diff against branch
78
+
79
+ # Explain why a rule fired
80
+ continuum explain
81
+ continuum explain ban_lodash
82
+
83
+ # List active contracts
84
+ continuum inspect
85
+ ```
86
+
87
+ ## Config: `continuum.yaml`
88
+
89
+ ```yaml
90
+ version: 0.1
91
+ scopes:
92
+ - id: repo
93
+ match: ["**/*"]
94
+ contracts:
95
+ - type: ban
96
+ id: ban_lodash
97
+ match:
98
+ deps: ["lodash"]
99
+ message: "Use native JS or approved utils."
100
+ - type: ask_first
101
+ id: confirm_migrations
102
+ match:
103
+ paths: ["**/migrations/**"]
104
+ prompt: "Touching migrations. Confirm: (A) add-only (B) destructive (C) refactor"
105
+ - id: backend
106
+ match: ["backend/**"]
107
+ precedence: 10
108
+ contracts:
109
+ - type: require
110
+ id: require_tests
111
+ match:
112
+ paths: ["backend/**"]
113
+ require:
114
+ - kind: tests
115
+ hint: "Add or adjust unit tests for changed modules."
116
+ ```
117
+
118
+ Contract types: **ban** (deps/paths/commands), **require** (tests/logging/ADR), **ask_first** (confirmation gate), **define** (metadata).
119
+
120
+ ## Escape hatch
121
+
122
+ To skip checks (e.g. emergency hotfix), set `CONTINUUM_SKIP=1`; `continuum check` will exit 0 without running contracts. Prefer adjusting rules (e.g. `severity: warn`) in `continuum.yaml` when possible. See [docs/adoption.md](docs/adoption.md).
123
+
124
+ ## CI (GitHub Action)
125
+
126
+ ```yaml
127
+ - uses: actions/checkout@v4
128
+ with:
129
+ fetch-depth: 0
130
+ - uses: ./actions/continuum-check
131
+ with:
132
+ base_ref: ${{ github.event.pull_request.base.sha }}
133
+ ```
134
+
135
+ Or in another repo: `uses: your-org/continuum/actions/continuum-check@v0.1` (and install `continuum` via pip in the action).
136
+
137
+ ## Cursor / MCP
138
+
139
+ Run the MCP server so the Cursor agent can call `continuum_check` before applying changes:
140
+
141
+ ```bash
142
+ continuum mcp --transport stdio
143
+ ```
144
+
145
+ Add to Cursor MCP config:
146
+
147
+ ```json
148
+ {
149
+ "mcpServers": {
150
+ "continuum": {
151
+ "command": "continuum",
152
+ "args": ["mcp", "--transport", "stdio"]
153
+ }
154
+ }
155
+ }
156
+ ```
157
+
158
+ See [docs/cursor-mcp.md](docs/cursor-mcp.md) and [docs/demo.md](docs/demo.md) for setup and the “Refactor auth middleware” demo.
159
+
160
+ **Golden demo:** Run the 3 scenarios in [demo/README.md](demo/README.md) (dbt marts require, airflow ask-first, banned command) in under 10 minutes.
161
+
162
+ ## Packs
163
+
164
+ Starter configs:
165
+
166
+ - **node-backend** – Node/JS backend (ban lodash, require tests, ask on migrations).
167
+ - **python-fastapi** – FastAPI app (ban requests in favor of httpx, require tests, ask on migrations).
168
+ - **typescript-monorepo** – TS monorepo (ban lodash, require tests in packages).
169
+ - **data-dbt-airflow** – dbt + Airflow repos (ask_first on marts/DAGs, require tests on marts, ban risky commands).
170
+
171
+ ```bash
172
+ continuum init --pack python-fastapi
173
+ continuum init --pack data-dbt-airflow # dbt + Airflow
174
+ ```
175
+
176
+ ### 5-minute adoption (dbt + Airflow)
177
+
178
+ 1. `pip install continuum-code` (or `pip install -e .` from repo).
179
+ 2. `continuum init --pack data-dbt-airflow` → writes `continuum.yaml`.
180
+ 3. `continuum validate` → confirm the file is valid.
181
+ 4. `continuum check` (or `continuum check --base origin/main` for PRs).
182
+ 5. Add the GitHub Action for CI; optionally run `continuum mcp --transport stdio` for Cursor.
183
+
184
+ ## Next steps (after v0.1)
185
+
186
+ - Richer dependency detection (poetry, pnpm, pip-tools).
187
+ - Pattern bans (regex on diffs).
188
+ - Stricter “require” checks (e.g. tests touched when src touched).
189
+ - Decision diffs / supersession (v0.2).
190
+
191
+ ## License
192
+
193
+ MIT.
@@ -0,0 +1,37 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "continuum-code"
7
+ version = "0.2.0"
8
+ description = "Rule engine so coding agents obey repo rules (block/warn/ask) with clear explanations."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "MIT"
12
+ authors = [{ name = "Continuum" }]
13
+ dependencies = [
14
+ "pyyaml>=6.0",
15
+ "pydantic>=2.0",
16
+ "click>=8.0",
17
+ "mcp>=1.0",
18
+ ]
19
+
20
+ [project.optional-dependencies]
21
+ dev = [
22
+ "pytest>=7.0",
23
+ "pytest-cov>=4.0",
24
+ ]
25
+
26
+ [project.scripts]
27
+ continuum = "continuum.cli:main"
28
+
29
+ [tool.setuptools.packages.find]
30
+ where = ["src"]
31
+
32
+ [tool.setuptools.package-data]
33
+ continuum = ["packs/*/continuum.yaml", "packs/*/*/continuum.yaml", "packs/*/README.md"]
34
+
35
+ [tool.pytest.ini_options]
36
+ testpaths = ["tests"]
37
+ pythonpath = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,8 @@
1
+ """Continuum: rule engine so coding agents obey repo rules."""
2
+
3
+ from importlib.metadata import version as _version
4
+
5
+ try:
6
+ __version__ = _version("continuum-code")
7
+ except Exception:
8
+ __version__ = "0.2.0"