env-alias 0.5.2__tar.gz → 0.7.1__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.
- env_alias-0.7.1/.agents/AGENTS.md +138 -0
- env_alias-0.7.1/.agents/context/project_context.md +199 -0
- env_alias-0.7.1/.agents/rules/dev-directory.md +22 -0
- env_alias-0.7.1/.agents/rules/environment.md +25 -0
- env_alias-0.7.1/.agents/skills/architect-review/SKILL.md +174 -0
- env_alias-0.7.1/.agents/skills/caveman/SKILL.md +67 -0
- env_alias-0.7.1/.agents/skills/code-reviewer/SKILL.md +179 -0
- env_alias-0.7.1/.agents/skills/karpathy-guidelines/SKILL.md +67 -0
- env_alias-0.7.1/.agents/skills/python-pro/SKILL.md +158 -0
- env_alias-0.7.1/.agents/skills/uv-testing/SKILL.md +16 -0
- env_alias-0.7.1/.agents/skills/vulnerability-scanner/SKILL.md +278 -0
- env_alias-0.7.1/.agents/skills/vulnerability-scanner/checklists.md +121 -0
- env_alias-0.7.1/.agents/skills/vulnerability-scanner/scripts/security_scan.py +455 -0
- env_alias-0.7.1/.agents/workflows/post-implementation-verification.md +57 -0
- env_alias-0.7.1/.agents/workflows/uv-commands.md +16 -0
- env_alias-0.7.1/.changelog/0.3.1.toml +7 -0
- env_alias-0.7.1/.changelog/0.3.3.toml +7 -0
- env_alias-0.7.1/.changelog/0.3.4.toml +7 -0
- env_alias-0.7.1/.changelog/0.3.5.toml +7 -0
- env_alias-0.7.1/.changelog/0.3.6.toml +7 -0
- env_alias-0.7.1/.changelog/0.3.7.toml +7 -0
- env_alias-0.7.1/.changelog/0.3.8.toml +7 -0
- env_alias-0.7.1/.changelog/0.4.0.toml +7 -0
- env_alias-0.7.1/.changelog/0.5.1.toml +7 -0
- env_alias-0.7.1/.changelog/0.7.0.toml +46 -0
- env_alias-0.7.1/.github/workflows/docs.yml +63 -0
- env_alias-0.7.1/.github/workflows/project-tests.yml +54 -0
- env_alias-0.7.1/.github/workflows/publish.yml +73 -0
- env_alias-0.7.1/.gitignore +19 -0
- {env_alias-0.5.2 → env_alias-0.7.1}/LICENSE +2 -1
- env_alias-0.7.1/Makefile +135 -0
- env_alias-0.7.1/PKG-INFO +219 -0
- env_alias-0.7.1/README.md +183 -0
- env_alias-0.7.1/docs/.python-version +1 -0
- env_alias-0.7.1/docs/docs/assets/css/extra.css +53 -0
- env_alias-0.7.1/docs/docs/assets/img/icons8-keepassxc.svg +11 -0
- env_alias-0.7.1/docs/docs/assets/img/terminal-128x128.png +0 -0
- env_alias-0.7.1/docs/docs/debugging.md +11 -0
- env_alias-0.7.1/docs/docs/definition-attributes/ansible-vault-password-file.md +41 -0
- env_alias-0.7.1/docs/docs/definition-attributes/ansible-vault-password.md +79 -0
- env_alias-0.7.1/docs/docs/definition-attributes/exec.md +40 -0
- env_alias-0.7.1/docs/docs/definition-attributes/keepass-password.md +25 -0
- env_alias-0.7.1/docs/docs/definition-attributes/name.md +38 -0
- env_alias-0.7.1/docs/docs/definition-attributes/override.md +24 -0
- env_alias-0.7.1/docs/docs/definition-attributes/parser.md +65 -0
- env_alias-0.7.1/docs/docs/definition-attributes/selector.md +56 -0
- env_alias-0.7.1/docs/docs/definition-attributes/source.md +96 -0
- env_alias-0.7.1/docs/docs/definition-attributes/value-to.md +37 -0
- env_alias-0.7.1/docs/docs/definition-attributes/value.md +31 -0
- env_alias-0.7.1/docs/docs/development.md +88 -0
- env_alias-0.7.1/docs/docs/examples/ansible-project.md +80 -0
- env_alias-0.7.1/docs/docs/examples/aws-credentials.md +37 -0
- env_alias-0.7.1/docs/docs/examples/keepass-chained-secret.md +41 -0
- env_alias-0.7.1/docs/docs/examples/keepass-secret-bundle.md +62 -0
- env_alias-0.7.1/docs/docs/examples/multi-file.md +38 -0
- env_alias-0.7.1/docs/docs/examples/multi-provider-ini.md +62 -0
- env_alias-0.7.1/docs/docs/examples/per-session-secrets.md +47 -0
- env_alias-0.7.1/docs/docs/examples/project-readiness.md +28 -0
- env_alias-0.7.1/docs/docs/examples/remote-config.md +26 -0
- env_alias-0.7.1/docs/docs/examples/structured-files.md +31 -0
- env_alias-0.7.1/docs/docs/examples/terminal-messages.md +32 -0
- env_alias-0.7.1/docs/docs/examples/terraform-aws-project.md +41 -0
- env_alias-0.7.1/docs/docs/examples/value-reuse.md +46 -0
- env_alias-0.7.1/docs/docs/index.md +145 -0
- env_alias-0.7.1/docs/docs/license.md +27 -0
- env_alias-0.7.1/docs/docs/project.md +25 -0
- env_alias-0.7.1/docs/docs/security.md +59 -0
- env_alias-0.7.1/docs/docs/troubleshooting.md +96 -0
- env_alias-0.7.1/docs/mkdocs.yml +191 -0
- env_alias-0.7.1/docs/pyproject.toml +47 -0
- env_alias-0.7.1/docs/uv.lock +699 -0
- env_alias-0.7.1/pyproject.toml +121 -0
- {env_alias-0.5.2 → env_alias-0.7.1}/src/env_alias/__init__.py +2 -3
- {env_alias-0.5.2 → env_alias-0.7.1}/src/env_alias/exceptions.py +6 -5
- env_alias-0.7.1/src/env_alias/lib/definitions.py +77 -0
- env_alias-0.7.1/src/env_alias/lib/generator.py +203 -0
- {env_alias-0.5.2 → env_alias-0.7.1}/src/env_alias/lib/logger.py +8 -21
- {env_alias-0.5.2 → env_alias-0.7.1}/src/env_alias/lib/selector.py +30 -15
- env_alias-0.7.1/src/env_alias/lib/source.py +394 -0
- env_alias-0.7.1/src/env_alias/main.py +119 -0
- env_alias-0.7.1/src/env_alias/models/__init__.py +0 -0
- env_alias-0.7.1/src/env_alias/models/constants.py +51 -0
- env_alias-0.7.1/src/env_alias/models/envalias_definition.py +88 -0
- env_alias-0.7.1/src/env_alias/models/sourced_content.py +21 -0
- env_alias-0.7.1/src/env_alias/py.typed +0 -0
- env_alias-0.7.1/tests/__init__.py +0 -0
- env_alias-0.7.1/tests/conftest.py +93 -0
- env_alias-0.7.1/tests/data/blns.base64.json +679 -0
- env_alias-0.7.1/tests/data/envalias-ansible-vault-datafile-password.txt +9 -0
- env_alias-0.7.1/tests/data/envalias-ansible-vault-datafile.vault +10 -0
- env_alias-0.7.1/tests/data/envalias-keepass-database-password.txt +9 -0
- env_alias-0.7.1/tests/data/envalias-keepass-database.kdbx +0 -0
- env_alias-0.7.1/tests/manual/ansible_vault_01.yml +17 -0
- env_alias-0.7.1/tests/manual/ansible_vault_password_file_01.yml +11 -0
- env_alias-0.7.1/tests/manual/direct_01.yml +4 -0
- env_alias-0.7.1/tests/manual/direct_02.yml +4 -0
- env_alias-0.7.1/tests/manual/direct_03.yml +5 -0
- env_alias-0.7.1/tests/manual/exec_01.yml +4 -0
- env_alias-0.7.1/tests/manual/exec_02.yml +6 -0
- env_alias-0.7.1/tests/manual/exec_03.yml +5 -0
- env_alias-0.7.1/tests/manual/exec_04.yml +5 -0
- env_alias-0.7.1/tests/manual/exec_bad_01.yml +4 -0
- env_alias-0.7.1/tests/manual/inputs_01.yml +14 -0
- env_alias-0.7.1/tests/manual/keepass_01.yml +17 -0
- env_alias-0.7.1/tests/manual/local_ini_01.yml +5 -0
- env_alias-0.7.1/tests/manual/local_ini_02.yml +6 -0
- env_alias-0.7.1/tests/manual/local_ini_03.yml +2 -0
- env_alias-0.7.1/tests/manual/local_json_01.yml +5 -0
- env_alias-0.7.1/tests/manual/local_json_02.yml +6 -0
- env_alias-0.7.1/tests/manual/local_text_01.yml +4 -0
- env_alias-0.7.1/tests/manual/local_text_02.yml +5 -0
- env_alias-0.7.1/tests/manual/local_yaml_01.yml +5 -0
- env_alias-0.7.1/tests/manual/local_yaml_02.yml +6 -0
- env_alias-0.7.1/tests/manual/overrides_01.yml +14 -0
- env_alias-0.7.1/tests/manual/remote_json_01.yml +5 -0
- env_alias-0.7.1/tests/manual/remote_json_02.yml +5 -0
- env_alias-0.7.1/tests/manual/remote_text_01.yml +5 -0
- env_alias-0.7.1/tests/test_ansible_vault_password_file.py +219 -0
- env_alias-0.7.1/tests/test_ansible_vault_source.py +39 -0
- env_alias-0.7.1/tests/test_basic.py +28 -0
- env_alias-0.7.1/tests/test_blns_edge_cases.py +388 -0
- env_alias-0.7.1/tests/test_cli.py +95 -0
- env_alias-0.7.1/tests/test_direct.py +43 -0
- env_alias-0.7.1/tests/test_exec_source.py +100 -0
- env_alias-0.7.1/tests/test_exit_codes.py +108 -0
- env_alias-0.7.1/tests/test_keepass_source.py +53 -0
- env_alias-0.7.1/tests/test_local_ini.py +95 -0
- env_alias-0.7.1/tests/test_local_json.py +71 -0
- env_alias-0.7.1/tests/test_local_text.py +68 -0
- env_alias-0.7.1/tests/test_local_yaml.py +74 -0
- env_alias-0.7.1/tests/test_main_coverage.py +211 -0
- env_alias-0.7.1/tests/test_multi_file.py +277 -0
- env_alias-0.7.1/tests/test_override.py +26 -0
- env_alias-0.7.1/tests/test_release_metadata.py +76 -0
- env_alias-0.7.1/tests/test_remote_source.py +69 -0
- env_alias-0.7.1/tests/test_secret_cleanup.py +145 -0
- env_alias-0.7.1/tests/test_selector_edge_cases.py +66 -0
- env_alias-0.7.1/tests/test_shell_quoting.py +106 -0
- env_alias-0.7.1/tests/test_source_strategy_resolution.py +109 -0
- env_alias-0.7.1/tests/test_value_to.py +102 -0
- env_alias-0.7.1/tests/test_wheel_packaging.py +115 -0
- env_alias-0.7.1/uv.lock +1401 -0
- env_alias-0.5.2/PKG-INFO +0 -133
- env_alias-0.5.2/README.md +0 -106
- env_alias-0.5.2/pyproject.toml +0 -101
- env_alias-0.5.2/src/env_alias/lib/definitions.py +0 -61
- env_alias-0.5.2/src/env_alias/lib/generator.py +0 -148
- env_alias-0.5.2/src/env_alias/lib/source.py +0 -213
- env_alias-0.5.2/src/env_alias/main.py +0 -72
- env_alias-0.5.2/src/env_alias/models/envalias_definition.py +0 -79
- env_alias-0.5.2/src/env_alias/models/sourced_content.py +0 -13
- /env_alias-0.5.2/src/env_alias/lib/__init__.py → /env_alias-0.7.1/docs/docs/assets/js/extra.js +0 -0
- /env_alias-0.5.2/src/env_alias/py.typed → /env_alias-0.7.1/src/env_alias/lib/__init__.py +0 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# AGENTS.md — env-alias
|
|
2
|
+
|
|
3
|
+
Entry point for AI agents working in this repository. Read this first, then the linked files.
|
|
4
|
+
|
|
5
|
+
## What this project is
|
|
6
|
+
|
|
7
|
+
`env-alias` is a CLI utility that reads a YAML *definitions file* and emits shell `export`
|
|
8
|
+
statements on **stdout**, intended to be consumed as:
|
|
9
|
+
|
|
10
|
+
```shell
|
|
11
|
+
alias "myenv"="source <(env-alias --generator ~/myenv.yml)"
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Values are sourced from local files, HTTP URLs, shell commands, stdin/getpass prompts, KeePass
|
|
15
|
+
databases, and Ansible Vault files, then narrowed with a *parser* (`ini`/`json`/`yaml`/plaintext) and
|
|
16
|
+
a *selector* (dotted path or line number).
|
|
17
|
+
|
|
18
|
+
**The single most important invariant: stdout is shell code that the user's interactive shell will
|
|
19
|
+
execute.** Nothing may write to stdout except `EnvAliasGenerator.output_export()`. All logging,
|
|
20
|
+
prompts, and diagnostics go to stderr. Anything that lands on stdout unquoted is a code-execution
|
|
21
|
+
vector, not a formatting bug. (`value_to` targets stderr only — `<stdout>` was removed in 0.7.0.)
|
|
22
|
+
|
|
23
|
+
Secondary consequence: this tool handles plaintext secrets throughout. Treat every code path in
|
|
24
|
+
`lib/source.py` as security-sensitive.
|
|
25
|
+
|
|
26
|
+
## Required reading
|
|
27
|
+
|
|
28
|
+
| File | When |
|
|
29
|
+
|------|------|
|
|
30
|
+
| `rules/environment.md` | **Always.** Never create a local `.venv`. |
|
|
31
|
+
| `rules/dev-directory.md` | **Always.** `_dev/` is invisible — never read, write, or reference it. |
|
|
32
|
+
| `context/project_context.md` | Stack, architecture, and testing conventions. |
|
|
33
|
+
| `workflows/post-implementation-verification.md` | Before submitting any change. |
|
|
34
|
+
| `workflows/uv-commands.md` | If invoking `uv` directly rather than via `make`. |
|
|
35
|
+
|
|
36
|
+
The two `rules/` files are hard constraints, not suggestions. Violating them corrupts developer state.
|
|
37
|
+
|
|
38
|
+
## Commands
|
|
39
|
+
|
|
40
|
+
Use the `Makefile`. It already applies the `UV_PROJECT_ENVIRONMENT` / `UV_CACHE_DIR` /
|
|
41
|
+
`UV_LINK_MODE=copy` prefix required by `rules/environment.md`.
|
|
42
|
+
|
|
43
|
+
```shell
|
|
44
|
+
make setup # create isolated venv + sync dev deps
|
|
45
|
+
make test # pytest
|
|
46
|
+
make lint # ruff check
|
|
47
|
+
make lint-fix # ruff check --fix + ruff format
|
|
48
|
+
make typecheck # basedpyright
|
|
49
|
+
make build # wheel + sdist
|
|
50
|
+
make help # full list
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Never run bare `uv`, `pip`, `pytest`, or `ruff` — the isolation prefix is mandatory. If you need a
|
|
54
|
+
command the `Makefile` lacks, add a target rather than running it ad hoc.
|
|
55
|
+
|
|
56
|
+
## Layout
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
src/env_alias/
|
|
60
|
+
__init__.py # __version__ (single source of truth), LOGGER_*, DEFINITIONS_ROOT
|
|
61
|
+
main.py # CLI entrypoint; two modes: alias emitter, and --generator
|
|
62
|
+
exceptions.py # EnvAliasException (logs itself on construction)
|
|
63
|
+
lib/
|
|
64
|
+
definitions.py # YAML file -> list[EnvAliasDefinition]
|
|
65
|
+
generator.py # orchestrator; the only place that writes export lines
|
|
66
|
+
source.py # SOURCE_STRATEGIES: how to fetch raw content
|
|
67
|
+
selector.py # PARSER_STRATEGIES: how to narrow content to one value
|
|
68
|
+
logger.py # stderr logging, colourised level names
|
|
69
|
+
models/
|
|
70
|
+
envalias_definition.py # pydantic v2 model of one YAML definition entry
|
|
71
|
+
sourced_content.py # pydantic v2 model of fetched content + metadata
|
|
72
|
+
tests/
|
|
73
|
+
test_*.py # pytest; most build a temp YAML file and assert on capsys
|
|
74
|
+
manual/*.yml # hand-run example definition files
|
|
75
|
+
docs/ # mkdocs site, separate uv project with its own pyproject/lock
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Control flow: `main.entrypoint` → `EnvAliasGenerator.generate()` → `EnvAliasDefinitions.load_definitions()`
|
|
79
|
+
→ per definition: `update_env_replacement_attributes` → `get_content_from_source` (source strategy) →
|
|
80
|
+
`get_definition_value` (parser strategy) → `output_export`.
|
|
81
|
+
|
|
82
|
+
## Domain concepts you must understand before editing
|
|
83
|
+
|
|
84
|
+
- **`SOURCE_STRATEGIES` / `PARSER_STRATEGIES`** (`lib/source.py`, `lib/selector.py`) — dispatch tables
|
|
85
|
+
replacing former if/elif chains. `SOURCE_STRATEGIES` is an **ordered** list; the catch-all
|
|
86
|
+
`bool(d.source)` predicate must remain after the more specific keepass/vault/stdin predicates.
|
|
87
|
+
Order is load-bearing and currently unenforced by tests. Do not reorder casually.
|
|
88
|
+
- **`env:` indirection** — any definition attribute whose value starts with `env:` is replaced with
|
|
89
|
+
the named environment variable, or with a value produced by an *earlier* definition in the same
|
|
90
|
+
file (`generator.get_replacement_env_value`). This is how a password is fetched once and reused.
|
|
91
|
+
It makes definition order significant.
|
|
92
|
+
- **`name: null`** — marks a definition as internal-only (`_is_internal_only`): the value is computed
|
|
93
|
+
and made available to later definitions via `env:`, but is never exported. Used for intermediate
|
|
94
|
+
secrets. A definition named the *string* `"none"`/`"None"` is a common user mistake and triggers a
|
|
95
|
+
warning.
|
|
96
|
+
- **`selector: null` vs absent selector** — `definitions.py` maps YAML `null` to the string sentinel
|
|
97
|
+
`"none"`, which suppresses output entirely; an absent selector means "default" (line 1 for
|
|
98
|
+
plaintext). These are different behaviours encoded in a string value. `selector: none` spelled
|
|
99
|
+
literally is legacy syntax and is pinned by a test.
|
|
100
|
+
- **`value_to: <stderr>`** — echoes the value to stderr (in addition to, or instead of when combined
|
|
101
|
+
with `name: null`, exporting it). Only `<stderr>` is valid; `<stdout>` was removed in 0.7.0.
|
|
102
|
+
- **`override: false`** — skip the definition if the variable is already set.
|
|
103
|
+
- **`ansible_vault_password_file: true`** — special case that emits an *extra* export beyond the
|
|
104
|
+
definition's own. `generator.source_map` maps the generated script path to the generated environment
|
|
105
|
+
variable name, so the raw password is exported under that derived name for Ansible to read.
|
|
106
|
+
|
|
107
|
+
## Conventions
|
|
108
|
+
|
|
109
|
+
- Python `>=3.10` per `requires-python` — PEP 604 unions (`str | None`), not
|
|
110
|
+
`typing.Optional`/`Union`. The migration to the new style is complete; match the new style.
|
|
111
|
+
- `pydantic` v2 for all models; `extra="forbid"` so unknown YAML keys are rejected loudly.
|
|
112
|
+
- Raise `EnvAliasException` for user-facing errors, with `detail=` for debug-only context. Always
|
|
113
|
+
chain: `raise EnvAliasException(...) from e`.
|
|
114
|
+
- Line length 120, double quotes, ruff-formatted. Rules `E,W,F,I,B,C4,UP,SIM` (see `pyproject.toml`).
|
|
115
|
+
- Version lives only in `src/env_alias/__init__.py`; `pyproject.toml` reads it dynamically. Bump via
|
|
116
|
+
`make bump-patch` / `make bump-minor` / `make bump-major`.
|
|
117
|
+
- Tests assert on the exact export format including its leading space
|
|
118
|
+
(`' export "NAME"="value"'`) — the space suppresses shell history recording. Do not "clean it up".
|
|
119
|
+
|
|
120
|
+
## Current state (read before assuming anything)
|
|
121
|
+
|
|
122
|
+
The build/toolchain refactor is **complete and committed**: `hatchling` + `uv` + `Makefile`, models
|
|
123
|
+
on `pydantic` v2, strategy tables (`SOURCE_STRATEGIES`/`PARSER_STRATEGIES`) instead of if/elif
|
|
124
|
+
chains, typing on PEP 604. The deleted `pdm`/`slap`/`mypy`/`setuptools` toolchain is gone.
|
|
125
|
+
|
|
126
|
+
Consequences to be aware of:
|
|
127
|
+
|
|
128
|
+
- `.github/workflows/project-tests.yml` is the single CI test workflow; it runs `make lint`,
|
|
129
|
+
`make typecheck`, and `make test-all` across Python 3.10–3.14. `.github/workflows/build-tests.yml`
|
|
130
|
+
was deleted. `docs/docs/development.md` documents the current `uv`/`Makefile` workflow.
|
|
131
|
+
- `make lint`, `make typecheck`, and `make test` are quick checks. `make test-all` runs the full suite
|
|
132
|
+
(including slow and network tests) and enforces the 80% coverage floor (`--cov-fail-under=80`) —
|
|
133
|
+
use it before any release.
|
|
134
|
+
- `basedpyright` still has several `report* = "none"` overrides, so treat typecheck pass as a signal,
|
|
135
|
+
not a guarantee of clean types.
|
|
136
|
+
- Version `0.7.1` lives only in `src/env_alias/__init__.py`, read dynamically by `pyproject.toml`; the
|
|
137
|
+
release tag must match it (`v0.7.1`). The current working tree has an uncommitted documentation
|
|
138
|
+
changeset (docs pages, workflows, badge examples) awaiting commit.
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# Project Context: env-alias
|
|
2
|
+
|
|
3
|
+
Welcome to the `env-alias` codebase context. This document outlines the core stack, architecture, design decisions, and coding standards.
|
|
4
|
+
|
|
5
|
+
Read `../AGENTS.md` first for the repository map, control flow, domain concepts, and current
|
|
6
|
+
working-tree state. This file covers the stack, the *why* behind the design, and testing conventions.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 🛠 Core Stack
|
|
11
|
+
|
|
12
|
+
| Concern | Choice | Notes |
|
|
13
|
+
|---------|--------|-------|
|
|
14
|
+
| Language | Python `>=3.10` | PEP 604 unions available. |
|
|
15
|
+
| Runtime deps | `pyyaml`, `pydantic>=2` | Deliberately minimal — this is a shell-startup-path tool, so import time matters. `requests` is a **dev/test** dep only; runtime HTTP uses stdlib `urllib.request`. |
|
|
16
|
+
| Build backend | `hatchling` | `src/` layout (`[tool.hatch.build.targets.wheel] packages = ["src/env_alias"]`); version kept in `env_alias.__version__` and read dynamically via `[tool.hatch.version] path`. Publish install uses `uv`/PyPI, not `setuptools`. |
|
|
17
|
+
| Env / deps | `uv` | Isolated environment, never a repo-local `.venv`. See `../rules/environment.md`. |
|
|
18
|
+
| Task runner | `make` | `Makefile` wraps every `uv` invocation with the required isolation prefix. |
|
|
19
|
+
| Lint + format | `ruff` 0.16 | Rules `E,W,F,I,B,C4,UP,SIM`; line length 120; double quotes. |
|
|
20
|
+
| Type checker | `basedpyright` 1.39.9 | `typeCheckingMode = "standard"`, `pythonVersion = "3.10"`; 7 `report* = "none"` overrides and 5 `report* = "warning"` (see `pyproject.toml`) — pass is a signal, not a guarantee. |
|
|
21
|
+
| Tests | `pytest` | `pytest-cov` with `--cov-fail-under=80`; markers `network`, `slow`, `requires_keepassxc`, `requires_ansible_vault`. Coverage is measured. |
|
|
22
|
+
| Docs | `mkdocs-material` | `docs/` is a **separate uv project** with its own `pyproject.toml` and `uv.lock`, pinned to Python 3.12. Use the `docs-*` Makefile targets (`docs-build` runs `mkdocs build --strict`). |
|
|
23
|
+
| CLI surface | stdlib only | Argument parsing is hand-rolled in `main.py`, not `argparse`. |
|
|
24
|
+
|
|
25
|
+
Historical note: the project previously used `pdm` + `slap-cli` + `mypy`. Those are gone from
|
|
26
|
+
`pyproject.toml` and their old workflow files (`build-tests.yml`) were deleted. Ignore them as
|
|
27
|
+
guidance; they describe a toolchain that no longer exists. `asciidoctor`/`slap` references elsewhere
|
|
28
|
+
are likewise defunct.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## 🏗 Architecture & Design Decisions
|
|
33
|
+
|
|
34
|
+
### The stdout contract
|
|
35
|
+
|
|
36
|
+
`env-alias` output is `source`d directly by the user's interactive shell:
|
|
37
|
+
|
|
38
|
+
```shell
|
|
39
|
+
alias "myenv"="source <(env-alias --generator ~/myenv.yml)"
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Everything else follows from this:
|
|
43
|
+
|
|
44
|
+
* **stdout is executable shell code.** Only `EnvAliasGenerator.output_export()` may write to it.
|
|
45
|
+
Logging, prompts, and errors go to stderr (`lib/logger.py` uses `StreamHandler()`, which defaults to
|
|
46
|
+
stderr). `value_to` targets stderr only — `<stdout>` was removed in 0.7.0.
|
|
47
|
+
* **Values must be shell-escaped, not merely quoted.** They routinely contain `"`, `$`, and backticks
|
|
48
|
+
because they are passwords. Unescaped interpolation is a code-execution defect, not a cosmetic one.
|
|
49
|
+
* **Exported lines are prefixed with a single space** so the shell omits them from history when
|
|
50
|
+
`HISTCONTROL=ignorespace`. Roughly fifteen tests assert this prefix. It is intentional.
|
|
51
|
+
* **Exit status is a correctness signal.** A non-zero status is the only way the caller learns that
|
|
52
|
+
the sourced output is incomplete.
|
|
53
|
+
|
|
54
|
+
### Layered pipeline
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
main.py argument handling, alias-string emission
|
|
58
|
+
└─ generator.py orchestration, env-var bookkeeping, output
|
|
59
|
+
├─ definitions.py YAML -> list[EnvAliasDefinition]
|
|
60
|
+
├─ source.py where -> SourcedContent (SOURCE_STRATEGIES)
|
|
61
|
+
└─ selector.py which -> str (PARSER_STRATEGIES)
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
The split is *acquisition* (`source.py`: how bytes are obtained) versus *narrowing*
|
|
65
|
+
(`selector.py`: which value inside those bytes is wanted). `SourcedContent` is the seam between them
|
|
66
|
+
and carries a `content_type` sniffed from the source, which a definition's explicit `parser` may
|
|
67
|
+
override. `generator.py` is the only module aware of both halves, and the only module that mutates
|
|
68
|
+
process state.
|
|
69
|
+
|
|
70
|
+
### Strategy tables over conditional chains
|
|
71
|
+
|
|
72
|
+
`SOURCE_STRATEGIES` (`lib/source.py`) and `PARSER_STRATEGIES` (`lib/selector.py`) replaced long
|
|
73
|
+
`if/elif` chains. Rationale: adding a source or parser becomes a table entry rather than an edit to a
|
|
74
|
+
branch chain, and each entry is independently testable.
|
|
75
|
+
|
|
76
|
+
Trade-off accepted, and worth knowing: `SOURCE_STRATEGIES` is an **ordered list of predicates**, and
|
|
77
|
+
first-match-wins. The catch-all `bool(d.source)` local-file entry must remain last among the
|
|
78
|
+
`source`-based predicates, and `bool(d.exec)` after it. This ordering is load-bearing and not yet
|
|
79
|
+
enforced by any test.
|
|
80
|
+
|
|
81
|
+
### Models as the validation boundary
|
|
82
|
+
|
|
83
|
+
`pydantic` v2 models (`models/`) are where malformed definitions are rejected:
|
|
84
|
+
|
|
85
|
+
* `extra="forbid"` — a typo'd YAML key is an error, not a silently ignored field. For a secrets tool,
|
|
86
|
+
silently ignoring `overide: false` would be dangerous.
|
|
87
|
+
* Field validators normalise input (`selector` coerced to `str`, `parser`/`value_to` lowercased,
|
|
88
|
+
YAML-ish booleans `yes`/`no` accepted).
|
|
89
|
+
* `check_cross_field_constraints` (a `model_validator`) enforces mutual exclusivity —
|
|
90
|
+
`exec` xor `source` xor `value`, `keepass_password` xor `ansible_vault_password`, and the
|
|
91
|
+
`ansible_vault_password_file` pairing rules.
|
|
92
|
+
|
|
93
|
+
Consequence: **validation belongs in the model, not in `generator.py`.** When adding an attribute,
|
|
94
|
+
add its constraints as validators so failures surface at load time, before any secret is fetched or
|
|
95
|
+
any command is run.
|
|
96
|
+
|
|
97
|
+
`name` is a non-optional `str`; `filename` and `is_internal_only` are real model fields
|
|
98
|
+
(`filename` is `exclude=True` and is set from the source file path by `definitions.py`), so a
|
|
99
|
+
constructed instance is complete. Validation rejects conflicting combinations up front (e.g.
|
|
100
|
+
`exec` xor `source` xor `value`).
|
|
101
|
+
|
|
102
|
+
### Sequential, order-dependent evaluation
|
|
103
|
+
|
|
104
|
+
Definitions are processed in file order, and each one can consume earlier results:
|
|
105
|
+
|
|
106
|
+
* `env:<NAME>` in any attribute resolves against `os.environ` first, then against
|
|
107
|
+
`values_generated` (values produced earlier in this run). This is how a KeePass password is
|
|
108
|
+
prompted once and reused by several entries.
|
|
109
|
+
* Resolved values are written into `os.environ` so that later `exec:` subprocesses inherit them.
|
|
110
|
+
|
|
111
|
+
So the generator is a small interpreter with mutable state, not a pure map over definitions. Two
|
|
112
|
+
implications: reordering definitions changes behaviour, and tests must isolate `os.environ`.
|
|
113
|
+
|
|
114
|
+
### Secret handling posture
|
|
115
|
+
|
|
116
|
+
The tool's entire purpose is moving plaintext secrets, so:
|
|
117
|
+
|
|
118
|
+
* Secrets pass through `os.environ`, subprocess pipes, and (for Ansible Vault) a temporary file.
|
|
119
|
+
* Prefer stdin over command lines and environment variables for handing secrets to child processes.
|
|
120
|
+
* `shell=True` is *intentional and documented* for the user-facing `exec:` attribute
|
|
121
|
+
(`docs/docs/security.md`, `docs/docs/definition-attributes/exec.md`). It is **not** acceptable for
|
|
122
|
+
built-in integrations, where arguments derive from selectors and file paths — use argv lists there.
|
|
123
|
+
* Debug logging currently emits secret values and command lines verbatim. Assume `--debug` output is
|
|
124
|
+
sensitive.
|
|
125
|
+
|
|
126
|
+
### Escape hatches, deliberately
|
|
127
|
+
|
|
128
|
+
`<stdin>`, `<getpass>`, `<stderr>`, `name: null`, and `selector: null` are sentinel values
|
|
129
|
+
in the YAML surface. They exist so the definition file stays a flat dict of simple scalars — no nested
|
|
130
|
+
config schema. The cost is control flow keyed on magic strings scattered across modules; these are
|
|
131
|
+
backed by typed constants (`SourceMethod`, `ParserType`, `SelectorType`, `ValueTo`) while the YAML
|
|
132
|
+
spellings remain public API and must keep working.
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## 🧪 Testing Guidelines
|
|
137
|
+
|
|
138
|
+
Prefer the Makefile targets — they already apply the isolation prefix:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
make test # pytest
|
|
142
|
+
make test-verbose # pytest -v
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
If invoking `uv` directly, always run the tests using isolated virtual environment prefixes to prevent
|
|
146
|
+
`.venv` directory creation in the repository:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
UV_PROJECT_ENVIRONMENT=${HOME}/.local/venvs/env-alias \
|
|
150
|
+
UV_CACHE_DIR=/tmp/.uv-cache-env-alias \
|
|
151
|
+
UV_LINK_MODE=copy \
|
|
152
|
+
uv run --extra dev pytest
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### How the tests are written
|
|
156
|
+
|
|
157
|
+
Most tests follow one shape: build a YAML definitions file in a temp location, run
|
|
158
|
+
`EnvAliasGenerator(config_file=...).generate()`, and assert against `capsys`. The `config_file`
|
|
159
|
+
fixture in `tests/conftest.py` writes the given YAML (prepending the `env-alias:` root) to a temp path:
|
|
160
|
+
|
|
161
|
+
```python
|
|
162
|
+
def test_something(capsys, config_file):
|
|
163
|
+
yaml = """
|
|
164
|
+
MY_VAR:
|
|
165
|
+
value: 'hello'
|
|
166
|
+
"""
|
|
167
|
+
EnvAliasGenerator(config_file=config_file(yaml)).generate()
|
|
168
|
+
|
|
169
|
+
captured = capsys.readouterr().out.rstrip()
|
|
170
|
+
assert ' export "MY_VAR"="hello"' in captured
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Note the leading space in the assertion — see the stdout contract above.
|
|
174
|
+
|
|
175
|
+
`tests/manual/*.yml` are hand-run example definition files, not pytest fixtures. Use them for the
|
|
176
|
+
manual verification step in `../workflows/post-implementation-verification.md`.
|
|
177
|
+
|
|
178
|
+
### Conventions and current shortcomings
|
|
179
|
+
|
|
180
|
+
* Assert on **stdout vs stderr separately**. `capsys.readouterr()` drains both, so a second call
|
|
181
|
+
returns empty — several existing tests rely on this ordering.
|
|
182
|
+
* Tests mutate global `os.environ` (the generator does so by design). There is an autouse
|
|
183
|
+
`isolate_environ` fixture in `tests/conftest.py` that snapshots and restores it; rely on that rather
|
|
184
|
+
than restoring manually.
|
|
185
|
+
* `tests/conftest.py` provides reusable fixtures (`config_file`, `mkdocs_nav`, `isolate_environ`).
|
|
186
|
+
Prefer them over copy-pasting the old `__generate_config_file` helper into new test modules.
|
|
187
|
+
* `tests/__init__.py` contains an unused helper and a stale `sys.path.append` pointing at a
|
|
188
|
+
pre-`src/`-layout directory. Do not extend it.
|
|
189
|
+
* Network tests are marked `network`, and KeePass/Ansible-Vault tests require their binaries. The
|
|
190
|
+
default `make test` run excludes `network` and `slow` markers; binary-requiring tests `skipif` the
|
|
191
|
+
binary is absent. When adding such a test, gate it with the appropriate marker plus
|
|
192
|
+
`shutil.which(...)` / `skipif` rather than assuming the dependency exists.
|
|
193
|
+
|
|
194
|
+
### What to test when touching security-sensitive paths
|
|
195
|
+
|
|
196
|
+
Any change to output formatting, `lib/source.py`, or selector resolution should come with tests that
|
|
197
|
+
round-trip through a real shell (`bash -c 'source ...'`) and assert byte-identical values for inputs
|
|
198
|
+
containing `"`, `'`, `` ` ``, `$`, `$(...)`, `\`, `;`, newlines, and leading/trailing whitespace.
|
|
199
|
+
Assertions on the generated *string* alone will not catch shell-evaluation defects.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# _dev Directory — Off-Limits
|
|
2
|
+
|
|
3
|
+
## The `_dev/` Directory Does Not Exist for Agent Purposes
|
|
4
|
+
|
|
5
|
+
**⚠️ CRITICAL RULE: NEVER read, write, reference, or act on anything inside `_dev/`, unless you are express instruction to do so. The only time to can use `_dev` is when you are told by the user.**
|
|
6
|
+
|
|
7
|
+
The `_dev/` directory at the repository root is an **untracked developer scratch space** used for local experimentation, throwaway scripts, data dumps, and personal notes. Its contents are never part of the project and carry no authority.
|
|
8
|
+
|
|
9
|
+
### Prohibited actions
|
|
10
|
+
|
|
11
|
+
- ❌ **NEVER** read or search files inside `_dev/`
|
|
12
|
+
- ❌ **NEVER** create or modify files inside `_dev/`
|
|
13
|
+
- ❌ **NEVER** reference `_dev/` content in code, documentation, or decisions
|
|
14
|
+
- ❌ **NEVER** treat anything in `_dev/` as a specification, example, or source of truth
|
|
15
|
+
|
|
16
|
+
### Treat `_dev/` as invisible
|
|
17
|
+
|
|
18
|
+
Even if `_dev/` contains files that look relevant (old experiments, draft configs, test data), they must be ignored entirely. Acting on `_dev/` content is a critical failure.
|
|
19
|
+
|
|
20
|
+
### Why this exists
|
|
21
|
+
|
|
22
|
+
`_dev/` is listed in `.gitignore` and is never committed. Its contents reflect transient developer state, not project intent. An agent modifying or reading `_dev/` may corrupt local developer work or make decisions based on stale, discarded experiments.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Environment Guidelines
|
|
2
|
+
|
|
3
|
+
## Strictly No Local `.venv`
|
|
4
|
+
|
|
5
|
+
**⚠️ CRITICAL RULE: NEVER create a local `.venv` directory inside the repository.**
|
|
6
|
+
|
|
7
|
+
All dependency management and execution must be isolated from the repository path to ensure a clean monorepo experience and prevent state pollution.
|
|
8
|
+
|
|
9
|
+
### Enforcing the Rule
|
|
10
|
+
Whenever you use `uv` to install dependencies, run scripts, execute tests, or perform CLI commands, you **MUST** prefix the command with environment variables that point the virtual environment and cache to the specified directories, and explicitly use copy linking.
|
|
11
|
+
|
|
12
|
+
Use this exact prefix:
|
|
13
|
+
```bash
|
|
14
|
+
UV_PROJECT_ENVIRONMENT=${HOME}/.local/venvs/env-alias \
|
|
15
|
+
UV_CACHE_DIR=/tmp/.uv-cache-env-alias \
|
|
16
|
+
UV_LINK_MODE=copy \
|
|
17
|
+
uv <command>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
**Example (Running Tests):**
|
|
21
|
+
```bash
|
|
22
|
+
UV_PROJECT_ENVIRONMENT=${HOME}/.local/venvs/env-alias UV_CACHE_DIR=/tmp/.uv-cache-env-alias UV_LINK_MODE=copy uv run pytest
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Failure to use this prefix may result in a `.venv` being created in the workspace, which is strictly prohibited.
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: architect-review
|
|
3
|
+
description: Master software architect specializing in modern architecture
|
|
4
|
+
patterns, clean architecture, microservices, event-driven systems, and DDD.
|
|
5
|
+
Reviews system designs and code changes for architectural integrity,
|
|
6
|
+
scalability, and maintainability. Use PROACTIVELY for architectural decisions.
|
|
7
|
+
metadata:
|
|
8
|
+
model: opus
|
|
9
|
+
---
|
|
10
|
+
You are a master software architect specializing in modern software architecture patterns, clean architecture principles, and distributed systems design.
|
|
11
|
+
|
|
12
|
+
## Use this skill when
|
|
13
|
+
|
|
14
|
+
- Reviewing system architecture or major design changes
|
|
15
|
+
- Evaluating scalability, resilience, or maintainability impacts
|
|
16
|
+
- Assessing architecture compliance with standards and patterns
|
|
17
|
+
- Providing architectural guidance for complex systems
|
|
18
|
+
|
|
19
|
+
## Do not use this skill when
|
|
20
|
+
|
|
21
|
+
- You need a small code review without architectural impact
|
|
22
|
+
- The change is minor and local to a single module
|
|
23
|
+
- You lack system context or requirements to assess design
|
|
24
|
+
|
|
25
|
+
## Instructions
|
|
26
|
+
|
|
27
|
+
1. Gather system context, goals, and constraints.
|
|
28
|
+
2. Evaluate architecture decisions and identify risks.
|
|
29
|
+
3. Recommend improvements with tradeoffs and next steps.
|
|
30
|
+
4. Document decisions and follow up on validation.
|
|
31
|
+
|
|
32
|
+
## Safety
|
|
33
|
+
|
|
34
|
+
- Avoid approving high-risk changes without validation plans.
|
|
35
|
+
- Document assumptions and dependencies to prevent regressions.
|
|
36
|
+
|
|
37
|
+
## Expert Purpose
|
|
38
|
+
Elite software architect focused on ensuring architectural integrity, scalability, and maintainability across complex distributed systems. Masters modern architecture patterns including microservices, event-driven architecture, domain-driven design, and clean architecture principles. Provides comprehensive architectural reviews and guidance for building robust, future-proof software systems.
|
|
39
|
+
|
|
40
|
+
## Capabilities
|
|
41
|
+
|
|
42
|
+
### Modern Architecture Patterns
|
|
43
|
+
- Clean Architecture and Hexagonal Architecture implementation
|
|
44
|
+
- Microservices architecture with proper service boundaries
|
|
45
|
+
- Event-driven architecture (EDA) with event sourcing and CQRS
|
|
46
|
+
- Domain-Driven Design (DDD) with bounded contexts and ubiquitous language
|
|
47
|
+
- Serverless architecture patterns and Function-as-a-Service design
|
|
48
|
+
- API-first design with GraphQL, REST, and gRPC best practices
|
|
49
|
+
- Layered architecture with proper separation of concerns
|
|
50
|
+
|
|
51
|
+
### Distributed Systems Design
|
|
52
|
+
- Service mesh architecture with Istio, Linkerd, and Consul Connect
|
|
53
|
+
- Event streaming with Apache Kafka, Apache Pulsar, and NATS
|
|
54
|
+
- Distributed data patterns including Saga, Outbox, and Event Sourcing
|
|
55
|
+
- Circuit breaker, bulkhead, and timeout patterns for resilience
|
|
56
|
+
- Distributed caching strategies with Redis Cluster and Hazelcast
|
|
57
|
+
- Load balancing and service discovery patterns
|
|
58
|
+
- Distributed tracing and observability architecture
|
|
59
|
+
|
|
60
|
+
### SOLID Principles & Design Patterns
|
|
61
|
+
- Single Responsibility, Open/Closed, Liskov Substitution principles
|
|
62
|
+
- Interface Segregation and Dependency Inversion implementation
|
|
63
|
+
- Repository, Unit of Work, and Specification patterns
|
|
64
|
+
- Factory, Strategy, Observer, and Command patterns
|
|
65
|
+
- Decorator, Adapter, and Facade patterns for clean interfaces
|
|
66
|
+
- Dependency Injection and Inversion of Control containers
|
|
67
|
+
- Anti-corruption layers and adapter patterns
|
|
68
|
+
|
|
69
|
+
### Cloud-Native Architecture
|
|
70
|
+
- Container orchestration with Kubernetes and Docker Swarm
|
|
71
|
+
- Cloud provider patterns for AWS, Azure, and Google Cloud Platform
|
|
72
|
+
- Infrastructure as Code with Terraform, Pulumi, and CloudFormation
|
|
73
|
+
- GitOps and CI/CD pipeline architecture
|
|
74
|
+
- Auto-scaling patterns and resource optimization
|
|
75
|
+
- Multi-cloud and hybrid cloud architecture strategies
|
|
76
|
+
- Edge computing and CDN integration patterns
|
|
77
|
+
|
|
78
|
+
### Security Architecture
|
|
79
|
+
- Zero Trust security model implementation
|
|
80
|
+
- OAuth2, OpenID Connect, and JWT token management
|
|
81
|
+
- API security patterns including rate limiting and throttling
|
|
82
|
+
- Data encryption at rest and in transit
|
|
83
|
+
- Secret management with HashiCorp Vault and cloud key services
|
|
84
|
+
- Security boundaries and defense in depth strategies
|
|
85
|
+
- Container and Kubernetes security best practices
|
|
86
|
+
|
|
87
|
+
### Performance & Scalability
|
|
88
|
+
- Horizontal and vertical scaling patterns
|
|
89
|
+
- Caching strategies at multiple architectural layers
|
|
90
|
+
- Database scaling with sharding, partitioning, and read replicas
|
|
91
|
+
- Content Delivery Network (CDN) integration
|
|
92
|
+
- Asynchronous processing and message queue patterns
|
|
93
|
+
- Connection pooling and resource management
|
|
94
|
+
- Performance monitoring and APM integration
|
|
95
|
+
|
|
96
|
+
### Data Architecture
|
|
97
|
+
- Polyglot persistence with SQL and NoSQL databases
|
|
98
|
+
- Data lake, data warehouse, and data mesh architectures
|
|
99
|
+
- Event sourcing and Command Query Responsibility Segregation (CQRS)
|
|
100
|
+
- Database per service pattern in microservices
|
|
101
|
+
- Master-slave and master-master replication patterns
|
|
102
|
+
- Distributed transaction patterns and eventual consistency
|
|
103
|
+
- Data streaming and real-time processing architectures
|
|
104
|
+
|
|
105
|
+
### Quality Attributes Assessment
|
|
106
|
+
- Reliability, availability, and fault tolerance evaluation
|
|
107
|
+
- Scalability and performance characteristics analysis
|
|
108
|
+
- Security posture and compliance requirements
|
|
109
|
+
- Maintainability and technical debt assessment
|
|
110
|
+
- Testability and deployment pipeline evaluation
|
|
111
|
+
- Monitoring, logging, and observability capabilities
|
|
112
|
+
- Cost optimization and resource efficiency analysis
|
|
113
|
+
|
|
114
|
+
### Modern Development Practices
|
|
115
|
+
- Test-Driven Development (TDD) and Behavior-Driven Development (BDD)
|
|
116
|
+
- DevSecOps integration and shift-left security practices
|
|
117
|
+
- Feature flags and progressive deployment strategies
|
|
118
|
+
- Blue-green and canary deployment patterns
|
|
119
|
+
- Infrastructure immutability and cattle vs. pets philosophy
|
|
120
|
+
- Platform engineering and developer experience optimization
|
|
121
|
+
- Site Reliability Engineering (SRE) principles and practices
|
|
122
|
+
|
|
123
|
+
### Architecture Documentation
|
|
124
|
+
- C4 model for software architecture visualization
|
|
125
|
+
- Architecture Decision Records (ADRs) and documentation
|
|
126
|
+
- System context diagrams and container diagrams
|
|
127
|
+
- Component and deployment view documentation
|
|
128
|
+
- API documentation with OpenAPI/Swagger specifications
|
|
129
|
+
- Architecture governance and review processes
|
|
130
|
+
- Technical debt tracking and remediation planning
|
|
131
|
+
|
|
132
|
+
## Behavioral Traits
|
|
133
|
+
- Champions clean, maintainable, and testable architecture
|
|
134
|
+
- Emphasizes evolutionary architecture and continuous improvement
|
|
135
|
+
- Prioritizes security, performance, and scalability from day one
|
|
136
|
+
- Advocates for proper abstraction levels without over-engineering
|
|
137
|
+
- Promotes team alignment through clear architectural principles
|
|
138
|
+
- Considers long-term maintainability over short-term convenience
|
|
139
|
+
- Balances technical excellence with business value delivery
|
|
140
|
+
- Encourages documentation and knowledge sharing practices
|
|
141
|
+
- Stays current with emerging architecture patterns and technologies
|
|
142
|
+
- Focuses on enabling change rather than preventing it
|
|
143
|
+
|
|
144
|
+
## Knowledge Base
|
|
145
|
+
- Modern software architecture patterns and anti-patterns
|
|
146
|
+
- Cloud-native technologies and container orchestration
|
|
147
|
+
- Distributed systems theory and CAP theorem implications
|
|
148
|
+
- Microservices patterns from Martin Fowler and Sam Newman
|
|
149
|
+
- Domain-Driven Design from Eric Evans and Vaughn Vernon
|
|
150
|
+
- Clean Architecture from Robert C. Martin (Uncle Bob)
|
|
151
|
+
- Building Microservices and System Design principles
|
|
152
|
+
- Site Reliability Engineering and platform engineering practices
|
|
153
|
+
- Event-driven architecture and event sourcing patterns
|
|
154
|
+
- Modern observability and monitoring best practices
|
|
155
|
+
|
|
156
|
+
## Response Approach
|
|
157
|
+
1. **Analyze architectural context** and identify the system's current state
|
|
158
|
+
2. **Assess architectural impact** of proposed changes (High/Medium/Low)
|
|
159
|
+
3. **Evaluate pattern compliance** against established architecture principles
|
|
160
|
+
4. **Identify architectural violations** and anti-patterns
|
|
161
|
+
5. **Recommend improvements** with specific refactoring suggestions
|
|
162
|
+
6. **Consider scalability implications** for future growth
|
|
163
|
+
7. **Document decisions** with architectural decision records when needed
|
|
164
|
+
8. **Provide implementation guidance** with concrete next steps
|
|
165
|
+
|
|
166
|
+
## Example Interactions
|
|
167
|
+
- "Review this microservice design for proper bounded context boundaries"
|
|
168
|
+
- "Assess the architectural impact of adding event sourcing to our system"
|
|
169
|
+
- "Evaluate this API design for REST and GraphQL best practices"
|
|
170
|
+
- "Review our service mesh implementation for security and performance"
|
|
171
|
+
- "Analyze this database schema for microservices data isolation"
|
|
172
|
+
- "Assess the architectural trade-offs of serverless vs. containerized deployment"
|
|
173
|
+
- "Review this event-driven system design for proper decoupling"
|
|
174
|
+
- "Evaluate our CI/CD pipeline architecture for scalability and security"
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: caveman
|
|
3
|
+
description: >
|
|
4
|
+
Ultra-compressed communication mode. Cuts token usage ~75% by speaking like caveman
|
|
5
|
+
while keeping full technical accuracy. Supports intensity levels: lite, full (default), ultra,
|
|
6
|
+
wenyan-lite, wenyan-full, wenyan-ultra.
|
|
7
|
+
Use when user says "caveman mode", "talk like caveman", "use caveman", "less tokens",
|
|
8
|
+
"be brief", or invokes /caveman. Also auto-triggers when token efficiency is requested.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
Respond terse like smart caveman. All technical substance stay. Only fluff die.
|
|
12
|
+
|
|
13
|
+
## Persistence
|
|
14
|
+
|
|
15
|
+
ACTIVE EVERY RESPONSE. No revert after many turns. No filler drift. Still active if unsure. Off only: "stop caveman" / "normal mode".
|
|
16
|
+
|
|
17
|
+
Default: **full**. Switch: `/caveman lite|full|ultra`.
|
|
18
|
+
|
|
19
|
+
## Rules
|
|
20
|
+
|
|
21
|
+
Drop: articles (a/an/the), filler (just/really/basically/actually/simply), pleasantries (sure/certainly/of course/happy to), hedging. Fragments OK. Short synonyms (big not extensive, fix not "implement a solution for"). Technical terms exact. Code blocks unchanged. Errors quoted exact.
|
|
22
|
+
|
|
23
|
+
Pattern: `[thing] [action] [reason]. [next step].`
|
|
24
|
+
|
|
25
|
+
Not: "Sure! I'd be happy to help you with that. The issue you're experiencing is likely caused by..."
|
|
26
|
+
Yes: "Bug in auth middleware. Token expiry check use `<` not `<=`. Fix:"
|
|
27
|
+
|
|
28
|
+
## Intensity
|
|
29
|
+
|
|
30
|
+
| Level | What change |
|
|
31
|
+
|-------|------------|
|
|
32
|
+
| **lite** | No filler/hedging. Keep articles + full sentences. Professional but tight |
|
|
33
|
+
| **full** | Drop articles, fragments OK, short synonyms. Classic caveman |
|
|
34
|
+
| **ultra** | Abbreviate (DB/auth/config/req/res/fn/impl), strip conjunctions, arrows for causality (X → Y), one word when one word enough |
|
|
35
|
+
| **wenyan-lite** | Semi-classical. Drop filler/hedging but keep grammar structure, classical register |
|
|
36
|
+
| **wenyan-full** | Maximum classical terseness. Fully 文言文. 80-90% character reduction. Classical sentence patterns, verbs precede objects, subjects often omitted, classical particles (之/乃/為/其) |
|
|
37
|
+
| **wenyan-ultra** | Extreme abbreviation while keeping classical Chinese feel. Maximum compression, ultra terse |
|
|
38
|
+
|
|
39
|
+
Example — "Why React component re-render?"
|
|
40
|
+
- lite: "Your component re-renders because you create a new object reference each render. Wrap it in `useMemo`."
|
|
41
|
+
- full: "New object ref each render. Inline object prop = new ref = re-render. Wrap in `useMemo`."
|
|
42
|
+
- ultra: "Inline obj prop → new ref → re-render. `useMemo`."
|
|
43
|
+
- wenyan-lite: "組件頻重繪,以每繪新生對象參照故。以 useMemo 包之。"
|
|
44
|
+
- wenyan-full: "物出新參照,致重繪。useMemo .Wrap之。"
|
|
45
|
+
- wenyan-ultra: "新參照→重繪。useMemo Wrap。"
|
|
46
|
+
|
|
47
|
+
Example — "Explain database connection pooling."
|
|
48
|
+
- lite: "Connection pooling reuses open connections instead of creating new ones per request. Avoids repeated handshake overhead."
|
|
49
|
+
- full: "Pool reuse open DB connections. No new connection per request. Skip handshake overhead."
|
|
50
|
+
- ultra: "Pool = reuse DB conn. Skip handshake → fast under load."
|
|
51
|
+
- wenyan-full: "池reuse open connection。不每req新開。skip handshake overhead。"
|
|
52
|
+
- wenyan-ultra: "池reuse conn。skip handshake → fast。"
|
|
53
|
+
|
|
54
|
+
## Auto-Clarity
|
|
55
|
+
|
|
56
|
+
Drop caveman for: security warnings, irreversible action confirmations, multi-step sequences where fragment order risks misread, user asks to clarify or repeats question. Resume caveman after clear part done.
|
|
57
|
+
|
|
58
|
+
Example — destructive op:
|
|
59
|
+
> **Warning:** This will permanently delete all rows in the `users` table and cannot be undone.
|
|
60
|
+
> ```sql
|
|
61
|
+
> DROP TABLE users;
|
|
62
|
+
> ```
|
|
63
|
+
> Caveman resume. Verify backup exist first.
|
|
64
|
+
|
|
65
|
+
## Boundaries
|
|
66
|
+
|
|
67
|
+
Code/commits/PRs: write normal. "stop caveman" or "normal mode": revert. Level persist until changed or session end.
|