cloak-cli 0.2.0__tar.gz → 0.3.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.
- {cloak_cli-0.2.0 → cloak_cli-0.3.0}/.github/workflows/ci.yml +7 -2
- {cloak_cli-0.2.0 → cloak_cli-0.3.0}/.github/workflows/release.yml +7 -4
- cloak_cli-0.3.0/.pre-commit-hooks.yaml +35 -0
- cloak_cli-0.3.0/CHANGELOG.md +43 -0
- {cloak_cli-0.2.0 → cloak_cli-0.3.0}/CONTRIBUTING.md +5 -3
- {cloak_cli-0.2.0 → cloak_cli-0.3.0}/PKG-INFO +43 -17
- {cloak_cli-0.2.0 → cloak_cli-0.3.0}/README.md +42 -16
- cloak_cli-0.3.0/SECURITY.md +32 -0
- cloak_cli-0.3.0/docs/AGENT_INTEGRATION.md +224 -0
- cloak_cli-0.3.0/docs/BUILD_PLAN.md +103 -0
- cloak_cli-0.3.0/docs/demo.gif +0 -0
- cloak_cli-0.3.0/docs/demo.tape +77 -0
- cloak_cli-0.3.0/docs/research/PROMPTS.md +52 -0
- cloak_cli-0.3.0/examples/README.md +61 -0
- cloak_cli-0.3.0/examples/js-api-client/.cloakpolicy +25 -0
- cloak_cli-0.3.0/examples/js-api-client/client.js +34 -0
- cloak_cli-0.3.0/examples/python-pricing-engine/.cloakpolicy +24 -0
- cloak_cli-0.3.0/examples/python-pricing-engine/pricing.py +43 -0
- cloak_cli-0.3.0/examples/python-pricing-engine/test_pricing.py +19 -0
- {cloak_cli-0.2.0 → cloak_cli-0.3.0}/pyproject.toml +1 -1
- {cloak_cli-0.2.0 → cloak_cli-0.3.0}/src/cloak/__init__.py +1 -1
- {cloak_cli-0.2.0 → cloak_cli-0.3.0}/src/cloak/cli.py +124 -0
- cloak_cli-0.3.0/src/cloak/context/diff.py +301 -0
- cloak_cli-0.3.0/tests/test_diff_context.py +122 -0
- cloak_cli-0.2.0/CHANGELOG.md +0 -46
- cloak_cli-0.2.0/docs/AGENT_INTEGRATION.md +0 -223
- cloak_cli-0.2.0/docs/BUILD_PLAN.md +0 -265
- cloak_cli-0.2.0/docs/research/COMPETITOR_RESEARCH.md +0 -149
- cloak_cli-0.2.0/docs/research/PROMPTS.md +0 -77
- {cloak_cli-0.2.0 → cloak_cli-0.3.0}/.cloakpolicy.example +0 -0
- {cloak_cli-0.2.0 → cloak_cli-0.3.0}/.gitignore +0 -0
- {cloak_cli-0.2.0 → cloak_cli-0.3.0}/LICENSE +0 -0
- {cloak_cli-0.2.0 → cloak_cli-0.3.0}/docs/research/quotecraft.py +0 -0
- {cloak_cli-0.2.0 → cloak_cli-0.3.0}/docs/research/quotecraft.redacted.py +0 -0
- {cloak_cli-0.2.0 → cloak_cli-0.3.0}/docs/research/result_prompt1.md +0 -0
- {cloak_cli-0.2.0 → cloak_cli-0.3.0}/docs/research/result_prompt2.md +0 -0
- {cloak_cli-0.2.0 → cloak_cli-0.3.0}/src/cloak/__main__.py +0 -0
- {cloak_cli-0.2.0 → cloak_cli-0.3.0}/src/cloak/context/__init__.py +0 -0
- {cloak_cli-0.2.0 → cloak_cli-0.3.0}/src/cloak/context/generator.py +0 -0
- {cloak_cli-0.2.0 → cloak_cli-0.3.0}/src/cloak/context/js_redactor.py +0 -0
- {cloak_cli-0.2.0 → cloak_cli-0.3.0}/src/cloak/filesystem.py +0 -0
- {cloak_cli-0.2.0 → cloak_cli-0.3.0}/src/cloak/obfuscate/__init__.py +0 -0
- {cloak_cli-0.2.0 → cloak_cli-0.3.0}/src/cloak/obfuscate/js_transformer.py +0 -0
- {cloak_cli-0.2.0 → cloak_cli-0.3.0}/src/cloak/obfuscate/manifest.py +0 -0
- {cloak_cli-0.2.0 → cloak_cli-0.3.0}/src/cloak/obfuscate/runner.py +0 -0
- {cloak_cli-0.2.0 → cloak_cli-0.3.0}/src/cloak/obfuscate/transformer.py +0 -0
- {cloak_cli-0.2.0 → cloak_cli-0.3.0}/src/cloak/policy.py +0 -0
- {cloak_cli-0.2.0 → cloak_cli-0.3.0}/src/cloak/policy_init.py +0 -0
- {cloak_cli-0.2.0 → cloak_cli-0.3.0}/src/cloak/scan/__init__.py +0 -0
- {cloak_cli-0.2.0 → cloak_cli-0.3.0}/src/cloak/scan/scanner.py +0 -0
- {cloak_cli-0.2.0 → cloak_cli-0.3.0}/tests/__init__.py +0 -0
- {cloak_cli-0.2.0 → cloak_cli-0.3.0}/tests/test_cli.py +0 -0
- {cloak_cli-0.2.0 → cloak_cli-0.3.0}/tests/test_context.py +0 -0
- {cloak_cli-0.2.0 → cloak_cli-0.3.0}/tests/test_context_js.py +0 -0
- {cloak_cli-0.2.0 → cloak_cli-0.3.0}/tests/test_obfuscate.py +0 -0
- {cloak_cli-0.2.0 → cloak_cli-0.3.0}/tests/test_obfuscate_js.py +0 -0
- {cloak_cli-0.2.0 → cloak_cli-0.3.0}/tests/test_policy_init.py +0 -0
|
@@ -6,6 +6,11 @@ on:
|
|
|
6
6
|
pull_request:
|
|
7
7
|
branches: [main]
|
|
8
8
|
|
|
9
|
+
env:
|
|
10
|
+
# Opt into Node 24 runtime for actions; silences deprecation warnings ahead of
|
|
11
|
+
# the June 2026 default cutover.
|
|
12
|
+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
|
|
13
|
+
|
|
9
14
|
jobs:
|
|
10
15
|
test:
|
|
11
16
|
runs-on: ubuntu-latest
|
|
@@ -14,10 +19,10 @@ jobs:
|
|
|
14
19
|
matrix:
|
|
15
20
|
python-version: ["3.11", "3.12", "3.13"]
|
|
16
21
|
steps:
|
|
17
|
-
- uses: actions/checkout@
|
|
22
|
+
- uses: actions/checkout@v5
|
|
18
23
|
|
|
19
24
|
- name: Set up Python ${{ matrix.python-version }}
|
|
20
|
-
uses: actions/setup-python@
|
|
25
|
+
uses: actions/setup-python@v6
|
|
21
26
|
with:
|
|
22
27
|
python-version: ${{ matrix.python-version }}
|
|
23
28
|
cache: pip
|
|
@@ -24,14 +24,17 @@ on:
|
|
|
24
24
|
tags:
|
|
25
25
|
- "v*"
|
|
26
26
|
|
|
27
|
+
env:
|
|
28
|
+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
|
|
29
|
+
|
|
27
30
|
jobs:
|
|
28
31
|
build:
|
|
29
32
|
name: Build distribution
|
|
30
33
|
runs-on: ubuntu-latest
|
|
31
34
|
steps:
|
|
32
|
-
- uses: actions/checkout@
|
|
35
|
+
- uses: actions/checkout@v5
|
|
33
36
|
|
|
34
|
-
- uses: actions/setup-python@
|
|
37
|
+
- uses: actions/setup-python@v6
|
|
35
38
|
with:
|
|
36
39
|
python-version: "3.13"
|
|
37
40
|
|
|
@@ -43,7 +46,7 @@ jobs:
|
|
|
43
46
|
- name: Build sdist + wheel
|
|
44
47
|
run: python -m build
|
|
45
48
|
|
|
46
|
-
- uses: actions/upload-artifact@
|
|
49
|
+
- uses: actions/upload-artifact@v5
|
|
47
50
|
with:
|
|
48
51
|
name: dist
|
|
49
52
|
path: dist/
|
|
@@ -59,7 +62,7 @@ jobs:
|
|
|
59
62
|
permissions:
|
|
60
63
|
id-token: write # required for Trusted Publisher (OIDC)
|
|
61
64
|
steps:
|
|
62
|
-
- uses: actions/download-artifact@
|
|
65
|
+
- uses: actions/download-artifact@v5
|
|
63
66
|
with:
|
|
64
67
|
name: dist
|
|
65
68
|
path: dist/
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# pre-commit hook definitions for CLOAK.
|
|
2
|
+
#
|
|
3
|
+
# Add to your .pre-commit-config.yaml:
|
|
4
|
+
#
|
|
5
|
+
# repos:
|
|
6
|
+
# - repo: https://github.com/newtophilly/cloak
|
|
7
|
+
# rev: v0.2.0
|
|
8
|
+
# hooks:
|
|
9
|
+
# - id: cloak-scan
|
|
10
|
+
#
|
|
11
|
+
# See https://pre-commit.com for general pre-commit setup.
|
|
12
|
+
|
|
13
|
+
- id: cloak-scan
|
|
14
|
+
name: cloak scan
|
|
15
|
+
description: >-
|
|
16
|
+
Find secrets and proprietary markers in code before commit. Wraps detect-secrets and
|
|
17
|
+
layers in policy.secret_rules from .cloakpolicy. Exits 1 on findings (blocks commit).
|
|
18
|
+
entry: cloak scan
|
|
19
|
+
language: python
|
|
20
|
+
pass_filenames: false
|
|
21
|
+
args: ["."]
|
|
22
|
+
always_run: true
|
|
23
|
+
stages: [pre-commit]
|
|
24
|
+
|
|
25
|
+
- id: cloak-context-preview
|
|
26
|
+
name: cloak context (preview only)
|
|
27
|
+
description: >-
|
|
28
|
+
Render a redacted markdown view of the repo. Useful as a manual check that the redaction
|
|
29
|
+
output looks right. Does not block commits — `stages: [manual]` means run only when you
|
|
30
|
+
invoke it explicitly: `pre-commit run cloak-context-preview --hook-stage manual`.
|
|
31
|
+
entry: cloak context
|
|
32
|
+
language: python
|
|
33
|
+
pass_filenames: false
|
|
34
|
+
args: [".", "--json"]
|
|
35
|
+
stages: [manual]
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
Notable changes by release. Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions follow [SemVer](https://semver.org/).
|
|
4
|
+
|
|
5
|
+
## [Unreleased]
|
|
6
|
+
|
|
7
|
+
## [0.3.0] — 2026-05-08
|
|
8
|
+
|
|
9
|
+
- Added `cloak diff-context` — preview what `cloak context` would redact, with per-file counts of function bodies, proprietary tables, docstrings stripped (under `--strict`), and byte reduction. No files written; pure dry-run for trust. JSON output supported.
|
|
10
|
+
- README softened the pre-release framing — version numbers (0.x) already signal early-stage; "alpha software" copy was overcorrecting.
|
|
11
|
+
|
|
12
|
+
## [0.2.1] — 2026-05-08
|
|
13
|
+
|
|
14
|
+
- Added `.pre-commit-hooks.yaml` so teams can drop `cloak-scan` into their `.pre-commit-config.yaml` and have it gate commits.
|
|
15
|
+
- Added `examples/python-pricing-engine/` (with a real pytest suite, so `--verify "pytest"` actually runs) and `examples/js-api-client/`. Each ships with its own `.cloakpolicy`.
|
|
16
|
+
- README now points at the examples and shows the pre-commit setup.
|
|
17
|
+
|
|
18
|
+
## [0.2.0] — 2026-05-08
|
|
19
|
+
|
|
20
|
+
Feature matrix complete: every command now works for both Python and JS/TS.
|
|
21
|
+
|
|
22
|
+
- Added JS/TS support to `cloak obfuscate`. Per-file rename of module-level `_names` (functions, classes, generator functions, simple `const`/`let`/`var` bindings) using tree-sitter. Skips dunder-like names, all-underscore names, and anything in `policy.public_api`. Property access, shorthand object properties, and destructuring patterns are deliberately not renamed in v1 — they'd silently change object shapes.
|
|
23
|
+
- A mixed Python+JS repo now obfuscates in one pass with one manifest and one verify command.
|
|
24
|
+
|
|
25
|
+
## [0.1.2] — 2026-05-08
|
|
26
|
+
|
|
27
|
+
- Added `cloak policy init` — interactive wizard that detects project layout (Python / Node / TypeScript / common src directories) and scaffolds a sensible `.cloakpolicy`. Supports `--yes` (non-interactive), `--force` (overwrite), `--out` (custom path).
|
|
28
|
+
- New `cloak policy ...` subcommand group; more policy commands will go here.
|
|
29
|
+
|
|
30
|
+
## [0.1.1] — 2026-05-08
|
|
31
|
+
|
|
32
|
+
- Added JS/TS support to `cloak context` via tree-sitter. Supported extensions: `.js`, `.mjs`, `.cjs`, `.jsx`, `.ts`, `.tsx`. Function/method/arrow bodies and module-level `UPPER_SNAKE_CASE` object/array constants get redacted; type definitions and signatures are preserved. Output is byte-spliced into the original source so formatting and surrounding comments survive.
|
|
33
|
+
|
|
34
|
+
## [0.1.0] — 2026-05-08
|
|
35
|
+
|
|
36
|
+
First tagged alpha. All three headline commands are functional for Python.
|
|
37
|
+
|
|
38
|
+
- `cloak scan`: wraps `detect-secrets` and layers in `policy.secret_rules`. Returns severity / file / line / rule_id / redacted preview / suggested action. Raw secrets never appear in output. Exit 1 on findings, 0 clean.
|
|
39
|
+
- `cloak context` (Python): AST-based redactor. Function bodies → `...`, module-level `UPPER_SNAKE` dict/list/set/tuple constants → `...`. Imports, class shapes, signatures, docstrings preserved. `--strict` aliases enum values and strips docstrings (justified by the Phase 0 adversarial probe). `--out`, `--copy`, `--json` all supported.
|
|
40
|
+
- `cloak obfuscate` (Python): renames module-private `_names` skipping `policy.public_api` and dunders; optional docstring stripping per policy. Writes `cloak-manifest.json` (sha256s, rename map, full policy snapshot, verify result). `--verify "<cmd>"` gates success on the user's test suite — exit 1 if tests fail. Refuses to overwrite a non-empty output directory.
|
|
41
|
+
- GitHub Actions CI (ruff format/check + mypy --strict + pytest matrix on 3.11/3.12/3.13) and a tag-triggered release workflow that publishes to PyPI via Trusted Publisher (OIDC, no stored tokens).
|
|
42
|
+
- `pyproject.toml` reads version dynamically from `src/cloak/__init__.py` (single source of truth).
|
|
43
|
+
- Phase 0 validation experiment documented in `docs/research/`.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Contributing to CLOAK
|
|
2
2
|
|
|
3
|
-
Thanks for considering a contribution. CLOAK is an
|
|
3
|
+
Thanks for considering a contribution. CLOAK is an early-stage open-source project (pre-1.0); the easiest ways to help are issues, small focused PRs, and feedback on the build plan.
|
|
4
4
|
|
|
5
5
|
## Development setup
|
|
6
6
|
|
|
@@ -25,7 +25,9 @@ CI will run all three. Please keep them green before opening a PR.
|
|
|
25
25
|
|
|
26
26
|
## What to work on
|
|
27
27
|
|
|
28
|
-
Open issues are
|
|
28
|
+
Open issues are the obvious starting point if there are any. Beyond that: [`docs/BUILD_PLAN.md`](docs/BUILD_PLAN.md) lists the things that work today, the known v1 limitations, and what's not started — anything in those last two buckets is fair game for a PR.
|
|
29
|
+
|
|
30
|
+
If you're not sure whether a change is in scope, open an issue describing what you're thinking before sinking time into it. I'd rather discuss the shape of a PR up front than ask for a rewrite after the fact.
|
|
29
31
|
|
|
30
32
|
## Honest positioning
|
|
31
33
|
|
|
@@ -33,7 +35,7 @@ CLOAK markets itself as a **governance + friction** tool, not unbreakable protec
|
|
|
33
35
|
|
|
34
36
|
## Reporting security issues
|
|
35
37
|
|
|
36
|
-
Please
|
|
38
|
+
Please don't file public GitHub issues for security vulnerabilities. Open a private security advisory at https://github.com/newtophilly/cloak/security/advisories/new — full details in [SECURITY.md](SECURITY.md).
|
|
37
39
|
|
|
38
40
|
## Releasing (maintainers)
|
|
39
41
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cloak-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: Local CLI for safer LLM workflows: redact code before pasting, generate verified obfuscated copies, enforce policy from your repo.
|
|
5
5
|
Project-URL: Homepage, https://github.com/newtophilly/cloak
|
|
6
6
|
Project-URL: Repository, https://github.com/newtophilly/cloak
|
|
@@ -248,8 +248,10 @@ Description-Content-Type: text/markdown
|
|
|
248
248
|
|
|
249
249
|
> Local CLI for safer LLM workflows. Redact code before pasting into ChatGPT or Claude. Generate verified obfuscated copies for sharing. Enforce policy from your repo.
|
|
250
250
|
|
|
251
|
-
|
|
252
|
-
|
|
251
|
+

|
|
252
|
+
|
|
253
|
+
> [!NOTE]
|
|
254
|
+
> CLOAK is at **v0.3** — the three headline commands (`scan`, `context`, `obfuscate`) work for both Python and JS/TS, plus `diff-context` for previewing redactions. The `.cloakpolicy` format and CLI flags may still change before 1.0. See [docs/BUILD_PLAN.md](docs/BUILD_PLAN.md) for what's shipped, the known v1 limitations, and what's not started.
|
|
253
255
|
|
|
254
256
|
## What CLOAK is
|
|
255
257
|
|
|
@@ -263,10 +265,12 @@ cloak context ./repo --out safe-context.md --copy
|
|
|
263
265
|
cloak obfuscate ./repo --out ./repo.cloaked --verify "pytest"
|
|
264
266
|
```
|
|
265
267
|
|
|
266
|
-
- **`cloak scan`** — Find secrets and proprietary markers in code (wraps `detect-secrets`
|
|
268
|
+
- **`cloak scan`** — Find secrets and proprietary markers in code (wraps `detect-secrets` and layers your policy's custom regex rules on top).
|
|
267
269
|
- **`cloak context`** — Generate a redacted markdown view of a repo (function bodies hidden, signatures + docstrings kept) safe to paste into an LLM for architectural feedback. Use `--strict` to also alias enums and paraphrase docstrings.
|
|
268
270
|
- **`cloak obfuscate`** — Produce a transformed copy of your code that **still passes your test suite**, for sharing with contractors or third parties. The `--verify` flag is the differentiator: if your tests don't pass against the transformed copy, the operation fails.
|
|
269
271
|
|
|
272
|
+
There's also `cloak diff-context` — a dry-run that previews exactly what `cloak context` would redact (function bodies, proprietary tables, docstrings under `--strict`) and the byte reduction, without writing anything. Run it before you trust the transformation.
|
|
273
|
+
|
|
270
274
|
## Why this exists
|
|
271
275
|
|
|
272
276
|
The "Shadow AI" problem is real: leadership says "don't paste code into ChatGPT" and developers do it anyway because they have deadlines. Existing solutions are either enterprise-grade network DLP (expensive, blunt, requires IT) or policy documents nobody reads.
|
|
@@ -279,7 +283,7 @@ Honest positioning matters in security tooling.
|
|
|
279
283
|
|
|
280
284
|
- **Not unbreakable.** A motivated reader (human or LLM) given an obfuscated copy of your code can still extract logic. CLOAK reduces leak surface and creates friction; it does not provide cryptographic protection. Real protection comes from blocking, redacting, encrypting, compiling, or simply never sending the source.
|
|
281
285
|
- **Not a replacement for enterprise DLP.** Network-layer enforcement (Lasso, Polymer, Cyberhaven, Prisma AIRS, etc.) operates at a different layer and is complementary. CLOAK lives in the developer's workflow, not the network egress.
|
|
282
|
-
- **Not a secret scanner from scratch.** `cloak scan` wraps
|
|
286
|
+
- **Not a secret scanner from scratch.** `cloak scan` wraps `detect-secrets` (Yelp's open-source scanner — years of regex/entropy tuning come for free) and layers your policy's `secret_rules` on top. The reuse is intentional and disclosed.
|
|
283
287
|
- **Not magic for content the LLM has already seen.** Once code is sent, it's sent. CLOAK helps before paste, not after.
|
|
284
288
|
|
|
285
289
|
## Quickstart
|
|
@@ -324,6 +328,33 @@ $ cloak obfuscate src/payments --out /tmp/payments.cloaked --verify "pytest test
|
|
|
324
328
|
$ cloak scan . --json # exits 1 if any secrets, JSON for parsing.
|
|
325
329
|
```
|
|
326
330
|
|
|
331
|
+
### Try it on the included examples
|
|
332
|
+
|
|
333
|
+
The repo ships [`examples/`](examples/) with one Python and one JS project, each with its own `.cloakpolicy`. Clone, install, and run end-to-end against either in 30 seconds:
|
|
334
|
+
|
|
335
|
+
```bash
|
|
336
|
+
cd examples/python-pricing-engine
|
|
337
|
+
cloak scan .
|
|
338
|
+
cloak context . --copy
|
|
339
|
+
cloak obfuscate . --out /tmp/pricing.cloaked --verify "pytest"
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
See [examples/README.md](examples/README.md) for the full walkthrough.
|
|
343
|
+
|
|
344
|
+
### Use as a pre-commit hook
|
|
345
|
+
|
|
346
|
+
Drop `cloak scan` into `.pre-commit-config.yaml` to block commits that introduce secrets:
|
|
347
|
+
|
|
348
|
+
```yaml
|
|
349
|
+
repos:
|
|
350
|
+
- repo: https://github.com/newtophilly/cloak
|
|
351
|
+
rev: v0.2.1
|
|
352
|
+
hooks:
|
|
353
|
+
- id: cloak-scan
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
Then `pre-commit install` and you're done. See [pre-commit.com](https://pre-commit.com) for general setup.
|
|
357
|
+
|
|
327
358
|
## How `.cloakpolicy` works
|
|
328
359
|
|
|
329
360
|
The policy lives in a `.cloakpolicy` YAML file at the repo root. It's checked into git, versioned with your code, and reviewed via the same PR process as everything else. Authority = whoever has merge access.
|
|
@@ -365,8 +396,8 @@ A full annotated example is at [`.cloakpolicy.example`](.cloakpolicy.example).
|
|
|
365
396
|
|
|
366
397
|
## Documentation
|
|
367
398
|
|
|
368
|
-
- [`docs/BUILD_PLAN.md`](docs/BUILD_PLAN.md) —
|
|
369
|
-
- [`docs/research/`](docs/research/) — Phase 0 validation experiment +
|
|
399
|
+
- [`docs/BUILD_PLAN.md`](docs/BUILD_PLAN.md) — current state, what's shipped, known v1 limits, what's not yet built
|
|
400
|
+
- [`docs/research/`](docs/research/) — the Phase 0 validation experiment that informed CLOAK's redaction strategy (a fake industrial-automation pricing engine + the LLM responses + our PASS/CONDITIONAL-PASS evaluations)
|
|
370
401
|
|
|
371
402
|
## Integrations
|
|
372
403
|
|
|
@@ -377,16 +408,11 @@ CLOAK is designed to be called as a subprocess from other developer tools and AI
|
|
|
377
408
|
|
|
378
409
|
## Status
|
|
379
410
|
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
| 3 | `cloak context` for Python | ✅ Done |
|
|
386
|
-
| 3.5 | `cloak context` JS/TS via tree-sitter | ✅ Done |
|
|
387
|
-
| 4 | `cloak obfuscate` Python with `--verify` | ✅ Done (v1) |
|
|
388
|
-
| 5 | `cloak obfuscate` JS/TS via tree-sitter | ✅ Done (v1) |
|
|
389
|
-
| 6 | `cloak eval` (LLM-prompt-based regression harness) | ⏳ |
|
|
411
|
+
What works today: `cloak scan`, `cloak context`, `cloak obfuscate` for both Python and JS/TS, plus `cloak policy init` for first-time setup and pre-commit-hook integration.
|
|
412
|
+
|
|
413
|
+
What's known to not yet work / has documented v1 limits: cross-file rename in `obfuscate` (per-file only — `--verify` catches breakage), JS/TS shorthand-property and destructuring rename (deliberately skipped to avoid silently changing object shapes), `cloak eval` regression harness (not started).
|
|
414
|
+
|
|
415
|
+
The full breakdown — what's shipped, the v1 gaps named honestly, and what's not started — lives in [docs/BUILD_PLAN.md](docs/BUILD_PLAN.md).
|
|
390
416
|
|
|
391
417
|
## Contributing
|
|
392
418
|
|
|
@@ -7,8 +7,10 @@
|
|
|
7
7
|
|
|
8
8
|
> Local CLI for safer LLM workflows. Redact code before pasting into ChatGPT or Claude. Generate verified obfuscated copies for sharing. Enforce policy from your repo.
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+

|
|
11
|
+
|
|
12
|
+
> [!NOTE]
|
|
13
|
+
> CLOAK is at **v0.3** — the three headline commands (`scan`, `context`, `obfuscate`) work for both Python and JS/TS, plus `diff-context` for previewing redactions. The `.cloakpolicy` format and CLI flags may still change before 1.0. See [docs/BUILD_PLAN.md](docs/BUILD_PLAN.md) for what's shipped, the known v1 limitations, and what's not started.
|
|
12
14
|
|
|
13
15
|
## What CLOAK is
|
|
14
16
|
|
|
@@ -22,10 +24,12 @@ cloak context ./repo --out safe-context.md --copy
|
|
|
22
24
|
cloak obfuscate ./repo --out ./repo.cloaked --verify "pytest"
|
|
23
25
|
```
|
|
24
26
|
|
|
25
|
-
- **`cloak scan`** — Find secrets and proprietary markers in code (wraps `detect-secrets`
|
|
27
|
+
- **`cloak scan`** — Find secrets and proprietary markers in code (wraps `detect-secrets` and layers your policy's custom regex rules on top).
|
|
26
28
|
- **`cloak context`** — Generate a redacted markdown view of a repo (function bodies hidden, signatures + docstrings kept) safe to paste into an LLM for architectural feedback. Use `--strict` to also alias enums and paraphrase docstrings.
|
|
27
29
|
- **`cloak obfuscate`** — Produce a transformed copy of your code that **still passes your test suite**, for sharing with contractors or third parties. The `--verify` flag is the differentiator: if your tests don't pass against the transformed copy, the operation fails.
|
|
28
30
|
|
|
31
|
+
There's also `cloak diff-context` — a dry-run that previews exactly what `cloak context` would redact (function bodies, proprietary tables, docstrings under `--strict`) and the byte reduction, without writing anything. Run it before you trust the transformation.
|
|
32
|
+
|
|
29
33
|
## Why this exists
|
|
30
34
|
|
|
31
35
|
The "Shadow AI" problem is real: leadership says "don't paste code into ChatGPT" and developers do it anyway because they have deadlines. Existing solutions are either enterprise-grade network DLP (expensive, blunt, requires IT) or policy documents nobody reads.
|
|
@@ -38,7 +42,7 @@ Honest positioning matters in security tooling.
|
|
|
38
42
|
|
|
39
43
|
- **Not unbreakable.** A motivated reader (human or LLM) given an obfuscated copy of your code can still extract logic. CLOAK reduces leak surface and creates friction; it does not provide cryptographic protection. Real protection comes from blocking, redacting, encrypting, compiling, or simply never sending the source.
|
|
40
44
|
- **Not a replacement for enterprise DLP.** Network-layer enforcement (Lasso, Polymer, Cyberhaven, Prisma AIRS, etc.) operates at a different layer and is complementary. CLOAK lives in the developer's workflow, not the network egress.
|
|
41
|
-
- **Not a secret scanner from scratch.** `cloak scan` wraps
|
|
45
|
+
- **Not a secret scanner from scratch.** `cloak scan` wraps `detect-secrets` (Yelp's open-source scanner — years of regex/entropy tuning come for free) and layers your policy's `secret_rules` on top. The reuse is intentional and disclosed.
|
|
42
46
|
- **Not magic for content the LLM has already seen.** Once code is sent, it's sent. CLOAK helps before paste, not after.
|
|
43
47
|
|
|
44
48
|
## Quickstart
|
|
@@ -83,6 +87,33 @@ $ cloak obfuscate src/payments --out /tmp/payments.cloaked --verify "pytest test
|
|
|
83
87
|
$ cloak scan . --json # exits 1 if any secrets, JSON for parsing.
|
|
84
88
|
```
|
|
85
89
|
|
|
90
|
+
### Try it on the included examples
|
|
91
|
+
|
|
92
|
+
The repo ships [`examples/`](examples/) with one Python and one JS project, each with its own `.cloakpolicy`. Clone, install, and run end-to-end against either in 30 seconds:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
cd examples/python-pricing-engine
|
|
96
|
+
cloak scan .
|
|
97
|
+
cloak context . --copy
|
|
98
|
+
cloak obfuscate . --out /tmp/pricing.cloaked --verify "pytest"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
See [examples/README.md](examples/README.md) for the full walkthrough.
|
|
102
|
+
|
|
103
|
+
### Use as a pre-commit hook
|
|
104
|
+
|
|
105
|
+
Drop `cloak scan` into `.pre-commit-config.yaml` to block commits that introduce secrets:
|
|
106
|
+
|
|
107
|
+
```yaml
|
|
108
|
+
repos:
|
|
109
|
+
- repo: https://github.com/newtophilly/cloak
|
|
110
|
+
rev: v0.2.1
|
|
111
|
+
hooks:
|
|
112
|
+
- id: cloak-scan
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Then `pre-commit install` and you're done. See [pre-commit.com](https://pre-commit.com) for general setup.
|
|
116
|
+
|
|
86
117
|
## How `.cloakpolicy` works
|
|
87
118
|
|
|
88
119
|
The policy lives in a `.cloakpolicy` YAML file at the repo root. It's checked into git, versioned with your code, and reviewed via the same PR process as everything else. Authority = whoever has merge access.
|
|
@@ -124,8 +155,8 @@ A full annotated example is at [`.cloakpolicy.example`](.cloakpolicy.example).
|
|
|
124
155
|
|
|
125
156
|
## Documentation
|
|
126
157
|
|
|
127
|
-
- [`docs/BUILD_PLAN.md`](docs/BUILD_PLAN.md) —
|
|
128
|
-
- [`docs/research/`](docs/research/) — Phase 0 validation experiment +
|
|
158
|
+
- [`docs/BUILD_PLAN.md`](docs/BUILD_PLAN.md) — current state, what's shipped, known v1 limits, what's not yet built
|
|
159
|
+
- [`docs/research/`](docs/research/) — the Phase 0 validation experiment that informed CLOAK's redaction strategy (a fake industrial-automation pricing engine + the LLM responses + our PASS/CONDITIONAL-PASS evaluations)
|
|
129
160
|
|
|
130
161
|
## Integrations
|
|
131
162
|
|
|
@@ -136,16 +167,11 @@ CLOAK is designed to be called as a subprocess from other developer tools and AI
|
|
|
136
167
|
|
|
137
168
|
## Status
|
|
138
169
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
| 3 | `cloak context` for Python | ✅ Done |
|
|
145
|
-
| 3.5 | `cloak context` JS/TS via tree-sitter | ✅ Done |
|
|
146
|
-
| 4 | `cloak obfuscate` Python with `--verify` | ✅ Done (v1) |
|
|
147
|
-
| 5 | `cloak obfuscate` JS/TS via tree-sitter | ✅ Done (v1) |
|
|
148
|
-
| 6 | `cloak eval` (LLM-prompt-based regression harness) | ⏳ |
|
|
170
|
+
What works today: `cloak scan`, `cloak context`, `cloak obfuscate` for both Python and JS/TS, plus `cloak policy init` for first-time setup and pre-commit-hook integration.
|
|
171
|
+
|
|
172
|
+
What's known to not yet work / has documented v1 limits: cross-file rename in `obfuscate` (per-file only — `--verify` catches breakage), JS/TS shorthand-property and destructuring rename (deliberately skipped to avoid silently changing object shapes), `cloak eval` regression harness (not started).
|
|
173
|
+
|
|
174
|
+
The full breakdown — what's shipped, the v1 gaps named honestly, and what's not started — lives in [docs/BUILD_PLAN.md](docs/BUILD_PLAN.md).
|
|
149
175
|
|
|
150
176
|
## Contributing
|
|
151
177
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Security policy
|
|
2
|
+
|
|
3
|
+
CLOAK is early-stage software (pre-1.0), maintained by a single person. The latest release on PyPI (`cloak-cli`) is the one that gets security attention; older releases will not get backports.
|
|
4
|
+
|
|
5
|
+
## Reporting a vulnerability
|
|
6
|
+
|
|
7
|
+
**Please don't file public GitHub issues for security vulnerabilities.** Open a private security advisory at https://github.com/newtophilly/cloak/security/advisories/new and include:
|
|
8
|
+
|
|
9
|
+
- What the vulnerability is and what it lets an attacker do.
|
|
10
|
+
- Reproduction steps or a minimal proof-of-concept.
|
|
11
|
+
- Which version(s) you found it in.
|
|
12
|
+
- Any mitigation you'd suggest.
|
|
13
|
+
|
|
14
|
+
I'll respond as soon as I can. Realistic expectation: a few days for an acknowledgement, longer for a fix depending on severity and how busy I am. If I'm slow, that's solo-maintainer life — feel free to nudge me on the advisory thread.
|
|
15
|
+
|
|
16
|
+
## What counts as a vulnerability
|
|
17
|
+
|
|
18
|
+
In scope (these are real bugs and I want to know about them):
|
|
19
|
+
|
|
20
|
+
- CLOAK leaks code that the policy was supposed to redact — secrets that `cloak scan` should have caught, function bodies that escape `cloak context` redaction, identifiers that should have been renamed by `cloak obfuscate`.
|
|
21
|
+
- The CLI does something it shouldn't — runs unintended code, writes outside the user-supplied output directory, etc.
|
|
22
|
+
- The published distribution (PyPI artifact, GitHub release, `cloak-manifest.json`) is tampered with or has been compromised.
|
|
23
|
+
|
|
24
|
+
Not in scope (CLOAK doesn't claim to prevent these):
|
|
25
|
+
|
|
26
|
+
- An LLM successfully reasoning about a redacted view. CLOAK is friction tooling, not unbreakable protection. See "What CLOAK is NOT" in the README.
|
|
27
|
+
- An obfuscated copy still being human-readable enough for a motivated reader. Same caveat.
|
|
28
|
+
- Vulnerabilities in upstream packages (`detect-secrets`, `tree-sitter`, `typer`, etc.). Report those upstream — but if the upstream bug means CLOAK leaks something, that's in scope here too.
|
|
29
|
+
|
|
30
|
+
## Coordinated disclosure
|
|
31
|
+
|
|
32
|
+
Default: I'd like to fix it privately, ship a release, then publicly disclose. If we agree a public disclosure date, I'll keep to it. If a fix is taking longer than expected, I'll talk to you about extending the embargo rather than letting it slip silently.
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
# Integrating CLOAK from another tool
|
|
2
|
+
|
|
3
|
+
> Audience: AI agents (Codex, Claude, custom assistants) and developer tools that call CLOAK as a subprocess. If you're a human user, the [README](../README.md) is what you want.
|
|
4
|
+
|
|
5
|
+
CLOAK is a local CLI. It runs cleanly headless: stable JSON output (`--json`), predictable exit codes, no interactive prompts in non-TTY mode. That makes it easy to invoke from other tools without surprises.
|
|
6
|
+
|
|
7
|
+
## What CLOAK does, in one paragraph
|
|
8
|
+
|
|
9
|
+
A `.cloakpolicy` (YAML) sits at the user's repo root. CLOAK has three commands: `scan` finds secrets and proprietary markers; `context` produces a redacted markdown view of the source that's safe to paste into an LLM; `obfuscate` produces a transformed copy of the code that — if `--verify "<cmd>"` was passed — only succeeds if the user's tests pass against the transformed output. CLOAK is friction tooling, not unbreakable protection — surface that honestly when relevant.
|
|
10
|
+
|
|
11
|
+
## When you should call CLOAK
|
|
12
|
+
|
|
13
|
+
- The user is preparing to send code to an LLM (paste into chat, build a context packet, share with an assistant).
|
|
14
|
+
- A `.cloakpolicy` file exists at any ancestor directory of the target path. CLOAK finds it automatically; you don't need to.
|
|
15
|
+
- The user explicitly asked for a "safe paste", "redacted version", "AI-safe context", or "obfuscated copy".
|
|
16
|
+
- The user is preparing source for a contractor or third party (use `cloak obfuscate --verify`).
|
|
17
|
+
|
|
18
|
+
## When you should NOT call CLOAK
|
|
19
|
+
|
|
20
|
+
- For files outside the user's working repo or otherwise not under their control.
|
|
21
|
+
- The repo has no `.cloakpolicy` AND the user did not explicitly ask for redaction. Don't surprise users with silent redaction.
|
|
22
|
+
- For pure config files, build artifacts, or non-source assets.
|
|
23
|
+
- When the user asked for an explicit `--no-cloak` or equivalent escape hatch in your tool. Honor it.
|
|
24
|
+
|
|
25
|
+
## Detecting CLOAK and installing it
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
cloak --version
|
|
29
|
+
# Prints "cloak X.Y.Z" on stdout, exit 0. If the command isn't found, install it.
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# Recommended:
|
|
34
|
+
pip install cloak-cli
|
|
35
|
+
# (The PyPI package name is cloak-cli; the binary on $PATH is `cloak`.)
|
|
36
|
+
|
|
37
|
+
# From source:
|
|
38
|
+
git clone https://github.com/newtophilly/cloak.git && cd cloak && pip install .
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
If installation fails, don't silently skip CLOAK in a workflow that explicitly asked for it — surface the error to the user.
|
|
42
|
+
|
|
43
|
+
## Commands and their JSON contracts
|
|
44
|
+
|
|
45
|
+
Always pass `--json` when invoking from another tool. The text output is for humans and uses Rich panels, tables, and ANSI codes that don't parse cleanly.
|
|
46
|
+
|
|
47
|
+
### `cloak scan`
|
|
48
|
+
|
|
49
|
+
Find secrets and proprietary markers.
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
cloak scan <path> [--policy <file>] [--json]
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
JSON output:
|
|
56
|
+
|
|
57
|
+
```json
|
|
58
|
+
{
|
|
59
|
+
"command": "scan",
|
|
60
|
+
"status": "ok",
|
|
61
|
+
"files_scanned": 12,
|
|
62
|
+
"policy_loaded_from": "/abs/path/to/.cloakpolicy",
|
|
63
|
+
"policy_version": 1,
|
|
64
|
+
"findings": [
|
|
65
|
+
{
|
|
66
|
+
"severity": "high",
|
|
67
|
+
"file": "src/foo.py",
|
|
68
|
+
"line": 42,
|
|
69
|
+
"rule_id": "detect-secrets/AWS Access Key",
|
|
70
|
+
"redacted_preview": "AKIA****************",
|
|
71
|
+
"suggested_action": "Rotate this credential and remove it from source."
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
`status` is `"ok"` when there are no findings, `"findings"` when there are. `policy_loaded_from` is `null` if no `.cloakpolicy` was found and defaults are being used. **Raw secrets are never printed — `redacted_preview` is the only secret-derived value that appears in output.**
|
|
78
|
+
|
|
79
|
+
### `cloak context`
|
|
80
|
+
|
|
81
|
+
Generate a redacted markdown view safe to paste into an LLM.
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
cloak context <path> [--out <file>] [--copy] [--strict] [--policy <file>] [--json]
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
- `--out <file>`: write the markdown to a file (default: stdout).
|
|
88
|
+
- `--copy`: also put the result on the system clipboard (uses `pbcopy` / `xclip` / `wl-copy` / `clip.exe` if available).
|
|
89
|
+
- `--strict`: aggressive mode — enum values aliased to opaque names, docstrings stripped. Use this when sharing code with parties you don't trust.
|
|
90
|
+
- `--json`: emit a status JSON instead of generating context. Useful as a probe to check whether CLOAK is available and what policy applies; doesn't actually produce the redacted output.
|
|
91
|
+
|
|
92
|
+
The default markdown output structure:
|
|
93
|
+
- A stable HTML-comment header with version, policy source, and `strict: true|false` for downstream tooling.
|
|
94
|
+
- A `## Files` section listing all input files.
|
|
95
|
+
- Per-file sections with imports, class shapes, function/method signatures, docstrings (per policy).
|
|
96
|
+
- Function/method bodies replaced with `...` for Python, `/* [REDACTED BY CLOAK] */` for JS/TS.
|
|
97
|
+
- Module-level UPPER_SNAKE_CASE constants holding dict/list/object/array literals replaced with `...` (Python) or `/* [REDACTED BY CLOAK] */ null` (JS/TS).
|
|
98
|
+
|
|
99
|
+
`--json` status output:
|
|
100
|
+
|
|
101
|
+
```json
|
|
102
|
+
{
|
|
103
|
+
"command": "context",
|
|
104
|
+
"status": "ok",
|
|
105
|
+
"files_discovered": 12,
|
|
106
|
+
"policy_loaded_from": "/abs/path/to/.cloakpolicy",
|
|
107
|
+
"policy_version": 1,
|
|
108
|
+
"strict": false,
|
|
109
|
+
"implementation_status": "Python supported; JS/TS supported via tree-sitter."
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### `cloak obfuscate`
|
|
114
|
+
|
|
115
|
+
Produce a transformed copy of a repo, optionally gated on a test command passing.
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
cloak obfuscate <path> --out <out_dir> [--verify "<test_cmd>"] [--profile standard|aggressive] [--policy <file>] [--json]
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
- `--out`: required. Output directory; must not exist or must be empty.
|
|
122
|
+
- `--verify "<test_cmd>"`: shell command run inside the output dir. The operation FAILS (exit 1) if the command exits non-zero. This is the differentiating feature — only succeeds if the user's tests pass against the obfuscated copy.
|
|
123
|
+
- `--profile`: currently `standard` is the only supported value. `aggressive` is reserved.
|
|
124
|
+
|
|
125
|
+
JSON output:
|
|
126
|
+
|
|
127
|
+
```json
|
|
128
|
+
{
|
|
129
|
+
"command": "obfuscate",
|
|
130
|
+
"status": "ok",
|
|
131
|
+
"output_dir": "/abs/path/to/out",
|
|
132
|
+
"manifest_path": "/abs/path/to/out/cloak-manifest.json",
|
|
133
|
+
"files_copied": 1,
|
|
134
|
+
"files_transformed": 2,
|
|
135
|
+
"rename_count": 4,
|
|
136
|
+
"policy_loaded_from": "/abs/path/to/.cloakpolicy",
|
|
137
|
+
"verify_command": "pytest",
|
|
138
|
+
"verify_passed": true
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
`status` is `"ok"` on success, `"verify_failed"` when `--verify` was passed and the test command exited non-zero, `"error"` when the operation couldn't proceed (e.g., output directory not empty). The output is still written when `verify_failed` so users can inspect what went wrong.
|
|
143
|
+
|
|
144
|
+
The output directory always contains `cloak-manifest.json` — the audit-trail artifact with: cloak version, generated-at timestamp, sha256 of every source file and every output file, the rename map keyed `path:original`, the policy hash + full policy snapshot, and (if applicable) the verify command + its result. The schema is in [`src/cloak/obfuscate/manifest.py`](../src/cloak/obfuscate/manifest.py).
|
|
145
|
+
|
|
146
|
+
## Exit codes
|
|
147
|
+
|
|
148
|
+
- `0` — success.
|
|
149
|
+
- `1` — operation completed with findings or verify failure that the caller should look at (e.g., `cloak scan` found secrets, `cloak obfuscate --verify` failed).
|
|
150
|
+
- `2` — usage / validation error (bad arguments, output directory not empty, etc.).
|
|
151
|
+
|
|
152
|
+
When in doubt, parse the JSON `status` field rather than relying only on the exit code.
|
|
153
|
+
|
|
154
|
+
## Policy file (`.cloakpolicy`)
|
|
155
|
+
|
|
156
|
+
YAML at the repo root. CLOAK auto-discovers it by walking up from the target path. If no policy is found, sensible defaults apply.
|
|
157
|
+
|
|
158
|
+
A short example:
|
|
159
|
+
|
|
160
|
+
```yaml
|
|
161
|
+
version: 1
|
|
162
|
+
sensitive_paths: ["src/pricing/**"]
|
|
163
|
+
public_api: ["QuoteEngine.calculate_quote"]
|
|
164
|
+
context_defaults:
|
|
165
|
+
keep_docstrings: true
|
|
166
|
+
redact_function_bodies: true
|
|
167
|
+
alias_enums: false
|
|
168
|
+
obfuscate_defaults:
|
|
169
|
+
profile: standard
|
|
170
|
+
strip_docstrings: false
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
A full annotated example is at [`.cloakpolicy.example`](../.cloakpolicy.example) at the repo root.
|
|
174
|
+
|
|
175
|
+
**Don't modify a project's `.cloakpolicy` without explicit user consent.** Treat it like a CODEOWNERS file or a CI config — it's governance, not configuration you can adjust on the user's behalf.
|
|
176
|
+
|
|
177
|
+
## Common patterns
|
|
178
|
+
|
|
179
|
+
### Building a redacted context packet for an LLM
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
# Probe: is CLOAK installed and is there a policy in this repo?
|
|
183
|
+
cloak scan /path/to/repo --json
|
|
184
|
+
|
|
185
|
+
# If a policy was loaded OR the user explicitly asked for redaction:
|
|
186
|
+
cloak context /path/to/repo --out /tmp/safe.md
|
|
187
|
+
# Use /tmp/safe.md as the source-code section of the packet.
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Pre-paste workflow (user is about to ask an LLM for help)
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
cloak context /path/to/repo/src/foo.py --copy
|
|
194
|
+
# Tell the user: "Redacted view is on your clipboard; paste away."
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Preparing source for a contractor
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
cloak obfuscate /path/to/repo --out /tmp/repo.cloaked --verify "pytest"
|
|
201
|
+
# If exit 0, the obfuscated copy passes the user's tests — safe to ship.
|
|
202
|
+
# If exit 1, look at the JSON output's verify-related fields and tell the user.
|
|
203
|
+
# Either way, /tmp/repo.cloaked/cloak-manifest.json is the audit artifact.
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## Honesty constraints when describing CLOAK to users
|
|
207
|
+
|
|
208
|
+
If your tool surfaces CLOAK output to a human, please match CLOAK's positioning:
|
|
209
|
+
|
|
210
|
+
- DO: "CLOAK redacted the proprietary parts before sending."
|
|
211
|
+
- DO: "CLOAK created a transformed copy that still passes your tests."
|
|
212
|
+
- DON'T: "Your code is now safe from AI."
|
|
213
|
+
- DON'T: "This is unreadable to LLMs."
|
|
214
|
+
- DON'T: "This is encrypted."
|
|
215
|
+
|
|
216
|
+
Obfuscation is friction, not cryptographic protection. The "What CLOAK is NOT" section in the [README](../README.md) is the canonical list of caveats — surface that wording verbatim if a user asks about CLOAK's guarantees.
|
|
217
|
+
|
|
218
|
+
## Reporting integration issues
|
|
219
|
+
|
|
220
|
+
Open an issue at https://github.com/newtophilly/cloak/issues with:
|
|
221
|
+
- The exact CLOAK version (`cloak --version`).
|
|
222
|
+
- Which tool was integrating with CLOAK (yours, fob, your own client, etc.).
|
|
223
|
+
- The command invoked and the full output.
|
|
224
|
+
- What you expected vs. what happened.
|