Skip to content

Commit 2ac85de

Browse files
committed
refactor: rename StreamHider to StreamGuard and update related configurations
- Updated extension name and display name from StreamHider to StreamGuard. - Changed configuration keys from streamHider.* to StreamGuard.* in settings and code. - Adjusted README, CHANGELOG, and package files to reflect the new extension name and versioning. - Modified comment parsing logic to use redaction terminology instead of hiding. - Updated tests to ensure functionality aligns with new naming conventions. Signed-off-by: Wiibleyde <nathan@bonnell.fr>
1 parent f7e4062 commit 2ac85de

17 files changed

Lines changed: 201 additions & 255 deletions

.github/copilot-instructions.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
# Copilot Instructions — StreamHider
1+
# Copilot Instructions — StreamGuard
22

33
## Project Overview
44

5-
StreamHider is a **VS Code extension** that visually hides sensitive code during live streams using the `TextEditorDecorationType` API. It never modifies source files — all hiding is purely decorative.
5+
StreamGuard is a **VS Code extension** that visually hides sensitive code during live streams using the `TextEditorDecorationType` API. It never modifies source files — all hiding is purely decorative.
66

77
## Architecture
88

99
The extension follows a layered architecture rooted in `src/`:
1010

1111
- **Entry point**: [src/extension.ts](src/extension.ts)`activate()` wires up the status bar, commands, config watchers, and document-change listeners; `deactivate()` disposes resources.
1212
- **Orchestrator**: [src/hide/hide-manager.ts](src/hide/hide-manager.ts)`refreshEditor()` is the core pipeline: read config → check file/folder glob patterns → parse comment annotations → apply decorations. All visible editors are refreshed on config change, document edit, or editor visibility change.
13-
- **Comment parser**: [src/hide/comment-parser.ts](src/hide/comment-parser.ts) — stateless function `parseHideComments(lines, languageId?)` returns `HiddenRange[]`. Supports `@stream-hide-next`, `@stream-hide-inline`, `@stream-hide-start`/`@stream-hide-end`.
13+
- **Comment parser**: [src/hide/comment-parser.ts](src/hide/comment-parser.ts) — stateless function `parseHideComments(lines, languageId?)` returns `RedactedRange[]`. Supports `@stream-hide-next`, `@stream-hide-inline`, `@stream-hide-start`/`@stream-hide-end`.
1414
- **Decoration provider**: [src/hide/decoration-provider.ts](src/hide/decoration-provider.ts) — manages `TextEditorDecorationType` instances keyed by replacement text. Uses `letterSpacing: "-1000em"` + transparent color to visually collapse text, with a `before` pseudo-element showing the placeholder.
1515
- **Pattern matcher**: [src/hide/pattern-matcher.ts](src/hide/pattern-matcher.ts) — minimal glob-to-regex converter (no external deps). Normalizes backslashes and tests both full path and basename.
16-
- **Language config**: [src/languages/language-config.ts](src/languages/language-config.ts) — built-in comment-syntax registry for 20+ languages. Users can override via `streamHider.languageCommentPrefixes`. Unknown languages fall back to `["//", "#", "--"]`.
16+
- **Language config**: [src/languages/language-config.ts](src/languages/language-config.ts) — built-in comment-syntax registry for 20+ languages. Users can override via `StreamGuard.languageCommentPrefixes`. Unknown languages fall back to `["//", "#", "--"]`.
1717
- **Config**: [src/config/](src/config/)`readConfig()` reads from VS Code workspace settings; `watchConfig()` listens for `onDidChangeConfiguration`.
1818

1919
## Data Flow

.vscode/settings.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
2-
"streamHider.hiddenFolders": [
3-
"**/config/**",
4-
]
2+
"streamGuard.redactedFolders": [
3+
"**/config/**"
4+
],
5+
"streamGuard.enabled": false
56
}

CHANGELOG.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# Changelog
22

