repo-cloak-cli 1.3.3 → 1.3.4
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.
- package/DEVELOPMENT.md +74 -0
- package/LINKEDIN.md +14 -0
- package/MEDIUM.md +335 -0
- package/README.md +65 -23
- package/SLIDES-TO-GENERATE-BY-NOTEBOOK-LLM.md +52 -0
- package/package.json +2 -1
- package/src/cli.js +2 -0
- package/src/commands/pull.js +305 -125
- package/src/core/agents-template.js +37 -0
- package/src/core/anonymizer.js +14 -4
- package/src/core/git.js +68 -0
- package/src/core/path-cache.js +131 -0
- package/src/core/secrets.js +169 -0
- package/src/ui/banner.js +32 -33
- package/src/ui/prompts.js +139 -34
- package/src/ui/treeCheckboxSelector.js +253 -0
- package/test-tree.js +2 -0
- package/tests/anonymizer.test.js +17 -17
- package/tests/copier.test.js +3 -3
- package/tests/crypto.test.js +3 -3
- package/tests/git.test.js +59 -1
- package/tests/path-cache.test.js +164 -0
- package/tests/secrets.test.js +93 -0
- package/.github/workflows/release.yml +0 -92
- package/src/ui/fileSelector.js +0 -256
package/DEVELOPMENT.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Development Guide
|
|
2
|
+
|
|
3
|
+
This guide explains how to set up, run, and test `repo-cloak` locally during development.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
Ensure you have Node.js (>=18.0.0) installed on your system.
|
|
8
|
+
|
|
9
|
+
## Setup
|
|
10
|
+
|
|
11
|
+
First, install the project dependencies:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Running the CLI Locally
|
|
18
|
+
|
|
19
|
+
If you want to manually test the CLI functionality without installing it globally, you can execute the main bin file directly:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Start the interactive menu
|
|
23
|
+
npm start
|
|
24
|
+
|
|
25
|
+
# Or run specific commands directly
|
|
26
|
+
node bin/repo-cloak.js pull
|
|
27
|
+
node bin/repo-cloak.js pull --source ./my-project --dest ./extracted
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Global Local Testing (Recommended)
|
|
31
|
+
|
|
32
|
+
To test how the CLI behaves globally on your machine (using the `repo-cloak` command anywhere), you can create a symlink from your global `node_modules` to your local project directory using `npm link`.
|
|
33
|
+
|
|
34
|
+
1. Run this inside the project folder (`repo-cloak`):
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm link
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
2. You can now open any other folder on your computer and test your local changes by simply running:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
repo-cloak pull
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
3. When you are done testing and want to remove the symlink, run:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npm unlink -g repo-cloak-cli
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Running Tests
|
|
53
|
+
|
|
54
|
+
This project uses **Vitest** for unit testing.
|
|
55
|
+
|
|
56
|
+
To run the test suite once:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npm test
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
To run tests in watch mode (automatically re-runs when you save changes):
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
npm run test:watch
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Linting
|
|
69
|
+
|
|
70
|
+
To check for code style issues using ESLint:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
npm run lint
|
|
74
|
+
```
|
package/LINKEDIN.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
The race to adopt AI in software development is well underway. Teams that have embraced it are shipping faster, iterating more confidently, and scaling their output in ways that were not possible a year ago.
|
|
2
|
+
|
|
3
|
+
For enterprise teams, the challenge is different. The codebases they work on carry proprietary logic, internal architecture, and sensitive data that cannot be exposed to external tools. Blocking AI entirely preserves security but costs velocity. Allowing unrestricted access gains velocity but introduces risk.
|
|
4
|
+
|
|
5
|
+
There is a middle ground worth exploring: controlled, anonymized workspaces where AI operates on the structure and patterns of enterprise code without ever accessing the proprietary source itself. A cloaked environment that gives AI enough context to deliver real value, while maintaining the isolation that enterprise governance requires.
|
|
6
|
+
|
|
7
|
+
Explored this approach and built Repo-Cloak, an open-source CLI tool that creates these safe, isolated workspaces with automated secret scanning and encrypted reversible mappings. Changes push back into the original repository cleanly, as if AI had been working on the real codebase all along.
|
|
8
|
+
|
|
9
|
+
Enterprise AI adoption does not have to be all or nothing.
|
|
10
|
+
|
|
11
|
+
📖 Read the full breakdown here: [Article Link]
|
|
12
|
+
🔧 Try the tool: https://www.npmjs.com/package/repo-cloak-cli
|
|
13
|
+
|
|
14
|
+
#EnterpriseAI #SoftwareEngineering #CodeSecurity #DeveloperProductivity #OpenSource
|
package/MEDIUM.md
ADDED
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
# Repo-Cloak CLI: Enterprise AI Adoption Doesn't Have to Be All or Nothing
|
|
2
|
+
|
|
3
|
+
Across the industry, engineering teams are embracing AI coding tools and seeing real results. Faster refactors. Better test coverage. Quicker turnaround on features. Organizations that have gone all-in on AI-assisted development are shipping faster than ever, and the gap between them and everyone else is widening.
|
|
4
|
+
|
|
5
|
+
Enterprise teams see this happening. They want that same velocity. But they also sit on codebases full of proprietary business logic, internal architecture, customer data flows, and credentials that cannot leave controlled boundaries. Security says no. Compliance says no. And honestly, they are right to say no.
|
|
6
|
+
|
|
7
|
+
So developers do what they can: copy a few functions into a chat window, rename some symbols by hand, paste the output back, and hope nothing sensitive slipped through. It works, sort of, but it is slow, inconsistent, and impossible to audit.
|
|
8
|
+
|
|
9
|
+
The result is a frustrating middle ground. Teams that fully block AI tools lose velocity and risk their best engineers getting frustrated. Teams that fully embrace AI tools without guardrails take on exposure they may not fully understand. Neither extreme works well for organizations that need both speed and control.
|
|
10
|
+
|
|
11
|
+
**What if there was a middle path?**
|
|
12
|
+
|
|
13
|
+
This article explores one such approach, where developers work with AI on **anonymized abstractions** of their codebase rather than the real thing. AI gets the structural context it needs to produce high-quality output. The proprietary code, the real names, and the secrets never leave the building. And the changes push back cleanly into the original repository, as if AI had been working on the real codebase all along.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Why AI Needs More Than Snippets
|
|
18
|
+
|
|
19
|
+
AI coding assistants produce dramatically better results when they see real project structure. Hand them a single isolated function, and the output is generic. Hand them a realistic project slice with folder hierarchies, dependency relationships, and naming conventions, and the results transform: meaningful refactors, accurate test generation, pattern-aware code scaffolding.
|
|
20
|
+
|
|
21
|
+
But realistic project slices contain exactly what enterprises protect most carefully.
|
|
22
|
+
|
|
23
|
+
```text
|
|
24
|
+
┌──────────────────────────────────┐
|
|
25
|
+
│ Full Enterprise Codebase │
|
|
26
|
+
└──────────┬───────────────────────┘
|
|
27
|
+
│
|
|
28
|
+
╔══════════╧═══════════════════════════════╗
|
|
29
|
+
║ PROPRIETARY CODE ║
|
|
30
|
+
║ ║
|
|
31
|
+
║ Business Internal Secrets & ║
|
|
32
|
+
║ Logic Naming Credentials ║
|
|
33
|
+
║ ║
|
|
34
|
+
║ Architecture Patterns ║
|
|
35
|
+
║ ║
|
|
36
|
+
╚════════════════════╤═════════════════════╝
|
|
37
|
+
│
|
|
38
|
+
▼
|
|
39
|
+
╔══════════════════════════════╗
|
|
40
|
+
║ Cannot expose to external ║
|
|
41
|
+
║ tools without controls ║
|
|
42
|
+
╚══════════════════════════════╝
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The key insight is this: AI does not actually need the proprietary code itself. It needs the **structure, patterns, and relationships** to reason about. If you can give AI a project that looks and behaves like the real thing architecturally, but with all identifying details swapped out, it can still produce excellent work. And that work can be mapped straight back into the original codebase.
|
|
46
|
+
|
|
47
|
+
That is the core idea behind **Repo-Cloak**, an open-source CLI tool that creates anonymized workspaces from enterprise codebases.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## How It Works
|
|
52
|
+
|
|
53
|
+
Rather than giving AI tools direct access to source control, you create a deliberate boundary: a cloaked workspace that contains only the files you choose, with identifiers anonymized and secrets caught before anything crosses the line.
|
|
54
|
+
|
|
55
|
+
```text
|
|
56
|
+
╔═══════════════════════════════════════════════╗
|
|
57
|
+
║ ENTERPRISE BOUNDARY ║
|
|
58
|
+
║ ║
|
|
59
|
+
║ ┌───────────────────────────────────────┐ ║
|
|
60
|
+
║ │ Original Repository │ ║
|
|
61
|
+
║ │ (Full source, secrets, real names) │ ║
|
|
62
|
+
║ └──────────────────┬────────────────────┘ ║
|
|
63
|
+
╚══════════════════════╪════════════════════════╝
|
|
64
|
+
│
|
|
65
|
+
1. Select specific files (opt-in)
|
|
66
|
+
│
|
|
67
|
+
▼
|
|
68
|
+
┌─────────────────────┐
|
|
69
|
+
│ Secret Detection │
|
|
70
|
+
│ (20+ categories) │
|
|
71
|
+
└──────────┬──────────┘
|
|
72
|
+
│
|
|
73
|
+
2. Scan for embedded secrets
|
|
74
|
+
│
|
|
75
|
+
▼
|
|
76
|
+
┌─────────────────────┐
|
|
77
|
+
│ Anonymization │
|
|
78
|
+
│ (Case-preserving) │
|
|
79
|
+
└──────────┬──────────┘
|
|
80
|
+
│
|
|
81
|
+
3. Rewrite identifiers
|
|
82
|
+
│
|
|
83
|
+
▼
|
|
84
|
+
┌───────────────────────────────────────────────┐
|
|
85
|
+
│ CLOAKED WORKSPACE │
|
|
86
|
+
│ Selected files, anonymized identifiers │
|
|
87
|
+
│ Safe for AI tools │
|
|
88
|
+
│ │
|
|
89
|
+
│ .repo-cloak-map.json (AES-256 encrypted) │
|
|
90
|
+
└──────────────────┬────────────────────────────┘
|
|
91
|
+
│
|
|
92
|
+
4. Collaborate with AI tools
|
|
93
|
+
│
|
|
94
|
+
▼
|
|
95
|
+
┌─────────────────────┐
|
|
96
|
+
│ Reverse Mapping │
|
|
97
|
+
│ (Decrypt + Merge) │
|
|
98
|
+
└──────────┬──────────┘
|
|
99
|
+
│
|
|
100
|
+
5. Restore into original repo
|
|
101
|
+
│
|
|
102
|
+
▼
|
|
103
|
+
╔═══════════════════════════════════════════════╗
|
|
104
|
+
║ Changes land back with real names ║
|
|
105
|
+
║ Ready for code review and testing ║
|
|
106
|
+
╚═══════════════════════════════════════════════╝
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
From the AI's perspective, this is just another project to work on. From the organization's perspective, the proprietary code never left. Only its anonymized abstraction did.
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Giving AI the Right Context, Nothing More
|
|
114
|
+
|
|
115
|
+
### Smart File Selection
|
|
116
|
+
|
|
117
|
+
Nothing leaves the repository boundary unless you explicitly choose it. You navigate the directory tree and opt in, file by file. For teams using Git, this gets even sharper:
|
|
118
|
+
|
|
119
|
+
```text
|
|
120
|
+
┌────────────────────┐
|
|
121
|
+
│ Git Repository │
|
|
122
|
+
│ Detected │
|
|
123
|
+
└─────────┬──────────┘
|
|
124
|
+
│
|
|
125
|
+
How would you like to select?
|
|
126
|
+
│
|
|
127
|
+
┌──────────────┼──────────────┐
|
|
128
|
+
│ │ │
|
|
129
|
+
▼ ▼ ▼
|
|
130
|
+
┌─────────────┐┌─────────────┐┌─────────────┐
|
|
131
|
+
│ Uncommitted ││ Specific ││ Manual │
|
|
132
|
+
│ Changes ││ Commits ││ Selection │
|
|
133
|
+
│ (working ││ (by hash or ││ (browse │
|
|
134
|
+
│ directory) ││ history) ││ full tree) │
|
|
135
|
+
└──────┬──────┘└──────┬──────┘└──────┬──────┘
|
|
136
|
+
│ │ │
|
|
137
|
+
└──────────────┼──────────────┘
|
|
138
|
+
│
|
|
139
|
+
▼
|
|
140
|
+
┌─────────────────────┐
|
|
141
|
+
│ Selected Files │
|
|
142
|
+
└─────────────────────┘
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
You can target a specific commit, select from recent history, or pull only uncommitted work. AI assistance gets scoped to exactly the delta that matters, not the entire codebase.
|
|
146
|
+
|
|
147
|
+
### Anonymization That Preserves Structure
|
|
148
|
+
|
|
149
|
+
This is the piece that makes the approach practical. Identifiers get rewritten, but the project structure stays architecturally identical. AI sees real folder hierarchies, real dependency relationships, real naming patterns. It just does not see _your_ names.
|
|
150
|
+
|
|
151
|
+
```text
|
|
152
|
+
ORIGINAL CLOAKED
|
|
153
|
+
───────────────────────────── ─────────────────────────────
|
|
154
|
+
📂 xcorp-platform/ 📂 acme-platform/
|
|
155
|
+
├── 📂 XCorpServices/ ├── 📂 AcmeServices/
|
|
156
|
+
│ ├── XCorpPaymentService.cs │ ├── AcmePaymentService.cs
|
|
157
|
+
│ ├── XCorpInventoryService.cs │ ├── AcmeInventoryService.cs
|
|
158
|
+
│ └── IXCorpNotification.cs │ └── IAcmeNotification.cs
|
|
159
|
+
├── 📂 config/ ├── 📂 config/
|
|
160
|
+
│ └── xcorp-settings.json │ └── acme-settings.json
|
|
161
|
+
└── 📂 tests/ └── 📂 tests/
|
|
162
|
+
└── XCORP_INTEGRATION_TEST.cs └── ACME_INTEGRATION_TEST.cs
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Every casing convention is preserved: `XCorp` becomes `Acme`, `xcorp` becomes `acme`, `XCORP` becomes `ACME`. When AI generates code changes against this workspace, those changes map straight back to the real codebase with a single push command. No manual rename gymnastics. No stitching things back together.
|
|
166
|
+
|
|
167
|
+
### Secret Scanning Before Anything Moves
|
|
168
|
+
|
|
169
|
+
Even with anonymized names, enterprise codebases often harbour embedded secrets: API keys left in config files, database connection strings from prototyping, private keys committed years ago. The tool scans every selected file for 20+ categories of sensitive data before extraction happens.
|
|
170
|
+
|
|
171
|
+
```text
|
|
172
|
+
┌─────────────────────┐
|
|
173
|
+
│ Selected Files │
|
|
174
|
+
└──────────┬──────────┘
|
|
175
|
+
│
|
|
176
|
+
▼
|
|
177
|
+
┌─────────────────────┐
|
|
178
|
+
│ Secret Scanner │
|
|
179
|
+
│ (20+ patterns) │
|
|
180
|
+
└──────────┬──────────┘
|
|
181
|
+
│
|
|
182
|
+
┌───────────┬───────┼───────┬───────────┐
|
|
183
|
+
│ │ │ │ │
|
|
184
|
+
▼ ▼ ▼ ▼ ▼
|
|
185
|
+
Cloud Platform Payment Crypto Infrastructure
|
|
186
|
+
Keys Tokens Keys Material & Credentials
|
|
187
|
+
(AWS,Google) (GitHub, (Stripe)(RSA,DSA) (DB strings,
|
|
188
|
+
Slack) JWTs, OAuth)
|
|
189
|
+
│ │ │ │ │
|
|
190
|
+
└───────────┴───────┼───────┴───────────┘
|
|
191
|
+
│
|
|
192
|
+
Any findings?
|
|
193
|
+
│
|
|
194
|
+
┌──────────┴──────────┐
|
|
195
|
+
│ │
|
|
196
|
+
▼ ▼
|
|
197
|
+
┌─────────────────┐ ┌─────────────────┐
|
|
198
|
+
│ HALT │ │ CLEAN │
|
|
199
|
+
│ Show file and │ │ Proceed with │
|
|
200
|
+
│ line number. │ │ extraction │
|
|
201
|
+
│ Require user │ │ │
|
|
202
|
+
│ confirmation. │ │ │
|
|
203
|
+
└─────────────────┘ └─────────────────┘
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
If anything triggers, the process halts. File name and line number are displayed. The developer must explicitly confirm before proceeding. The default is no.
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## A Sample Workflow: Generating Test Cases Without Exposing Business Logic
|
|
211
|
+
|
|
212
|
+
To see how this plays out in practice, consider a common scenario.
|
|
213
|
+
|
|
214
|
+
A developer on an enterprise team needs comprehensive test coverage for a payment processing module. The business logic inside the service layer is proprietary, but the **interfaces, abstractions, and frontend forms** that interact with it are not. They contain no trade secrets. They just define the shape of the system.
|
|
215
|
+
|
|
216
|
+
Here is how the workflow looks:
|
|
217
|
+
|
|
218
|
+
```text
|
|
219
|
+
Step 1: Developer runs `repo-cloak pull`
|
|
220
|
+
──────────────────────────────────────────────────────────────
|
|
221
|
+
|
|
222
|
+
The tool detects a Git repository and asks how to select files.
|
|
223
|
+
The developer chooses "Manual Selection" and picks only:
|
|
224
|
+
|
|
225
|
+
✓ IPaymentService.cs (interface)
|
|
226
|
+
✓ IPaymentValidator.cs (interface)
|
|
227
|
+
✓ PaymentRequest.cs (DTO / model)
|
|
228
|
+
✓ PaymentResponse.cs (DTO / model)
|
|
229
|
+
✓ PaymentForm.tsx (frontend form)
|
|
230
|
+
✓ PaymentForm.test.tsx (existing tests)
|
|
231
|
+
✗ PaymentService.cs (proprietary logic — skipped)
|
|
232
|
+
✗ PaymentGatewayAdapter.cs (proprietary integration — skipped)
|
|
233
|
+
✗ appsettings.json (credentials — skipped)
|
|
234
|
+
|
|
235
|
+
Step 2: Secret scanner runs automatically
|
|
236
|
+
──────────────────────────────────────────────────────────────
|
|
237
|
+
|
|
238
|
+
All selected files are scanned. No secrets found. Extraction proceeds.
|
|
239
|
+
|
|
240
|
+
Step 3: Anonymization applied
|
|
241
|
+
──────────────────────────────────────────────────────────────
|
|
242
|
+
|
|
243
|
+
"XCorp" → "Acme" across file names, folder paths, and contents.
|
|
244
|
+
A cloaked workspace is created with the anonymized files.
|
|
245
|
+
|
|
246
|
+
Step 4: AI generates test cases
|
|
247
|
+
──────────────────────────────────────────────────────────────
|
|
248
|
+
|
|
249
|
+
The developer opens the cloaked workspace in their IDE with
|
|
250
|
+
an AI assistant. The AI can see:
|
|
251
|
+
|
|
252
|
+
• The interface contracts (what the service promises to do)
|
|
253
|
+
• The data models (what goes in and comes out)
|
|
254
|
+
• The frontend form (what the user interacts with)
|
|
255
|
+
• The existing test patterns (how tests are structured)
|
|
256
|
+
|
|
257
|
+
It generates comprehensive test cases covering:
|
|
258
|
+
• Validation edge cases
|
|
259
|
+
• Missing field handling
|
|
260
|
+
• Boundary conditions on payment amounts
|
|
261
|
+
• Form submission error states
|
|
262
|
+
• Integration contract tests against the interface
|
|
263
|
+
|
|
264
|
+
Step 5: Push changes back
|
|
265
|
+
──────────────────────────────────────────────────────────────
|
|
266
|
+
|
|
267
|
+
Developer runs `repo-cloak push`. All anonymized names revert
|
|
268
|
+
to originals. The new test files land in the real repository,
|
|
269
|
+
ready for code review.
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
The AI never saw the payment processing logic, the gateway integration, or the credentials. It only saw the abstractions, the shapes, and the patterns. And that was enough to generate meaningful, production-quality test coverage.
|
|
273
|
+
|
|
274
|
+
This same approach works for other scenarios: generating API documentation from controller signatures, scaffolding new features based on existing patterns, or exploring refactoring strategies across a service boundary. The developer always controls what goes in, and the proprietary core stays untouched.
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
## Pushing Changes Back
|
|
279
|
+
|
|
280
|
+
This is where the approach pays off. AI generates code against the anonymized workspace. When that work is ready to come home, the mapping (AES-256 encrypted, tied to a local key) reverses every replacement, remaps file paths, and deposits the modified files cleanly into the original repository.
|
|
281
|
+
|
|
282
|
+
The result is a conventional changeset, ready for code review and testing, as if AI had been working on the real codebase directly. Except it never was.
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## Where This Fits
|
|
287
|
+
|
|
288
|
+
```text
|
|
289
|
+
┌─────────────────────────────────────────────────────┐
|
|
290
|
+
│ Existing Enterprise Controls │
|
|
291
|
+
│ │
|
|
292
|
+
│ Access Controls Security Policies Contracts │
|
|
293
|
+
└─────────────────────────┬───────────────────────────┘
|
|
294
|
+
│
|
|
295
|
+
works alongside
|
|
296
|
+
│
|
|
297
|
+
┌─────────────────────────┼───────────────────────────┐
|
|
298
|
+
│ Repo-Cloak Layer │
|
|
299
|
+
│ │
|
|
300
|
+
│ Scoped Exposure ........... Opt-in file selection │
|
|
301
|
+
│ Secret Detection .......... Automated scanning │
|
|
302
|
+
│ Encrypted Mappings ........ AES-256 at rest │
|
|
303
|
+
│ Audit Trail ............... Timestamped history │
|
|
304
|
+
│ Local Processing .......... Zero external calls │
|
|
305
|
+
│ │
|
|
306
|
+
└─────────────────────────┬───────────────────────────┘
|
|
307
|
+
│
|
|
308
|
+
▼
|
|
309
|
+
┌───────────────────────────┐
|
|
310
|
+
│ Controlled AI Adoption │
|
|
311
|
+
│ with Audit Trail │
|
|
312
|
+
└───────────────────────────┘
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
This is not a replacement for access controls or compliance frameworks. It is a practical layer that works alongside them. It also does not obfuscate control flow or prevent logical inference about what a component does. AI needs real structure to be useful, so the approach preserves it. What it removes are the obvious identifiers, secrets, and exposure surface that make enterprise teams uncomfortable.
|
|
316
|
+
|
|
317
|
+
---
|
|
318
|
+
|
|
319
|
+
## Finding the Balance
|
|
320
|
+
|
|
321
|
+
Some organizations are going all-in on AI and seeing massive returns. Others have locked it out entirely, and their developers feel it every day. Most enterprise teams sit somewhere in between, wanting the efficiency but unsure how to get there without the risk.
|
|
322
|
+
|
|
323
|
+
This approach offers one way to find that balance. It is not the only way, and it is not a silver bullet. But it turns an all-or-nothing decision into something more nuanced: _"Which parts of our codebase can benefit from AI assistance, and how do we expose them safely?"_
|
|
324
|
+
|
|
325
|
+
The codebase stays in its guarded world. The developers get the productivity boost that modern tooling delivers. And the organization gets a governance trail it can actually trust.
|
|
326
|
+
|
|
327
|
+
---
|
|
328
|
+
|
|
329
|
+
**Repo-Cloak is open source and available on npm.**
|
|
330
|
+
|
|
331
|
+
```bash
|
|
332
|
+
npm install -g repo-cloak-cli
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
[GitHub Repository](https://github.com/iamshz97/repo-cloak) · Works on macOS, Windows, and Linux · MIT License
|
package/README.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
# repo-cloak 🎭
|
|
2
2
|
|
|
3
|
+
> ⚠️ **ARCHIVED**: This CLI project is no longer actively maintained. All new development has moved to the official [Repo-Cloak VS Code Extension](https://github.com/iamshz97/repo-cloak-vs-code).
|
|
4
|
+
|
|
3
5
|
> **Selectively extract and anonymize files from repositories**
|
|
4
6
|
|
|
5
|
-
Perfect for sharing code with AI agents without exposing proprietary details. Extract specific files, replace sensitive information
|
|
7
|
+
Create controlled, anonymized workspaces from enterprise codebases. Perfect for sharing code with AI agents without exposing proprietary details. Extract specific files, replace sensitive information, scan for secrets, and restore changes later.
|
|
6
8
|
|
|
7
9
|
[](https://www.npmjs.com/package/repo-cloak-cli)
|
|
8
10
|
[](https://opensource.org/licenses/MIT)
|
|
@@ -10,10 +12,13 @@ Perfect for sharing code with AI agents without exposing proprietary details. Ex
|
|
|
10
12
|
## ✨ Features
|
|
11
13
|
|
|
12
14
|
- 🔍 **Interactive file browser** - Navigate and select files with a beautiful TUI
|
|
13
|
-
- 🎭 **Smart anonymization** - Replace sensitive keywords while preserving case
|
|
14
|
-
- 📁 **Structure preservation** - Maintains original folder hierarchy
|
|
15
|
+
- 🎭 **Smart anonymization** - Replace sensitive keywords while preserving case (UPPER, lower, TitleCase)
|
|
16
|
+
- 📁 **Structure preservation** - Maintains original folder hierarchy, file names, and paths
|
|
15
17
|
- 🔄 **Push/Pull workflow** - Extract files, work on them, push back with original names
|
|
16
|
-
-
|
|
18
|
+
- 🔐 **Encrypted mappings** - AES-256 encrypted mapping file tied to a local secret key
|
|
19
|
+
- 🛡️ **Secret scanning** - Automatically detects API keys, tokens, credentials, and secrets before extraction
|
|
20
|
+
- 📂 **Git-aware selection** - Pull files from specific commits, recent history, or uncommitted changes
|
|
21
|
+
- 🤖 **AI agent context** - Auto-generates AGENTS.md in cloaked workspaces to guide AI assistants
|
|
17
22
|
- 🌍 **Cross-platform** - Works on Windows, macOS, and Linux
|
|
18
23
|
|
|
19
24
|
## 📦 Installation
|
|
@@ -22,12 +27,6 @@ Perfect for sharing code with AI agents without exposing proprietary details. Ex
|
|
|
22
27
|
npm install -g repo-cloak-cli
|
|
23
28
|
```
|
|
24
29
|
|
|
25
|
-
### To install locally
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
npm install D:\Projects\repo-cloak
|
|
29
|
-
```
|
|
30
|
-
|
|
31
30
|
Or use directly with npx:
|
|
32
31
|
|
|
33
32
|
```bash
|
|
@@ -47,10 +46,23 @@ repo-cloak pull --source ./my-project --dest ./extracted
|
|
|
47
46
|
```
|
|
48
47
|
|
|
49
48
|
1. Select files/folders to extract
|
|
50
|
-
2.
|
|
49
|
+
2. Secret scanner checks for embedded credentials
|
|
51
50
|
3. Add keyword replacements (e.g., "Microsoft Corp" → "ACME Inc")
|
|
52
51
|
4. Confirm and extract!
|
|
53
52
|
|
|
53
|
+
### Pull from Git Commits
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Pull files changed in a specific commit
|
|
57
|
+
repo-cloak pull --commit a1b2c3d
|
|
58
|
+
|
|
59
|
+
# Pull files from multiple commits
|
|
60
|
+
repo-cloak pull --commit a1b2c3d e4f5g6h
|
|
61
|
+
|
|
62
|
+
# Browse and select from recent commits interactively
|
|
63
|
+
repo-cloak pull --list-commits 10
|
|
64
|
+
```
|
|
65
|
+
|
|
54
66
|
### Push (Restore)
|
|
55
67
|
|
|
56
68
|
```bash
|
|
@@ -78,29 +90,53 @@ repo-cloak push --force
|
|
|
78
90
|
## 🎯 Use Cases
|
|
79
91
|
|
|
80
92
|
- **AI Code Review** - Share proprietary code with AI tools by anonymizing company/project names
|
|
93
|
+
- **Test Generation** - Expose interfaces and DTOs to AI for generating test coverage without revealing business logic
|
|
81
94
|
- **Open Source Templates** - Extract project templates while removing internal references
|
|
82
95
|
- **Code Samples** - Create sanitized examples from production code
|
|
83
96
|
- **Compliance** - Remove sensitive identifiers before sharing code externally
|
|
84
97
|
|
|
98
|
+
## 🛡️ Secret Scanning
|
|
99
|
+
|
|
100
|
+
Before any file leaves your repository, Repo-Cloak scans for **20+ categories** of sensitive data:
|
|
101
|
+
|
|
102
|
+
| Category | Examples |
|
|
103
|
+
| ---------------------- | --------------------------------------------------------------- |
|
|
104
|
+
| Cloud Keys | AWS Access Keys, Google API Keys, Azure tokens |
|
|
105
|
+
| Platform Tokens | GitHub PATs, Slack tokens, Discord bot tokens |
|
|
106
|
+
| Payment Keys | Stripe live & test keys |
|
|
107
|
+
| Cryptographic Material | RSA, DSA, OpenSSH private keys |
|
|
108
|
+
| Authentication | JWTs, Bearer tokens, OAuth access tokens |
|
|
109
|
+
| Infrastructure | Database connection strings (PostgreSQL, MongoDB, MySQL, Redis) |
|
|
110
|
+
| Credentials | Passwords, secrets, and passphrase assignments |
|
|
111
|
+
| Service Keys | Heroku, Mailgun, and other platform-specific keys |
|
|
112
|
+
|
|
113
|
+
If secrets are detected, extraction halts with a warning showing exact file and line numbers. You must explicitly confirm before proceeding.
|
|
114
|
+
|
|
85
115
|
## 📋 Commands
|
|
86
116
|
|
|
87
|
-
| Command
|
|
88
|
-
|
|
89
|
-
| `repo-cloak`
|
|
90
|
-
| `repo-cloak pull`
|
|
91
|
-
| `repo-cloak
|
|
92
|
-
| `repo-cloak --
|
|
93
|
-
| `repo-cloak
|
|
117
|
+
| Command | Description |
|
|
118
|
+
| --------------------------------- | --------------------------------------- |
|
|
119
|
+
| `repo-cloak` | Interactive menu to choose pull or push |
|
|
120
|
+
| `repo-cloak pull` | Extract and anonymize files |
|
|
121
|
+
| `repo-cloak pull --commit <hash>` | Pull files from specific commits |
|
|
122
|
+
| `repo-cloak pull --list-commits` | Select from recent commit history |
|
|
123
|
+
| `repo-cloak push` | Restore files with original names |
|
|
124
|
+
| `repo-cloak --help` | Show help |
|
|
125
|
+
| `repo-cloak --version` | Show version |
|
|
94
126
|
|
|
95
127
|
## 🔧 Options
|
|
96
128
|
|
|
97
129
|
### Pull Options
|
|
130
|
+
|
|
98
131
|
- `-s, --source <path>` - Source directory (default: current directory)
|
|
99
132
|
- `-d, --dest <path>` - Destination directory
|
|
133
|
+
- `-c, --commit <hash...>` - Pull files from specific commit(s)
|
|
134
|
+
- `-l, --list-commits [count]` - List and select from recent commits (default: 10)
|
|
100
135
|
- `-f, --force` - Force pull all files (skip prompts, requires existing mapping)
|
|
101
136
|
- `-q, --quiet` - Minimal output
|
|
102
137
|
|
|
103
138
|
### Push Options
|
|
139
|
+
|
|
104
140
|
- `-s, --source <path>` - Cloaked backup directory
|
|
105
141
|
- `-d, --dest <path>` - Destination directory
|
|
106
142
|
- `-f, --force` - Force push/restore all files (skip confirmation)
|
|
@@ -110,20 +146,26 @@ repo-cloak push --force
|
|
|
110
146
|
|
|
111
147
|
1. **Pull** creates a `.repo-cloak-map.json` file in the destination that stores:
|
|
112
148
|
- Original source path
|
|
113
|
-
- All keyword replacements
|
|
114
|
-
- File list with mappings
|
|
115
|
-
-
|
|
149
|
+
- All keyword replacements (encrypted with AES-256)
|
|
150
|
+
- File list with path mappings
|
|
151
|
+
- Pull history with timestamps
|
|
152
|
+
|
|
153
|
+
2. **Secret Scanner** runs automatically on all selected files before extraction, checking for API keys, tokens, credentials, private keys, and database connection strings.
|
|
154
|
+
|
|
155
|
+
3. **AGENTS.md** is auto-generated in the cloaked workspace to instruct AI agents about the partial, anonymized nature of the repository and guide their behavior.
|
|
116
156
|
|
|
117
|
-
|
|
157
|
+
4. **Push** reads the encrypted mapping file to:
|
|
118
158
|
- Reverse all keyword replacements
|
|
119
159
|
- Restore files to original or new location
|
|
120
160
|
|
|
121
161
|
## 🔒 Privacy by Design
|
|
122
162
|
|
|
123
163
|
- No data is sent to any external servers
|
|
124
|
-
- All processing happens locally
|
|
164
|
+
- All processing happens locally on your machine
|
|
165
|
+
- Mapping files are AES-256 encrypted with locally generated keys
|
|
125
166
|
- Binary files are copied without modification
|
|
126
167
|
- Hidden files and common ignored directories (node_modules, .git) are skipped
|
|
168
|
+
- Secret scanning catches embedded credentials before extraction
|
|
127
169
|
|
|
128
170
|
## 🤝 Contributing
|
|
129
171
|
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Slides for NotebookLM
|
|
2
|
+
|
|
3
|
+
Style: Apple minimalistic. White background, dark text, one accent color (blue), no shadows/gradients, rounded boxes, generous whitespace.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Slide 1: The Enterprise AI Dilemma
|
|
8
|
+
|
|
9
|
+
A large rounded box labeled "Enterprise Codebase". Inside it, four items in a grid: Business Logic, Internal Naming, Secrets & Credentials, Architecture Patterns. Label the box "Proprietary Code". Below it: "Cannot expose to external tools without controls" in muted red.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Slide 2: The Cloaked Workspace Flow
|
|
14
|
+
|
|
15
|
+
Vertical flow, five steps connected by arrows top to bottom:
|
|
16
|
+
|
|
17
|
+
1. Original Repository (inside "Enterprise Boundary" border)
|
|
18
|
+
2. Secret Detection (20+ categories)
|
|
19
|
+
3. Anonymization (Case-preserving)
|
|
20
|
+
4. Cloaked Workspace (Safe for AI tools)
|
|
21
|
+
5. Reverse Mapping (Decrypt + Merge)
|
|
22
|
+
Arrow from step 5 loops back to step 1: "Changes restored".
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Slide 3: Git-Aware File Selection
|
|
27
|
+
|
|
28
|
+
One box at top: "Git Repository Detected". Three boxes below side by side: "Uncommitted Changes", "Specific Commits", "Manual Selection". All three connect to one box at bottom: "Selected Files".
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Slide 4: Anonymization
|
|
33
|
+
|
|
34
|
+
Two columns. Left: "Original" showing xcorp-platform/ with XCorpServices/, XCorpPaymentService.cs, xcorp-settings.json. Right: "Cloaked" showing acme-platform/ with AcmeServices/, AcmePaymentService.cs, acme-settings.json. Arrow between columns. Monospaced file names.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Slide 5: Secret Scanner
|
|
39
|
+
|
|
40
|
+
Flow: "Selected Files" → "Secret Scanner (20+ patterns)" → five categories in a row (Cloud Keys, Platform Tokens, Payment Keys, Crypto Material, Infrastructure). Below: two outcomes side by side. Left: "HALT - Show file + line, require confirmation" (red). Right: "CLEAN - Proceed" (green).
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Slide 6: What Gets Selected vs. Skipped
|
|
45
|
+
|
|
46
|
+
Two-column list. Left (green checkmarks): IPaymentService.cs, IPaymentValidator.cs, PaymentRequest.cs, PaymentResponse.cs, PaymentForm.tsx, PaymentForm.test.tsx. Right (red crosses): PaymentService.cs (proprietary), PaymentGatewayAdapter.cs (proprietary), appsettings.json (credentials).
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Slide 7: Where Repo-Cloak Fits
|
|
51
|
+
|
|
52
|
+
Two stacked boxes. Top (gray): "Existing Controls" with Access Controls, Security Policies, Contracts. Bottom (blue tint): "Repo-Cloak Layer" with Scoped Exposure, Secret Detection, Encrypted Mappings, Audit Trail, Local Processing. Label between: "works alongside". Below both: "Controlled AI Adoption with Audit Trail".
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "repo-cloak-cli",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.4",
|
|
4
4
|
"description": "🎭 Selectively extract and anonymize files from repositories. Perfect for sharing code with AI agents without exposing proprietary details.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"node": ">=18.0.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
+
"@inquirer/checkbox": "^5.1.2",
|
|
41
42
|
"chalk": "^5.3.0",
|
|
42
43
|
"commander": "^12.1.0",
|
|
43
44
|
"figlet": "^1.7.0",
|
package/src/cli.js
CHANGED
|
@@ -32,6 +32,8 @@ program
|
|
|
32
32
|
.option('-s, --source <path>', 'Source directory (default: current directory)')
|
|
33
33
|
.option('-d, --dest <path>', 'Destination directory')
|
|
34
34
|
.option('-f, --force', 'Force pull all files (skip prompts, requires existing mapping)')
|
|
35
|
+
.option('-c, --commit <hash...>', 'Extract files changed in specific commits')
|
|
36
|
+
.option('-l, --list-commits [count]', 'List and select from recent commits (default: 10)')
|
|
35
37
|
.option('-q, --quiet', 'Minimal output')
|
|
36
38
|
.action(async (options) => {
|
|
37
39
|
await showBanner();
|