enterprise-claude-kit 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.
Files changed (26) hide show
  1. enterprise_claude_kit-0.1.0/.env.example +28 -0
  2. enterprise_claude_kit-0.1.0/.github/workflows/ci.yml +51 -0
  3. enterprise_claude_kit-0.1.0/.github/workflows/publish.yml +69 -0
  4. enterprise_claude_kit-0.1.0/.gitignore +56 -0
  5. enterprise_claude_kit-0.1.0/CONTRIBUTING.md +324 -0
  6. enterprise_claude_kit-0.1.0/PKG-INFO +558 -0
  7. enterprise_claude_kit-0.1.0/README.md +524 -0
  8. enterprise_claude_kit-0.1.0/docs/architecture.md +651 -0
  9. enterprise_claude_kit-0.1.0/docs/enterprise-deployment-guide.md +802 -0
  10. enterprise_claude_kit-0.1.0/docs/gxp-compliance-guide.md +907 -0
  11. enterprise_claude_kit-0.1.0/enterprise_claude/__init__.py +348 -0
  12. enterprise_claude_kit-0.1.0/enterprise_claude/adoption_tracker.py +569 -0
  13. enterprise_claude_kit-0.1.0/enterprise_claude/audit.py +594 -0
  14. enterprise_claude_kit-0.1.0/enterprise_claude/cli.py +1036 -0
  15. enterprise_claude_kit-0.1.0/enterprise_claude/governance.py +483 -0
  16. enterprise_claude_kit-0.1.0/enterprise_claude/mcp_connectors.py +421 -0
  17. enterprise_claude_kit-0.1.0/enterprise_claude/orchestrator.py +627 -0
  18. enterprise_claude_kit-0.1.0/enterprise_claude/token_monitor.py +617 -0
  19. enterprise_claude_kit-0.1.0/examples/basic_governed_agent.py +267 -0
  20. enterprise_claude_kit-0.1.0/examples/clinical_trial_agent.py +289 -0
  21. enterprise_claude_kit-0.1.0/examples/sdlc_accelerator.py +348 -0
  22. enterprise_claude_kit-0.1.0/pyproject.toml +81 -0
  23. enterprise_claude_kit-0.1.0/tests/__init__.py +1 -0
  24. enterprise_claude_kit-0.1.0/tests/test_governance.py +292 -0
  25. enterprise_claude_kit-0.1.0/tests/test_orchestrator.py +319 -0
  26. enterprise_claude_kit-0.1.0/tests/test_token_monitor.py +245 -0