3-
All notable changes to the **StreamHider** extension will be documented in this file.
3+
All notable changes to the **StreamGuard** extension will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/), and this project adheres to [Semantic Versioning](https://semver.org/).
66

77
## [1.0.0] — 2026-02-22
88

99
### Added
1010

11-
- **Stream mode toggle**`StreamHider: Toggle Stream Mode` command and status bar button.
11+
- **Stream mode toggle**`StreamGuard: Toggle Stream Mode` command and status bar button.
1212
- **Comment-based hiding**`@stream-hide-next`, `@stream-hide-inline`, `@stream-hide-start` / `@stream-hide-end` annotations.
13-
- **File/folder pattern hiding** — glob-based whole-file hiding via `streamHider.hiddenFilePatterns` and `streamHider.hiddenFolders`.
14-
- **Custom language comment prefixes** — override comment syntax per language ID via `streamHider.languageCommentPrefixes`.
13+
- **File/folder pattern hiding** — glob-based whole-file hiding via `StreamGuard.redactedFilePatterns` and `StreamGuard.redactedFolders`.
14+
- **Custom language comment prefixes** — override comment syntax per language ID via `StreamGuard.languageCommentPrefixes`.
1515
- **Built-in language support** — 20+ languages with pre-configured comment syntax.
1616
- **Real-time updates** — decorations refresh instantly on every document change or config change.

README.md

Lines changed: 17 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# StreamHider — VSCode Extension
2-
3-
![CI](https://github.com/Wiibleyde/stream-utils/actions/workflows/ci.yml/badge.svg)
1+
# StreamGuard — VSCode Extension
42

53
Visually **redact** parts of your code during live streams (Twitch, YouTube, etc.) without ever modifying the actual source files.
64

@@ -14,19 +12,19 @@ All redacting is done via the VSCode `TextEditorDecorationType` API — purely v
1412

1513
1. Open VS Code.
1614
2. Press `Ctrl+P` (or `Cmd+P` on macOS) to open the Quick Open bar.
17-
3. Type `ext install NathanBonnell.stream-hider` and press `Enter`.
15+
3. Type `ext install NathanBonnell.stream-guard` and press `Enter`.
1816
4. Click **Install**.
1917

20-
Or open the Extensions view (`Ctrl+Shift+X`), search for **StreamHider**, and click **Install**.
18+
Or open the Extensions view (`Ctrl+Shift+X`), search for **StreamGuard**, and click **Install**.
2119

2220
---
2321

2422
### Option 2 — Install from a `.vsix` file
2523

26-
Download the latest `.vsix` from the [GitHub Releases page](https://github.com/Wiibleyde/stream-utils/releases), then:
24+
Download the latest `.vsix` from the releases, then:
2725

2826
```bash
29-
code --install-extension stream-hider-<version>.vsix
27+
code --install-extension stream-guard-<version>.vsix
3028
```
3129

3230
Or inside VS Code:
@@ -41,7 +39,7 @@ Or inside VS Code:
4139

4240
```bash
4341
# 1. Clone the repository
44-
git clone https://github.com/Wiibleyde/stream-utils.git
42+
git clone <your-repo-url>
4543
cd stream-utils
4644

4745
# 2. Install dependencies
@@ -55,7 +53,7 @@ npm install -g @vscode/vsce
5553
vsce package --no-dependencies
5654

5755
# 5. Install the generated .vsix
58-
code --install-extension stream-hider-*.vsix
56+
code --install-extension stream-guard-*.vsix
5957
```
6058

6159
---
@@ -65,7 +63,7 @@ code --install-extension stream-hider-*.vsix
6563
- **File/folder redacting** — glob-pattern-based full-file redacting via workspace settings
6664
- **Inline comment redacting** — annotate individual lines or blocks with special comments
6765
- **Status bar indicator** — always know whether stream mode is active
68-
- **Toggle command** — quickly enable/disable with `StreamHider: Toggle Stream Mode`
66+
- **Toggle command** — quickly enable/disable with `StreamGuard: Toggle Stream Mode`
6967
- **Real-time updates** — decorations refresh instantly on every document change or config change
7068

7169
---
@@ -100,26 +98,26 @@ const port = 3000;
10098

10199
```json
102100
{
103-
"streamHider.enabled": true,
104-
"streamHider.hiddenFilePatterns": ["**/.env", "**/config.local.*"],
105-
"streamHider.hiddenFolders": ["**/private/**"]
101+
"StreamGuard.enabled": true,
102+
"StreamGuard.redactedFilePatterns": ["**/.env", "**/config.local.*"],
103+
"StreamGuard.redactedFolders": ["**/private/**"]
106104
}
107105
```
108106

109107
| Setting | Type | Default | Description |
110108
|---|---|---|---|
111-
| `streamHider.enabled` | `boolean` | `false` | Toggle the extension globally |
112-
| `streamHider.hiddenFilePatterns` | `string[]` | `[]` | Glob patterns — files matching these have their entire content redacted |
113-
| `streamHider.hiddenFolders` | `string[]` | `[]` | Glob patterns — files inside matching folders are fully redacted |
114-
| `streamHider.languageCommentPrefixes` | `object` | `{}` | Custom comment prefixes per language ID (e.g. `{ "lua": ["--"] }`) |
109+
| `StreamGuard.enabled` | `boolean` | `false` | Toggle the extension globally |
110+
| `StreamGuard.redactedFilePatterns` | `string[]` | `[]` | Glob patterns — files matching these have their entire content redacted |
111+
| `StreamGuard.redactedFolders` | `string[]` | `[]` | Glob patterns — files inside matching folders are fully redacted |
112+
| `StreamGuard.languageCommentPrefixes` | `object` | `{}` | Custom comment prefixes per language ID (e.g. `{ "lua": ["--"] }`) |
115113

116114
---
117115

118116
## Commands
119117

120118
| Command | Description |
121119
|---|---|
122-
| `StreamHider: Toggle Stream Mode` | Enables or disables stream redacting |
120+
| `StreamGuard: Toggle Stream Mode` | Enables or disables stream redacting |
123121

124122
---
125123

@@ -148,53 +146,8 @@ src/
148146
│ ├── hide-manager.ts # Main orchestrator
149147
│ └── pattern-matcher.ts # Glob pattern matching for files/folders
150148
├── config/
151-
│ ├── workspace-config.ts # Read streamHider config from workspace
149+
│ ├── workspace-config.ts # Read StreamGuard config from workspace
152150
│ └── config-watcher.ts # React to config changes
153151
└── utils/
154152
└── logger.ts # Internal logger using OutputChannel
155153
```
156-
157-
---
158-
159-
## CI/CD
160-
161-
The repository uses **GitHub Actions** for continuous integration and automated releases.
162-
163-
### Continuous Integration (`ci.yml`)
164-
165-
Triggered on every **push** and **pull request** targeting `main`.
166-
167-
| Step | Command |
168-
|---|---|
169-
| Install dependencies | `npm ci` |
170-
| Lint | `npm run lint` |
171-
| Compile | `npm run compile` |
172-
| Unit tests | `npm test` |
173-
174-
### Release (`release.yml`)
175-
176-
Triggered automatically when a tag matching `v*.*.*` is pushed.
177-
178-
```bash
179-
# Create and push a new version tag to trigger a release
180-
git tag v1.0.0
181-
git push origin v1.0.0
182-
```
183-
184-
| Step | Description |
185-
|---|---|
186-
| Lint + Compile + Test | Same checks as CI |
187-
| `vsce package` | Produces a `.vsix` file |
188-
| Upload artifact | `.vsix` is attached to the GitHub Actions run |
189-
| Publish to Marketplace | Runs when the `VSCE_PAT` secret is configured |
190-
| GitHub Release | Creates a release with the `.vsix` attached and auto-generated notes |
191-
192-
#### Required secret
193-
194-
To enable automatic publishing to the Visual Studio Marketplace, add the following secret in **Settings → Secrets and variables → Actions**:
195-
196-
| Secret name | Value |
197-
|---|---|
198-
| `VSCE_PAT` | Your [Personal Access Token](https://code.visualstudio.com/api/working-with-extensions/publishing-extension#get-a-personal-access-token) from Azure DevOps |
199-
200-
> If `VSCE_PAT` is not set, the workflow still runs, packages the `.vsix`, and creates a GitHub Release — the Marketplace publish step is simply skipped.

package-lock.json

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
11
{
2-
"name": "stream-hider",
3-
"displayName": "StreamHider",
2+
"name": "stream-guard",
3+
"displayName": "StreamGuard",
44
"description": "Visually redact code during live streams — no file modifications",
5-
"version": "1.0.2",
5+
"version": "1.1.0",
66
"publisher": "NathanBonnell",
77
"license": "MIT",
88
"icon": "icon.png",
9-
"repository": {
10-
"type": "git",
11-
"url": "https://github.com/Wiibleyde/stream-utils.git"
12-
},
13-
"homepage": "https://github.com/Wiibleyde/stream-utils#readme",
14-
"bugs": {
15-
"url": "https://github.com/Wiibleyde/stream-utils/issues"
16-
},
179
"qna": "marketplace",
1810
"engines": {
1911
"vscode": "^1.85.0"
@@ -35,35 +27,35 @@
3527
"contributes": {
3628
"commands": [
3729
{
38-
"command": "streamHider.toggle",
39-
"title": "StreamHider: Toggle Stream Mode"
30+
"command": "streamGuard.toggle",
31+
"title": "StreamGuard: Toggle Stream Mode"
4032
}
4133
],
4234
"configuration": {
43-
"title": "StreamHider",
35+
"title": "StreamGuard",
4436
"properties": {
45-
"streamHider.enabled": {
37+
"streamGuard.enabled": {
4638
"type": "boolean",
4739
"default": false,
48-
"description": "Enable or disable StreamHider globally"
40+
"description": "Enable or disable StreamGuard globally"
4941
},
50-
"streamHider.hiddenFilePatterns": {
42+
"streamGuard.redactedFilePatterns": {
5143
"type": "array",
5244
"items": {
5345
"type": "string"
5446
},
5547
"default": [],
56-
"description": "Glob patterns of files whose content should be hidden"
48+
"description": "Glob patterns of files whose content should be redacted"
5749
},
58-
"streamHider.hiddenFolders": {
50+
"streamGuard.redactedFolders": {
5951
"type": "array",
6052
"items": {
6153
"type": "string"
6254
},
6355
"default": [],
64-
"description": "Folder glob patterns to hide in explorer and editor"
56+
"description": "Folder glob patterns to redact in explorer and editor"
6557
},
66-
"streamHider.languageCommentPrefixes": {
58+
"streamGuard.languageCommentPrefixes": {
6759
"type": "object",
6860
"default": {},
6961
"description": "Custom comment prefixes per language ID. Maps a VSCode language ID to an array of single-line comment prefixes. Example: { \"lua\": [\"--\"], \"python\": [\"#\"] }",

src/config/config-watcher.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { logInfo } from "../utils/logger";
77
*/
88
export function watchConfig(onChange: () => void): vscode.Disposable {
99
return vscode.workspace.onDidChangeConfiguration((event) => {
10-
if (event.affectsConfiguration("streamHider")) {
10+
if (event.affectsConfiguration("streamGuard")) {
1111
logInfo("Configuration changed — refreshing decorations.");
1212
onChange();
1313
}

src/config/workspace-config.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
import * as vscode from "vscode";
22
import { CONFIG_KEYS, LANGUAGE_CONFIG_KEY } from "../constants";
33
import { applyCustomPrefixes } from "../languages/language-config";
4-
import type { StreamHiderConfig } from "../types";
4+
import type { StreamGuardConfig } from "../types";
55

66
/**
7-
* Reads the StreamHider configuration from the current workspace settings.
7+
* Reads the StreamGuard configuration from the current workspace settings.
88
*/
9-
export function readConfig(): StreamHiderConfig {
9+
export function readConfig(): StreamGuardConfig {
1010
const cfg = vscode.workspace.getConfiguration();
1111

1212
const enabled = cfg.get<boolean>(CONFIG_KEYS.ENABLED) ?? false;
13-
const hiddenFilePatterns = cfg.get<string[]>(CONFIG_KEYS.HIDDEN_FILE_PATTERNS) ?? [];
14-
const hiddenFolders = cfg.get<string[]>(CONFIG_KEYS.HIDDEN_FOLDERS) ?? [];
13+
const redactedFilePatterns = cfg.get<string[]>(CONFIG_KEYS.REDACTED_FILE_PATTERNS) ?? [];
14+
const redactedFolders = cfg.get<string[]>(CONFIG_KEYS.REDACTED_FOLDERS) ?? [];
1515

1616
// Apply user-defined language comment prefixes (if any)
1717
const customPrefixes = cfg.get<Record<string, string[]>>(LANGUAGE_CONFIG_KEY) ?? {};
1818
if (Object.keys(customPrefixes).length > 0) {
1919
applyCustomPrefixes(customPrefixes);
2020
}
2121

22-
return { enabled, hiddenFilePatterns, hiddenFolders };
22+
return { enabled, redactedFilePatterns, redactedFolders };
2323
}

src/constants.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
/**
2-
* Command identifiers registered by the StreamHider extension.
2+
* Command identifiers registered by the StreamGuard extension.
33
*/
44
export const COMMANDS = {
5-
TOGGLE: "streamHider.toggle",
5+
TOGGLE: "streamGuard.toggle",
66
} as const;
77

88
/**
9-
* Configuration keys used in .vscode/settings.json under the "streamHider" namespace.
9+
* Configuration keys used in .vscode/settings.json under the "streamGuard" namespace.
1010
*/
1111
export const CONFIG_KEYS = {
12-
ENABLED: "streamHider.enabled",
13-
HIDDEN_FILE_PATTERNS: "streamHider.hiddenFilePatterns",
14-
HIDDEN_FOLDERS: "streamHider.hiddenFolders",
12+
ENABLED: "streamGuard.enabled",
13+
REDACTED_FILE_PATTERNS: "streamGuard.redactedFilePatterns",
14+
REDACTED_FOLDERS: "streamGuard.redactedFolders",
1515
} as const;
1616

1717
/**
18-
* Comment tokens used to trigger inline hiding behaviour.
18+
* Comment tokens used to trigger inline redaction behaviour.
1919
*/
2020
export const COMMENT_TOKENS = {
2121
HIDE_NEXT: "@stream-hide-next",
@@ -27,9 +27,9 @@ export const COMMENT_TOKENS = {
2727
/**
2828
* Configuration key for user-defined language comment prefixes.
2929
*/
30-
export const LANGUAGE_CONFIG_KEY = "streamHider.languageCommentPrefixes";
30+
export const LANGUAGE_CONFIG_KEY = "streamGuard.languageCommentPrefixes";
3131

3232
/**
3333
* Name of the VSCode OutputChannel used for extension logging.
3434
*/
35-
export const OUTPUT_CHANNEL_NAME = "StreamHider";
35+
export const OUTPUT_CHANNEL_NAME = "StreamGuard";

src/extension.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ function updateStatusBar(): void {
2222

2323
const { enabled } = readConfig();
2424
statusBarItem.text = enabled ? "$(eye-closed) Stream Mode ON" : "$(eye) Stream Mode OFF";
25-
statusBarItem.tooltip = "Click to toggle StreamHider";
25+
statusBarItem.tooltip = "Click to toggle StreamGuard";
2626
statusBarItem.backgroundColor = enabled ? new vscode.ThemeColor("statusBarItem.warningBackground") : undefined;
2727
}
2828

2929
export function activate(context: vscode.ExtensionContext): void {
30-
logInfo("StreamHider activating.");
30+
logInfo("StreamGuard activating.");
3131

3232
// Eagerly create the decoration type so it's ready before any editor opens
3333
initDecorations();
@@ -121,7 +121,7 @@ export function activate(context: vscode.ExtensionContext): void {
121121
// Initial decoration pass
122122
refreshAllEditors();
123123

124-
logInfo("StreamHider activated.");
124+
logInfo("StreamGuard activated.");
125125
}
126126

127127
export function deactivate(): void {

0 commit comments

Comments
 (0)