kantrip 0.1.0a1__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.
- kantrip-0.1.0a1/.gitignore +67 -0
- kantrip-0.1.0a1/AGENT.md +111 -0
- kantrip-0.1.0a1/ARCHITECTURE.md +51 -0
- kantrip-0.1.0a1/COMPATIBILITY.md +25 -0
- kantrip-0.1.0a1/DEVELOPMENT.md +228 -0
- kantrip-0.1.0a1/LICENSE +21 -0
- kantrip-0.1.0a1/MVP.md +52 -0
- kantrip-0.1.0a1/PKG-INFO +165 -0
- kantrip-0.1.0a1/README.md +135 -0
- kantrip-0.1.0a1/RELEASE_CHECKLIST.md +108 -0
- kantrip-0.1.0a1/SECURITY.md +59 -0
- kantrip-0.1.0a1/THREAT_MODEL.md +58 -0
- kantrip-0.1.0a1/USAGE.md +414 -0
- kantrip-0.1.0a1/examples/config.yaml +12 -0
- kantrip-0.1.0a1/kantrip/__init__.py +24 -0
- kantrip-0.1.0a1/kantrip/_files.py +18 -0
- kantrip-0.1.0a1/kantrip/adapters.py +278 -0
- kantrip-0.1.0a1/kantrip/cli.py +162 -0
- kantrip-0.1.0a1/kantrip/config.py +225 -0
- kantrip-0.1.0a1/kantrip/console.py +116 -0
- kantrip-0.1.0a1/kantrip/doctor.py +299 -0
- kantrip-0.1.0a1/kantrip/redaction.py +55 -0
- kantrip-0.1.0a1/kantrip/session.py +185 -0
- kantrip-0.1.0a1/kantrip/shells.py +213 -0
- kantrip-0.1.0a1/pyproject.toml +103 -0
- kantrip-0.1.0a1/schemas/profile.schema.json +103 -0
- kantrip-0.1.0a1/scripts/__init__.py +180 -0
- kantrip-0.1.0a1/scripts/analyze.py +18 -0
- kantrip-0.1.0a1/scripts/banner.py +102 -0
- kantrip-0.1.0a1/scripts/styles.py +15 -0
- kantrip-0.1.0a1/scripts/tests.py +17 -0
- kantrip-0.1.0a1/scripts/verify_release.py +87 -0
- kantrip-0.1.0a1/scripts/verify_shell_contract.py +287 -0
- kantrip-0.1.0a1/tests/__init__.py +1 -0
- kantrip-0.1.0a1/tests/tests_cli.py +182 -0
- kantrip-0.1.0a1/tests/tests_config.py +129 -0
- kantrip-0.1.0a1/tests/tests_console.py +135 -0
- kantrip-0.1.0a1/tests/tests_doctor.py +143 -0
- kantrip-0.1.0a1/tests/tests_redaction.py +31 -0
- kantrip-0.1.0a1/tests/tests_sandbox.py +43 -0
- kantrip-0.1.0a1/tests/tests_schemas.py +76 -0
- kantrip-0.1.0a1/tests/tests_scripts.py +76 -0
- kantrip-0.1.0a1/tests/tests_session.py +477 -0
- kantrip-0.1.0a1/tests/tests_shells.py +124 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
##### github.com: Python.gitignore #####
|
|
2
|
+
|
|
3
|
+
__pycache__/
|
|
4
|
+
*.py[cod]
|
|
5
|
+
*$py.class
|
|
6
|
+
*.so
|
|
7
|
+
|
|
8
|
+
# Distribution / packaging
|
|
9
|
+
.Python
|
|
10
|
+
build/
|
|
11
|
+
develop-eggs/
|
|
12
|
+
dist/
|
|
13
|
+
downloads/
|
|
14
|
+
eggs/
|
|
15
|
+
.eggs/
|
|
16
|
+
lib/
|
|
17
|
+
lib64/
|
|
18
|
+
parts/
|
|
19
|
+
sdist/
|
|
20
|
+
var/
|
|
21
|
+
wheels/
|
|
22
|
+
share/python-wheels/
|
|
23
|
+
*.egg-info/
|
|
24
|
+
.installed.cfg
|
|
25
|
+
*.egg
|
|
26
|
+
MANIFEST
|
|
27
|
+
|
|
28
|
+
# Unit test / coverage reports
|
|
29
|
+
htmlcov/
|
|
30
|
+
.tox/
|
|
31
|
+
.nox/
|
|
32
|
+
.coverage
|
|
33
|
+
.coverage.*
|
|
34
|
+
.cache
|
|
35
|
+
.pytest_cache/
|
|
36
|
+
coverage.xml
|
|
37
|
+
|
|
38
|
+
# Environments and local secrets
|
|
39
|
+
.env
|
|
40
|
+
!sandbox/.env
|
|
41
|
+
.venv/
|
|
42
|
+
.release-venv/
|
|
43
|
+
env/
|
|
44
|
+
venv/
|
|
45
|
+
ENV/
|
|
46
|
+
|
|
47
|
+
# Type and lint caches
|
|
48
|
+
.mypy_cache/
|
|
49
|
+
.dmypy.json
|
|
50
|
+
.ruff_cache/
|
|
51
|
+
.hypothesis/
|
|
52
|
+
|
|
53
|
+
# Editors and operating systems
|
|
54
|
+
.vscode/
|
|
55
|
+
.idea/
|
|
56
|
+
.DS_Store
|
|
57
|
+
|
|
58
|
+
# Local Kantrip state must never enter the repository
|
|
59
|
+
.kantrip/
|
|
60
|
+
kantrip-local/
|
|
61
|
+
*.pem
|
|
62
|
+
*.key
|
|
63
|
+
*.p12
|
|
64
|
+
*.jks
|
|
65
|
+
|
|
66
|
+
# Internal planning notes
|
|
67
|
+
KANTRIP_MVP_PLAN.md
|
kantrip-0.1.0a1/AGENT.md
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# Agent Instructions
|
|
2
|
+
|
|
3
|
+
## Engineering Contract
|
|
4
|
+
|
|
5
|
+
- Treat this file as living operational knowledge. When work establishes or
|
|
6
|
+
changes a durable convention, update this guidance and every affected guide,
|
|
7
|
+
schema, fixture, example, issue template, and command sample. Rewrite obsolete
|
|
8
|
+
or duplicate guidance instead of appending contradictions.
|
|
9
|
+
- Do not add empty modules or speculative adapters. Keep cyclomatic complexity
|
|
10
|
+
at or below 10; repository-wide Ruff `C901` runs in `scripts.analyze`, so use
|
|
11
|
+
focused helpers instead of suppressions.
|
|
12
|
+
- Importing `kantrip` must not create directories, open files, configure logging,
|
|
13
|
+
construct consoles, or contact Kafka. Classify and redact values before
|
|
14
|
+
presentation, and keep command behavior independent from Rich.
|
|
15
|
+
- Support Linux and macOS on Python 3.10 through 3.14. Keep paths, permissions,
|
|
16
|
+
signals, terminals, and shell documentation portable.
|
|
17
|
+
- Keep unimplemented product work in `MVP.md`, not in current feature docs,
|
|
18
|
+
schemas, examples, commands, or implementation comments.
|
|
19
|
+
|
|
20
|
+
## Profiles and Sessions
|
|
21
|
+
|
|
22
|
+
- The profile schema lives in `schemas/`, examples in `examples/`, and synthetic
|
|
23
|
+
test data inside its owning test module. Keep it limited to implemented
|
|
24
|
+
behavior and synchronize examples, tests, and migration notes when it changes.
|
|
25
|
+
Schema filenames and configuration documents do not duplicate the application
|
|
26
|
+
version; the schema shipped by an application release is authoritative.
|
|
27
|
+
- Treat the environment documented in `USAGE.md` as public API. Add variables
|
|
28
|
+
compatibly; renames or semantic breaks require release and migration guidance.
|
|
29
|
+
Use `KAFKA_*` for application values and reserve `KANTRIP_*` for
|
|
30
|
+
Kantrip-owned profile/session metadata.
|
|
31
|
+
- `kantrip add` creates missing configuration. Add/remove operations are validated
|
|
32
|
+
and atomic, adding an existing profile never overwrites it, and listing missing
|
|
33
|
+
configuration returns an empty collection.
|
|
34
|
+
- Inject the documented environment only into supervised children; never mutate
|
|
35
|
+
the caller's environment or add a separate JSON schema for environment values.
|
|
36
|
+
- Reject `kantrip exec` when `KANTRIP_SESSION_ID` identifies an active parent
|
|
37
|
+
session. The schema and execution accept only `transport: plaintext` with
|
|
38
|
+
`auth.type: none`.
|
|
39
|
+
|
|
40
|
+
## Client Adapters and Shells
|
|
41
|
+
|
|
42
|
+
- kcat is the first supported client. Sessions expose private generated librdkafka
|
|
43
|
+
properties through `KCAT_CONFIG`; interactive shims preserve this contract and
|
|
44
|
+
reject client attempts to override it with `-F`. Never place configuration
|
|
45
|
+
values in command arguments.
|
|
46
|
+
- Official Kafka tools recognize names with and without `.sh`. All receive
|
|
47
|
+
`--bootstrap-server`; consumers/producers receive their client config option,
|
|
48
|
+
and administrative tools receive `--command-config`, pointing at the private
|
|
49
|
+
generated Java properties file.
|
|
50
|
+
- Kaskade `admin` and `consumer` receive a private INI file through
|
|
51
|
+
`--config-file`. Do not assume a Kaskade environment variable until Kaskade
|
|
52
|
+
implements that contract.
|
|
53
|
+
- Interactive sessions support Bash, Zsh, and Fish. They load normal user startup
|
|
54
|
+
files, preserve normal history, neutralize aliases/functions/Fish abbreviations
|
|
55
|
+
for registered adapters, and restore the session shim path. Shims are private
|
|
56
|
+
and temporary; never install persistent aliases.
|
|
57
|
+
- Adapters must reject connection arguments that override the selected profile.
|
|
58
|
+
|
|
59
|
+
## Sensitive Values and Output
|
|
60
|
+
|
|
61
|
+
- Never expose sensitive values in arguments, fixtures, logs, output,
|
|
62
|
+
diagnostics, tracebacks, or snapshots. Examples use conspicuously synthetic
|
|
63
|
+
values and infrastructure.
|
|
64
|
+
- Send command results to stdout and diagnostics to stderr. Styling respects
|
|
65
|
+
`NO_COLOR`, `TERM=dumb`, `--no-color`, and non-TTY output; use text status labels
|
|
66
|
+
instead of emoji when styling is disabled.
|
|
67
|
+
|
|
68
|
+
## Tests, Scripts, and Sandbox
|
|
69
|
+
|
|
70
|
+
- Tests and their fixtures live in `tests` and remain offline. Shared workflow
|
|
71
|
+
helpers belong in `scripts/__init__.py`; other script modules are executable
|
|
72
|
+
workflows.
|
|
73
|
+
- The manual environment lives in `sandbox`, including Compose definitions,
|
|
74
|
+
versions, synthetic data, and population tools. Tests may inspect pinned image
|
|
75
|
+
versions and Compose structure, but sandbox code and test fixtures must not
|
|
76
|
+
import each other.
|
|
77
|
+
- `python -m sandbox` runs the adapter smoke workflow against an active sandbox
|
|
78
|
+
with locally installed clients and optional shells. It is a pre-commit hook,
|
|
79
|
+
not an offline or packaged E2E test.
|
|
80
|
+
- `python -m scripts.verify_shell_contract` verifies Bash, Zsh, and Fish with
|
|
81
|
+
PTYs and generated fake clients. Assertions stay in Python; its temporary event
|
|
82
|
+
logs contain only safe metadata and are removed with their temporary directory.
|
|
83
|
+
|
|
84
|
+
## Verification
|
|
85
|
+
|
|
86
|
+
Run these checks after code, environment, schema, tooling, or documentation work:
|
|
87
|
+
|
|
88
|
+
```text
|
|
89
|
+
uv run --locked python -m scripts.analyze
|
|
90
|
+
uv run --locked python -m scripts.tests
|
|
91
|
+
uv build --clear
|
|
92
|
+
uv run --locked python -m scripts.verify_release dist
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Regenerate `images/banner.svg` with `uv run --locked python -m scripts.banner`
|
|
96
|
+
when the banner, console theme, or SVG helper changes.
|
|
97
|
+
|
|
98
|
+
## Releases and Contributions
|
|
99
|
+
|
|
100
|
+
- Annotated `vMAJOR.MINOR.PATCH` and `vMAJOR.MINOR.PATCHaN` tags on `main` are
|
|
101
|
+
the only release version source; Hatchling and hatch-vcs derive package
|
|
102
|
+
metadata from Git. GitHub Releases are the canonical changelog, so do not add
|
|
103
|
+
maintained changelogs or version-bump commits.
|
|
104
|
+
- Never hard-code the current release version in documentation, templates,
|
|
105
|
+
examples, or commands. Use `kantrip --version`, `MAJOR.MINOR.PATCH`, or Git
|
|
106
|
+
metadata so releases need no follow-up edits.
|
|
107
|
+
- Commits and pull-request titles use Conventional Commits:
|
|
108
|
+
`<type>(<optional scope>): <imperative summary>`. Keep the summary short and do
|
|
109
|
+
not use it as a change list.
|
|
110
|
+
- End commit messages and pull-request descriptions with a blank line followed by
|
|
111
|
+
`Assisted-by: <AI model> <version>`, using the actual model and version.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Architecture Decisions
|
|
2
|
+
|
|
3
|
+
This document records behavior implemented by Kantrip today. Planned design is
|
|
4
|
+
kept in `MVP.md` until it is implemented.
|
|
5
|
+
|
|
6
|
+
## Plaintext profiles
|
|
7
|
+
|
|
8
|
+
Profiles contain non-secret Kafka broker metadata. The bundled schema accepts
|
|
9
|
+
only plaintext transport without authentication, plus descriptions, labels, and
|
|
10
|
+
Java or librdkafka client properties. Profile updates are schema-validated and
|
|
11
|
+
atomically replace the configuration file with mode `0600`.
|
|
12
|
+
|
|
13
|
+
The configuration path follows `KANTRIP_CONFIG`, then `XDG_CONFIG_HOME`, then
|
|
14
|
+
`~/.config/kantrip/config.yaml`. Profile names and paths are treated as untrusted
|
|
15
|
+
input, and profile display passes through the redaction layer.
|
|
16
|
+
|
|
17
|
+
## Kantrip sessions
|
|
18
|
+
|
|
19
|
+
`kantrip exec` runs one command or interactive Bash, Zsh, or Fish subshell for a
|
|
20
|
+
selected profile. Nested sessions are rejected. Each session uses a randomly
|
|
21
|
+
named temporary directory containing private generated client configuration and,
|
|
22
|
+
for interactive shells, adapter shims. Python's temporary-directory lifecycle
|
|
23
|
+
removes those artifacts when the supervised command returns.
|
|
24
|
+
|
|
25
|
+
The child receives `KANTRIP_PROFILE`, `KANTRIP_SESSION_ID`, and
|
|
26
|
+
`KANTRIP_SESSION_DIR`; the caller's parent environment is never modified. The
|
|
27
|
+
child also receives the documented plaintext `KAFKA_*` and `KCAT_CONFIG` values.
|
|
28
|
+
|
|
29
|
+
## Client adapters
|
|
30
|
+
|
|
31
|
+
Supported adapters inject the selected bootstrap servers and generated client
|
|
32
|
+
configuration using each tool's native interface. kcat reads `KCAT_CONFIG`,
|
|
33
|
+
official Kafka commands receive connection and properties-file arguments, and
|
|
34
|
+
Kaskade `admin` and `consumer` receive a generated INI file. Options that would
|
|
35
|
+
override the selected profile are rejected.
|
|
36
|
+
|
|
37
|
+
Interactive shells load the user's normal startup configuration and history.
|
|
38
|
+
Kantrip then removes aliases, functions, and Fish abbreviations that shadow
|
|
39
|
+
supported client names, restores the session shim directory at the front of
|
|
40
|
+
`PATH`, and refreshes command lookup.
|
|
41
|
+
|
|
42
|
+
## Diagnostics and output
|
|
43
|
+
|
|
44
|
+
`kantrip doctor` performs read-only local checks. It validates configuration,
|
|
45
|
+
file permissions, profile IDs, runtime support, active-session state, shim-path
|
|
46
|
+
precedence, and installed client commands without contacting Kafka.
|
|
47
|
+
|
|
48
|
+
Kantrip executes children directly with argument arrays. Normal command output
|
|
49
|
+
and diagnostics remain separate, sensitive-looking values are redacted before
|
|
50
|
+
presentation, and styling follows terminal capability, `NO_COLOR`, `TERM=dumb`,
|
|
51
|
+
and `--no-color`.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Command compatibility
|
|
2
|
+
|
|
3
|
+
Kantrip recognizes commands by executable basename. Apache Kafka 2.6 is the
|
|
4
|
+
oldest CLI surface Kantrip guarantees; newer clients can connect to older brokers
|
|
5
|
+
subject to Apache Kafka's normal client/broker compatibility. Both unsuffixed
|
|
6
|
+
commands and the `.sh` variants shipped in Apache Kafka distributions are
|
|
7
|
+
supported.
|
|
8
|
+
|
|
9
|
+
Interactive sessions support Bash, Zsh, and Fish on Linux and macOS. Kantrip
|
|
10
|
+
loads normal user startup configuration and history, then restores its temporary
|
|
11
|
+
adapter executables after startup-time aliases, functions, abbreviations, and
|
|
12
|
+
`PATH` changes. When `SHELL` is unset, an installed Bash is used. Other shells
|
|
13
|
+
are not supported.
|
|
14
|
+
|
|
15
|
+
| Supported command | CLI version | Kafka behavior | Notes |
|
|
16
|
+
| --- | --- | --- | --- |
|
|
17
|
+
| `kafka-console-consumer[.sh]` | Apache Kafka 2.6–4.3 | Consume records | Injects `--bootstrap-server` and `--consumer.config`; Kafka 4.3 deprecates the config flag ahead of its planned Kafka 5.0 removal. |
|
|
18
|
+
| `kafka-console-producer[.sh]` | Apache Kafka 2.6–4.3 | Produce records | Injects `--bootstrap-server` and `--producer.config`; Kafka 4.3 deprecates the config flag ahead of its planned Kafka 5.0 removal. |
|
|
19
|
+
| `kafka-topics[.sh]` | Apache Kafka 2.6+ | Create, list, describe, alter, and delete topics | Injects `--bootstrap-server` and `--command-config`. |
|
|
20
|
+
| `kafka-consumer-groups[.sh]` | Apache Kafka 2.6+ | Inspect and manage consumer groups | Injects `--bootstrap-server` and `--command-config`. |
|
|
21
|
+
| `kafka-configs[.sh]` | Apache Kafka 2.6+ | Inspect and alter supported dynamic configurations | Injects `--bootstrap-server` and `--command-config`; broker authorization still applies. |
|
|
22
|
+
| `kafka-acls[.sh]` | Apache Kafka 2.6+ | List, add, and remove ACLs | Injects `--bootstrap-server` and `--command-config`; requires a configured authorizer and an authorized principal. |
|
|
23
|
+
| `kafka-broker-api-versions[.sh]` | Apache Kafka 2.6+ | Inspect broker protocol versions | Injects `--bootstrap-server` and `--command-config`. |
|
|
24
|
+
| `kcat` / `kafkacat` | kcat 1.7+ | Metadata, produce, and consume | Uses a private `KCAT_CONFIG`; explicit `-F` is rejected. |
|
|
25
|
+
| `kaskade` | Kaskade 4.0+ | Administer and consume | Uses a private INI file for `admin` and `consumer`. |
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
# Development Instructions
|
|
2
|
+
|
|
3
|
+
## Setup
|
|
4
|
+
|
|
5
|
+
Install uv:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
9
|
+
# or on macOS
|
|
10
|
+
brew install uv
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Create the project environment and install locked development dependencies:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
uv sync --locked
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The project is installed in editable mode. Run the CLI with:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
uv run kantrip --help
|
|
23
|
+
uv run kantrip --version
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Install pre-commit hooks with:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
uv run pre-commit install
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Scripts
|
|
33
|
+
|
|
34
|
+
Apply code styles:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
uv run python -m scripts.styles
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Run type, formatting, lint, spelling, and workflow analysis:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
uv run python -m scripts.analyze
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Run the offline unit tests:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
uv run python -m scripts.tests
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Generate the deterministic Rich README banner:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
uv run python -m scripts.banner
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Reusable script code belongs in `scripts/__init__.py`; individual modules are
|
|
59
|
+
executable workflows. Tests and fixture utilities remain under their owning test
|
|
60
|
+
suite, and manual-environment utilities remain under `sandbox`. The sandbox smoke
|
|
61
|
+
command is intentionally separate from the offline test suite.
|
|
62
|
+
|
|
63
|
+
## Schema and application environment
|
|
64
|
+
|
|
65
|
+
The profile JSON Schema lives in `schemas/`. Synthetic user-facing examples live
|
|
66
|
+
in `examples/`. Test-owned fixture copies live under `tests` and must never
|
|
67
|
+
contain private infrastructure details.
|
|
68
|
+
|
|
69
|
+
Application environment variables are documented in `USAGE.md`. When a variable
|
|
70
|
+
changes, update the usage and architecture documentation and the relevant tests
|
|
71
|
+
together.
|
|
72
|
+
|
|
73
|
+
## Build artifacts
|
|
74
|
+
|
|
75
|
+
Build the wheel and source distribution:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
uv build --clear
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Verify versions, entry points, the packaged profile schema, public examples, and
|
|
82
|
+
required documentation:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
uv run --locked python -m scripts.verify_release dist
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
An exact `vMAJOR.MINOR.PATCH` or `vMAJOR.MINOR.PATCHaN` tag produces a release
|
|
89
|
+
version. Untagged builds use
|
|
90
|
+
hatch-vcs development metadata; the configured fallback exists only so an empty
|
|
91
|
+
or exported pre-release checkout can bootstrap before the first commit.
|
|
92
|
+
|
|
93
|
+
## Manual sandbox
|
|
94
|
+
|
|
95
|
+
The sandbox is a manual environment, not a test-fixture provider. Automated tests
|
|
96
|
+
must not import it.
|
|
97
|
+
|
|
98
|
+
Start its three-node plaintext Kafka cluster:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
docker compose --project-directory sandbox up -d
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Stop it and remove its volumes:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
docker compose --project-directory sandbox down -v
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Kafka is available at `localhost:19092`, `localhost:29092`, and
|
|
111
|
+
`localhost:39092`. The pinned Kafka image version lives in `sandbox/.env`.
|
|
112
|
+
|
|
113
|
+
With the sandbox running and the supported clients installed locally, run the
|
|
114
|
+
adapter smoke checks:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
uv run --locked python -m sandbox
|
|
118
|
+
uv run --locked python -m sandbox \
|
|
119
|
+
--shell bash --shell zsh --shell fish
|
|
120
|
+
uv run --locked python -m sandbox my-topic \
|
|
121
|
+
--profile sandbox --bootstrap-server localhost:19092 --keep-topic
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
By default, the script creates and lists a randomized topic, produces and
|
|
125
|
+
consumes a record, and exercises the groups, configs, ACLs, and broker API
|
|
126
|
+
adapters. It also lists the topic with kcat, validates the Kaskade adapter, and
|
|
127
|
+
deletes the topic. At least one executable variant for every official Kafka
|
|
128
|
+
command must be installed. The check uses styled emoji output in a terminal and
|
|
129
|
+
text status labels when styling is disabled, including in CI or when `--no-color`
|
|
130
|
+
is passed.
|
|
131
|
+
|
|
132
|
+
Repeat `--shell` to add real interactive-subshell checks after the explicit
|
|
133
|
+
command pass. A requested shell is required to be installed; the three-shell
|
|
134
|
+
command above verifies Bash, Zsh, and Fish with PTYs, including profile
|
|
135
|
+
visibility, path restoration, and every installed adapter executable.
|
|
136
|
+
|
|
137
|
+
The smoke script is also a pre-commit hook. Keep the sandbox running when making
|
|
138
|
+
commits; this remains a local integration check rather than part of the offline
|
|
139
|
+
unit-test suite.
|
|
140
|
+
|
|
141
|
+
GitHub Actions separately runs a lightweight shell contract on Bash, Zsh, and
|
|
142
|
+
Fish, including history persistence. It uses generated fake client executables instead of installing Kafka,
|
|
143
|
+
kcat, Kaskade, Java, or Docker. The Python test owns the assertions and reads a
|
|
144
|
+
temporary JSON-lines event log containing command names, safe arguments, config
|
|
145
|
+
file modes, and session metadata. Logs are deleted with the test directory and
|
|
146
|
+
sanitized output is shown only when a contract fails.
|
|
147
|
+
|
|
148
|
+
Run that contract independently from the normal unit suite with:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
KANTRIP_REQUIRED_SHELLS=bash,zsh,fish \
|
|
152
|
+
uv run --locked python -m scripts.verify_shell_contract
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### End-to-end adapter workflow
|
|
156
|
+
|
|
157
|
+
Create an isolated profile for the running sandbox, then create a topic, produce
|
|
158
|
+
two records, and consume exactly those records:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
uv run kantrip add sandbox --bootstrap-server localhost:19092
|
|
162
|
+
|
|
163
|
+
uv run kantrip exec sandbox -- kafka-topics --create \
|
|
164
|
+
--topic kantrip-development --partitions 1 --replication-factor 1
|
|
165
|
+
|
|
166
|
+
printf 'first record\nsecond record\n' | \
|
|
167
|
+
uv run kantrip exec sandbox -- kafka-console-producer \
|
|
168
|
+
--topic kantrip-development
|
|
169
|
+
|
|
170
|
+
uv run kantrip exec sandbox -- kafka-console-consumer \
|
|
171
|
+
--topic kantrip-development --from-beginning --max-messages 2
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Replace any official Kafka command with its `.sh` form when using an Apache Kafka
|
|
175
|
+
distribution that retains the suffix.
|
|
176
|
+
|
|
177
|
+
Additional quick checks for the other adapters are:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
uv run kantrip exec sandbox -- kafka-consumer-groups --list
|
|
181
|
+
uv run kantrip exec sandbox -- kafka-configs \
|
|
182
|
+
--describe --entity-type topics --entity-name kantrip-development
|
|
183
|
+
uv run kantrip exec sandbox -- kafka-acls --version
|
|
184
|
+
uv run kantrip exec sandbox -- kafka-broker-api-versions
|
|
185
|
+
uv run kantrip exec sandbox -- kcat -L
|
|
186
|
+
uv run kantrip exec sandbox -- kaskade admin
|
|
187
|
+
|
|
188
|
+
uv run kantrip exec sandbox -- kafka-topics --delete \
|
|
189
|
+
--topic kantrip-development
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
The sandbox does not configure a Kafka authorizer, so use `--version` to validate
|
|
193
|
+
the ACL adapter there. Listing or changing ACLs requires a cluster with an
|
|
194
|
+
authorizer and a suitably authorized principal.
|
|
195
|
+
|
|
196
|
+
## Architecture and security
|
|
197
|
+
|
|
198
|
+
- Stable design decisions: [`ARCHITECTURE.md`](ARCHITECTURE.md)
|
|
199
|
+
- Planned MVP work: [`MVP.md`](MVP.md)
|
|
200
|
+
- Assets, threats, controls, and limitations: [`THREAT_MODEL.md`](THREAT_MODEL.md)
|
|
201
|
+
- Private vulnerability reporting: [`SECURITY.md`](SECURITY.md)
|
|
202
|
+
|
|
203
|
+
## Release
|
|
204
|
+
|
|
205
|
+
Git tags are the only release-version source. GitHub Releases are the canonical
|
|
206
|
+
release history; never edit a static package version or maintained changelog.
|
|
207
|
+
Use the reusable [release checklist](RELEASE_CHECKLIST.md) to record preparation
|
|
208
|
+
and post-release evidence for each candidate.
|
|
209
|
+
|
|
210
|
+
Before releasing, ensure `main` is current, clean, and passing:
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
git switch main
|
|
214
|
+
git pull --ff-only origin main
|
|
215
|
+
git status --short
|
|
216
|
+
uv lock --check
|
|
217
|
+
uv run --locked python -m scripts.analyze
|
|
218
|
+
uv run --locked python -m scripts.tests
|
|
219
|
+
uv build --clear
|
|
220
|
+
uv run --locked python -m scripts.verify_release dist
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Create and push an annotated stable (`vMAJOR.MINOR.PATCH`) or alpha
|
|
224
|
+
(`vMAJOR.MINOR.PATCHaN`) tag. The protected release
|
|
225
|
+
workflow validates the tag against `main`, builds once, verifies and installs the
|
|
226
|
+
wheel, generates Conventional Commit notes, attests the distributions, waits for
|
|
227
|
+
approval, publishes through PyPI trusted publishing, and creates the GitHub
|
|
228
|
+
Release from the same artifacts. Kantrip has no Docker release job.
|
kantrip-0.1.0a1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Saúl Piña
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
kantrip-0.1.0a1/MVP.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# MVP Roadmap
|
|
2
|
+
|
|
3
|
+
Kantrip's current baseline is the plaintext profile workflow documented in
|
|
4
|
+
`README.md` and `USAGE.md`. Items in this file are planned and are not supported
|
|
5
|
+
until they move into the implementation, schema, tests, and current-feature
|
|
6
|
+
documentation together.
|
|
7
|
+
|
|
8
|
+
## 1. Session hardening
|
|
9
|
+
|
|
10
|
+
- Supervise a child process group and forward termination signals explicitly.
|
|
11
|
+
- Validate session-directory ownership, permissions, markers, and path
|
|
12
|
+
boundaries before use or cleanup.
|
|
13
|
+
- Remove verified stale session directories left by abnormal termination.
|
|
14
|
+
- Define and enforce behavior for background or detached descendants.
|
|
15
|
+
|
|
16
|
+
## 2. Credentials and authenticated Kafka
|
|
17
|
+
|
|
18
|
+
- Store long-lived secrets in macOS Keychain or a Linux Secret Service provider;
|
|
19
|
+
do not add plaintext or locally encrypted secret-file fallbacks.
|
|
20
|
+
- Extend the profile schema and generated client files for TLS, SASL/PLAIN,
|
|
21
|
+
SCRAM-SHA-256, SCRAM-SHA-512, and mutual TLS.
|
|
22
|
+
- Materialize certificates and private keys only in private session directories
|
|
23
|
+
and keep secrets out of command arguments and diagnostics.
|
|
24
|
+
|
|
25
|
+
## 3. Connectivity and registry integration
|
|
26
|
+
|
|
27
|
+
- Add `kantrip ping` for explicit broker connectivity and authentication checks.
|
|
28
|
+
- Add Schema Registry profiles and tested mappings for Confluent-compatible and
|
|
29
|
+
Apicurio endpoints.
|
|
30
|
+
- Add OAuth support, including the generic client-credentials flow and Strimzi
|
|
31
|
+
callback integration.
|
|
32
|
+
|
|
33
|
+
## 4. Profile workflow
|
|
34
|
+
|
|
35
|
+
- Add explicit persistent profile selection without modifying a parent shell.
|
|
36
|
+
- Add migration tooling when a released schema needs a breaking change.
|
|
37
|
+
- Extend `kantrip doctor` with credential-provider, certificate-expiry, and
|
|
38
|
+
stale-session diagnostics as those capabilities are implemented.
|
|
39
|
+
|
|
40
|
+
## MVP non-goals
|
|
41
|
+
|
|
42
|
+
- AWS MSK IAM authentication.
|
|
43
|
+
- Windows support.
|
|
44
|
+
- Docker-based distribution or a hosted Kantrip service.
|
|
45
|
+
|
|
46
|
+
## Alpha configuration cleanup
|
|
47
|
+
|
|
48
|
+
Early example configurations included a top-level `version: 1` field and schema
|
|
49
|
+
sections for capabilities that were not implemented. The current alpha schema
|
|
50
|
+
rejects those fields. Remove `version`, `defaults`, TLS, authentication,
|
|
51
|
+
credential-reference, and Schema Registry sections; recreate the affected
|
|
52
|
+
profiles as plaintext profiles with `kantrip add` when convenient.
|