@@ -0,0 +1,28 @@
1
+ # Anthropic API
2
+ ANTHROPIC_API_KEY=sk-ant-...
3
+
4
+ # Governance
5
+ ECL_PII_FILTER=true
6
+ ECL_GXP_MODE=false
7
+ ECL_MAX_PROMPT_LENGTH=100000
8
+
9
+ # Budget
10
+ ECL_DAILY_BUDGET_USD=100.0
11
+ ECL_ALERT_THRESHOLD_PCT=0.8
12
+
13
+ # Audit
14
+ ECL_AUDIT_DB_PATH=./audit.db
15
+ ECL_MONITOR_DB_PATH=./monitor.db
16
+ ECL_ADOPTION_DB_PATH=./adoption.db
17
+
18
+ # MCP Connectors (set only the ones you use)
19
+ GITHUB_TOKEN=ghp_...
20
+ JIRA_URL=https://your-org.atlassian.net
21
+ JIRA_TOKEN=...
22
+ JIRA_EMAIL=you@example.com
23
+ SLACK_BOT_TOKEN=xoxb-...
24
+ CONFLUENCE_URL=https://your-org.atlassian.net/wiki
25
+ CONFLUENCE_TOKEN=...
26
+ SHAREPOINT_TENANT_ID=...
27
+ SHAREPOINT_CLIENT_ID=...
28
+ SHAREPOINT_CLIENT_SECRET=...
@@ -0,0 +1,51 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main, dev]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ lint:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+
15
+ - uses: actions/setup-python@v5
16
+ with:
17
+ python-version: "3.11"
18
+
19
+ - name: Install package + dev deps (mypy needs them for type resolution)
20
+ run: pip install -e ".[dev]"
21
+
22
+ - name: Ruff — style & lint
23
+ run: python -m ruff check enterprise_claude/
24
+
25
+ - name: Mypy — type check
26
+ run: python -m mypy enterprise_claude/ --ignore-missing-imports
27
+
28
+ test:
29
+ runs-on: ubuntu-latest
30
+ strategy:
31
+ matrix:
32
+ python-version: ["3.11", "3.12"]
33
+
34
+ steps:
35
+ - uses: actions/checkout@v4
36
+
37
+ - uses: actions/setup-python@v5
38
+ with:
39
+ python-version: ${{ matrix.python-version }}
40
+
41
+ - name: Install dependencies
42
+ run: pip install -e ".[dev]"
43
+
44
+ - name: Run tests with coverage
45
+ run: python -m pytest --cov=enterprise_claude --cov-report=xml --cov-fail-under=50
46
+
47
+ - name: Upload coverage to Codecov
48
+ uses: codecov/codecov-action@v4
49
+ with:
50
+ file: ./coverage.xml
51
+ continue-on-error: true # Don't fail if Codecov token not configured yet
@@ -0,0 +1,69 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published] # Triggers when you create a GitHub Release
6
+
7
+ jobs:
8
+ # ── 1. Run tests first ──────────────────────────────────────────────────────
9
+ test:
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ matrix:
13
+ python-version: ["3.11", "3.12"]
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+
17
+ - uses: actions/setup-python@v5
18
+ with:
19
+ python-version: ${{ matrix.python-version }}
20
+
21
+ - name: Install dev dependencies
22
+ run: pip install -e ".[dev]"
23
+
24
+ - name: Run tests
25
+ run: pytest --cov=enterprise_claude --cov-report=term-missing
26
+
27
+ # ── 2. Build the distribution ───────────────────────────────────────────────
28
+ build:
29
+ needs: test
30
+ runs-on: ubuntu-latest
31
+ steps:
32
+ - uses: actions/checkout@v4
33
+
34
+ - uses: actions/setup-python@v5
35
+ with:
36
+ python-version: "3.11"
37
+
38
+ - name: Install build
39
+ run: pip install build
40
+
41
+ - name: Build wheel + sdist
42
+ run: python -m build
43
+
44
+ - name: Upload build artifacts
45
+ uses: actions/upload-artifact@v4
46
+ with:
47
+ name: dist
48
+ path: dist/
49
+
50
+ # ── 3. Publish to PyPI via Trusted Publisher (OIDC — no secrets needed) ────
51
+ publish:
52
+ needs: build
53
+ runs-on: ubuntu-latest
54
+ environment:
55
+ name: pypi
56
+ url: https://pypi.org/p/enterprise-claude-kit
57
+ permissions:
58
+ id-token: write # Required for OIDC Trusted Publisher
59
+
60
+ steps:
61
+ - name: Download build artifacts
62
+ uses: actions/download-artifact@v4
63
+ with:
64
+ name: dist
65
+ path: dist/
66
+
67
+ - name: Publish to PyPI
68
+ uses: pypa/gh-action-pypi-publish@release/v1
69
+ # No username/password — OIDC token is auto-used
@@ -0,0 +1,56 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+
8
+ # Virtual environments
9
+ .venv/
10
+ venv/
11
+ env/
12
+ ENV/
13
+
14
+ # Build / dist
15
+ dist/
16
+ build/
17
+ *.egg-info/
18
+ *.egg
19
+ .eggs/
20
+
21
+ # PyPI / Hatch
22
+ .hatch/
23
+
24
+ # Testing
25
+ .pytest_cache/
26
+ .coverage
27
+ coverage.xml
28
+ htmlcov/
29
+
30
+ # Type checking / linting
31
+ .mypy_cache/
32
+ .ruff_cache/
33
+
34
+ # Environment / secrets
35
+ .env
36
+ .env.local
37
+ *.env
38
+
39
+ # SQLite databases (runtime data — not for source control)
40
+ *.db
41
+ *.sqlite
42
+ *.sqlite3
43
+
44
+ # IDE
45
+ .vscode/
46
+ .idea/
47
+ *.swp
48
+ *.swo
49
+
50
+ # OS
51
+ .DS_Store
52
+ Thumbs.db
53
+
54
+ # Logs
55
+ *.log
56
+ logs/
@@ -0,0 +1,324 @@
1
+ # Contributing to enterprise-claude-kit
2
+
3
+ Thank you for taking the time to contribute. This document explains how to get from zero to a merged pull request as quickly as possible.
4
+
5
+ ---
6
+
7
+ ## Table of Contents
8
+
9
+ 1. [Dev environment setup](#1-dev-environment-setup)
10
+ 2. [Running the test suite](#2-running-the-test-suite)
11
+ 3. [Code style](#3-code-style)
12
+ 4. [Project structure](#4-project-structure)
13
+ 5. [PR guidelines](#5-pr-guidelines)
14
+ 6. [Reporting issues](#6-reporting-issues)
15
+ 7. [Release process](#7-release-process)
16
+
17
+ ---
18
+
19
+ ## 1. Dev environment setup
20
+
21
+ **Requirements:** Python 3.11 or 3.12, Git.
22
+
23
+ ```bash
24
+ # 1. Fork the repo on GitHub, then clone your fork
25
+ git clone https://github.com/<your-handle>/enterprise-claude-kit.git
26
+ cd enterprise-claude-kit
27
+
28
+ # 2. Create an isolated virtual environment
29
+ python -m venv .venv
30
+ source .venv/bin/activate # Windows: .venv\Scripts\activate
31
+
32
+ # 3. Install the package in editable mode with all dev dependencies
33
+ pip install -e ".[dev]"
34
+
35
+ # 4. Copy the example env file and add your API key
36
+ cp .env.example .env
37
+ # Edit .env → set ANTHROPIC_API_KEY=sk-ant-…
38
+
39
+ # 5. Verify everything works
40
+ python -m pytest --tb=short -q
41
+ ```
42
+
43
+ You should see `66 passed` (or more, if tests have been added). If anything fails before you have made any changes, open an issue — that is a bug in the project setup, not your environment.
44
+
45
+ ### Optional: pre-commit hooks
46
+
47
+ ```bash
48
+ pip install pre-commit
49
+ pre-commit install
50
+ ```
51
+
52
+ This installs git hooks that run `ruff` and `mypy` automatically before each commit, so you catch issues before pushing.
53
+
54
+ ---
55
+
56
+ ## 2. Running the test suite
57
+
58
+ ### All tests
59
+
60
+ ```bash
61
+ python -m pytest
62
+ ```
63
+
64
+ ### Specific module
65
+
66
+ ```bash
67
+ python -m pytest tests/test_governance.py -v
68
+ ```
69
+
70
+ ### With coverage report
71
+
72
+ ```bash
73
+ python -m pytest --cov=enterprise_claude --cov-report=term-missing
74
+ ```
75
+
76
+ ### Skip tests that require an API key
77
+
78
+ Tests that make real Anthropic API calls are decorated with `@pytest.mark.skipif(not os.getenv("ANTHROPIC_API_KEY"), ...)`. They run when the key is present and are silently skipped otherwise — so the full suite is always runnable offline.
79
+
80
+ ### mypy
81
+
82
+ ```bash
83
+ python -m mypy enterprise_claude/ --python-version 3.12 --ignore-missing-imports
84
+ ```
85
+
86
+ Expected output: `Success: no issues found in 8 source files`.
87
+
88
+ ### ruff
89
+
90
+ ```bash
91
+ python -m ruff check . # lint
92
+ python -m ruff check . --fix # auto-fix safe issues
93
+ ```
94
+
95
+ Expected output: `All checks passed!`
96
+
97
+ ### Run everything at once (mirrors CI)
98
+
99
+ ```bash
100
+ python -m ruff check . && \
101
+ python -m mypy enterprise_claude/ --python-version 3.12 --ignore-missing-imports && \
102
+ python -m pytest --tb=short -q
103
+ ```
104
+
105
+ All three must exit `0` before you open a PR.
106
+
107
+ ---
108
+
109
+ ## 3. Code style
110
+
111
+ The project enforces style mechanically so humans don't have to argue about it.
112
+
113
+ ### Formatting and lint — ruff
114
+
115
+ Configuration lives in `pyproject.toml` (`[tool.ruff]`). Key rules:
116
+
117
+ | Rule group | What it enforces |
118
+ |------------|------------------|
119
+ | `E`, `W` | PEP 8 whitespace and style |
120
+ | `F` | pyflakes — unused imports, undefined names |
121
+ | `I` | isort import ordering |
122
+ | `UP` | pyupgrade — prefer modern syntax (`X \| Y`, `datetime.UTC`) |
123
+ | `RUF` | Ruff-specific rules (`__all__` ordering, etc.) |
124
+ | `S` | bandit — common security anti-patterns |
125
+ | `ASYNC` | asyncio correctness |
126
+ | `BLE` | ban bare `except Exception` without justification |
127
+ | `SIM` | simplification — collapse nested `with`, redundant conditions |
128
+
129
+ If a rule fires on code that is deliberately non-standard, suppress it with an inline comment **and a reason**:
130
+
131
+ ```python
132
+ with open(path, "w") as fh: # noqa: ASYNC230 — intentional blocking write; no trio dep
133
+ ```
134
+
135
+ Bare `# noqa` without a code is not accepted.
136
+
137
+ ### Type annotations — mypy
138
+
139
+ - All public functions and methods must be fully annotated (parameters + return type).
140
+ - Use built-in generic syntax (`list[str]`, `dict[str, Any]`, `X | Y`) — not `List`, `Dict`, `Optional`, `Union`.
141
+ - `Any` is allowed only where a third-party type is genuinely unknown. Add a comment explaining why.
142
+ - `# type: ignore` requires a narrowing code (`# type: ignore[assignment]`) and a one-line comment.
143
+
144
+ ### General style conventions
145
+
146
+ ```python
147
+ # ✅ Good — explicit, no ambiguity
148
+ async def get_cost_summary(
149
+ self,
150
+ start_date: datetime,
151
+ end_date: datetime,
152
+ ) -> CostSummary:
153
+ ...
154
+
155
+ # ❌ Avoid — implicit return type, no annotation on param
156
+ async def get_cost_summary(self, start, end):
157
+ ...
158
+ ```
159
+
160
+ - **Line length:** 100 characters (enforced by ruff).
161
+ - **Docstrings:** Google style for public classes and functions. One-liners are fine for simple helpers.
162
+ - **Async:** All I/O must be async. Never call blocking functions (file open, `requests`, `time.sleep`) inside an `async def` without `# noqa: ASYNC230` justification.
163
+ - **Pydantic models:** Use `model_config = ConfigDict(...)` — not the deprecated `class Config` inner class.
164
+ - **Exceptions:** Raise specific subclasses of `EnterpriseClaudeError`. Never raise bare `Exception` or `RuntimeError` from library code.
165
+ - **Logging:** Use the module-level `logger = logging.getLogger(__name__)` pattern. No `print()` in library code (examples and CLI are exempt).
166
+
167
+ ---
168
+
169
+ ## 4. Project structure
170
+
171
+ ```
172
+ enterprise_claude/ ← library source (the pip-installable package)
173
+
174
+ ├── __init__.py ← public API re-exports + exception hierarchy
175
+ ├── governance.py ← GovernanceLayer, GovernanceConfig, GovernanceResult
176
+ ├── orchestrator.py ← AgentOrchestrator, Agent
177
+ ├── token_monitor.py ← TokenMonitor, MonitorConfig, BudgetStatus, CostSummary
178
+ ├── audit.py ← AuditLogger, AuditEvent, AuditFilter
179
+ ├── adoption_tracker.py ← AdoptionTracker, Wave, WaveProgress, Persona
180
+ ├── mcp_connectors.py ← MCPConnectorRegistry, ConnectorConfig, AuthType
181
+ └── cli.py ← `ecl` Typer CLI
182
+
183
+ tests/ ← pytest suite (mirrors the source structure)
184
+ ├── test_governance.py
185
+ ├── test_orchestrator.py
186
+ └── test_token_monitor.py
187
+
188
+ examples/ ← runnable demos (require ANTHROPIC_API_KEY)
189
+ ├── basic_governed_agent.py
190
+ ├── clinical_trial_agent.py
191
+ └── sdlc_accelerator.py ← offline, no API key needed
192
+
193
+ .github/workflows/
194
+ ├── ci.yml ← lint + type-check + test on every push/PR
195
+ └── publish.yml ← build + publish on version tags
196
+ ```
197
+
198
+ ### Where to add new code
199
+
200
+ | What you're adding | Where it goes |
201
+ |--------------------|---------------|
202
+ | New governance policy | `governance.py` — extend `GovernanceLayer` or add a hook |
203
+ | New cost metric | `token_monitor.py` — extend `CostSummary` or `MonitorConfig` |
204
+ | New audit query | `audit.py` — extend `AuditFilter` |
205
+ | New wave feature | `adoption_tracker.py` |
206
+ | New MCP connector | `mcp_connectors.py` — add to `_BUILTIN_CONNECTORS` dict |
207
+ | New CLI command | `cli.py` — add a Typer command group |
208
+ | New public class/function | Re-export from `__init__.py` and add to `__all__` |
209
+
210
+ ---
211
+
212
+ ## 5. PR guidelines
213
+
214
+ ### Before you open a PR
215
+
216
+ - [ ] `python -m ruff check .` → clean
217
+ - [ ] `python -m mypy enterprise_claude/ --python-version 3.12 --ignore-missing-imports` → clean
218
+ - [ ] `python -m pytest --tb=short -q` → all passing
219
+ - [ ] New behaviour has tests; bug fixes have a regression test
220
+ - [ ] Docstrings updated for any changed public API
221
+ - [ ] `CHANGELOG.md` entry added under `## Unreleased` (if it exists)
222
+
223
+ ### PR title format
224
+
225
+ Use [Conventional Commits](https://www.conventionalcommits.org/) style:
226
+
227
+ ```
228
+ feat: add PII redaction to audit event payloads
229
+ fix: handle None return from aiosqlite fetchone()
230
+ docs: add GxP mode example to README
231
+ chore: bump ruff to 0.5
232
+ test: add regression for WaveGateError threshold edge case
233
+ ```
234
+
235
+ The type prefix (`feat`, `fix`, `docs`, `chore`, `test`, `refactor`, `perf`) is used to auto-generate the GitHub Release changelog, so please be precise.
236
+
237
+ ### PR description
238
+
239
+ Use this template:
240
+
241
+ ```markdown
242
+ ## What and why
243
+
244
+ <!-- One paragraph. What does this PR do, and why is it needed? -->
245
+
246
+ ## How
247
+
248
+ <!-- Brief description of the implementation approach. -->
249
+
250
+ ## Testing
251
+
252
+ <!-- How did you verify this works? Which test(s) cover it? -->
253
+
254
+ ## Breaking changes
255
+
256
+ <!-- None / list any API changes that require a major version bump. -->
257
+ ```
258
+
259
+ ### Review process
260
+
261
+ - All PRs require at least one approving review before merge.
262
+ - CI must be green (ruff + mypy + pytest on both Python 3.11 and 3.12).
263
+ - Prefer small, focused PRs over large ones — they review faster and are easier to revert if something goes wrong.
264
+ - Squash-merge is the default strategy; your commit history within the branch does not need to be clean.
265
+
266
+ ---
267
+
268
+ ## 6. Reporting issues
269
+
270
+ ### Bug reports
271
+
272
+ Please include:
273
+
274
+ 1. **Python version** (`python --version`)
275
+ 2. **Package version** (`pip show enterprise-claude-kit`)
276
+ 3. **Minimal reproducible example** — the shortest code that triggers the bug
277
+ 4. **Full traceback** — paste it, don't summarise it
278
+ 5. **Expected vs. actual behaviour**
279
+
280
+ ### Feature requests
281
+
282
+ Open an issue tagged `enhancement`. Describe:
283
+
284
+ - The problem you're trying to solve (not just the solution you want)
285
+ - Any workaround you're currently using
286
+ - Whether you'd like to implement it yourself
287
+
288
+ For significant API changes, discuss in an issue **before** opening a PR — it saves everyone time if the approach needs rethinking.
289
+
290
+ ---
291
+
292
+ ## 7. Release process
293
+
294
+ Releases are made by maintainers. The process is:
295
+
296
+ ```bash
297
+ # 1. Update version in pyproject.toml
298
+ # version = "0.2.0"
299
+
300
+ # 2. Update CHANGELOG.md — move "Unreleased" items under "## v0.2.0 (YYYY-MM-DD)"
301
+
302
+ # 3. Commit
303
+ git add pyproject.toml CHANGELOG.md
304
+ git commit -m "chore: release v0.2.0"
305
+
306
+ # 4. Tag — this triggers the publish workflow
307
+ git tag v0.2.0
308
+ git push origin main --tags
309
+ ```
310
+
311
+ The `publish.yml` workflow then:
312
+ 1. Runs the full CI suite
313
+ 2. Verifies the git tag matches `pyproject.toml`
314
+ 3. Builds the wheel and sdist with hatchling
315
+ 4. Publishes to PyPI via OIDC trusted publisher
316
+ 5. Creates a GitHub Release with auto-generated notes
317
+
318
+ **Do not push version tags without a passing CI run.** The workflow will fail at step 1 and leave a broken tag in the repo.
319
+
320
+ ---
321
+
322
+ ## Code of Conduct
323
+
324
+ Be kind. Be direct. Critique code, not people. We are all here to build something useful.