twskin 0.5.3

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.
Files changed (65) hide show
  1. package/CHANGELOG.md +99 -0
  2. package/CONTRIBUTING.md +37 -0
  3. package/LICENSE +21 -0
  4. package/README.md +104 -0
  5. package/SECURITY.md +28 -0
  6. package/dist/bin/twskin.d.ts +3 -0
  7. package/dist/bin/twskin.d.ts.map +1 -0
  8. package/dist/bin/twskin.js +4 -0
  9. package/dist/bin/twskin.js.map +1 -0
  10. package/dist/commands.d.ts +41 -0
  11. package/dist/commands.d.ts.map +1 -0
  12. package/dist/commands.js +421 -0
  13. package/dist/commands.js.map +1 -0
  14. package/dist/context.d.ts +14 -0
  15. package/dist/context.d.ts.map +1 -0
  16. package/dist/context.js +51 -0
  17. package/dist/context.js.map +1 -0
  18. package/dist/errors.d.ts +9 -0
  19. package/dist/errors.d.ts.map +1 -0
  20. package/dist/errors.js +20 -0
  21. package/dist/errors.js.map +1 -0
  22. package/dist/lock.d.ts +3 -0
  23. package/dist/lock.d.ts.map +1 -0
  24. package/dist/lock.js +52 -0
  25. package/dist/lock.js.map +1 -0
  26. package/dist/main.d.ts +9 -0
  27. package/dist/main.d.ts.map +1 -0
  28. package/dist/main.js +92 -0
  29. package/dist/main.js.map +1 -0
  30. package/dist/output.d.ts +4 -0
  31. package/dist/output.d.ts.map +1 -0
  32. package/dist/output.js +27 -0
  33. package/dist/output.js.map +1 -0
  34. package/dist/persistent-cdp.d.ts +14 -0
  35. package/dist/persistent-cdp.d.ts.map +1 -0
  36. package/dist/persistent-cdp.js +140 -0
  37. package/dist/persistent-cdp.js.map +1 -0
  38. package/dist/system.d.ts +64 -0
  39. package/dist/system.d.ts.map +1 -0
  40. package/dist/system.js +234 -0
  41. package/dist/system.js.map +1 -0
  42. package/dist/theme-download.d.ts +9 -0
  43. package/dist/theme-download.d.ts.map +1 -0
  44. package/dist/theme-download.js +250 -0
  45. package/dist/theme-download.js.map +1 -0
  46. package/dist/themes.d.ts +9 -0
  47. package/dist/themes.d.ts.map +1 -0
  48. package/dist/themes.js +185 -0
  49. package/dist/themes.js.map +1 -0
  50. package/dist/types.d.ts +58 -0
  51. package/dist/types.d.ts.map +1 -0
  52. package/dist/types.js +2 -0
  53. package/dist/types.js.map +1 -0
  54. package/docs/publishing.md +45 -0
  55. package/docs/theme-distribution.md +62 -0
  56. package/package.json +74 -0
  57. package/runtime/component-map.mjs +200 -0
  58. package/runtime/injector.mjs +705 -0
  59. package/runtime/manifest.json +47 -0
  60. package/runtime/restore.sh +33 -0
  61. package/runtime/skin.js +1133 -0
  62. package/runtime/start.sh +86 -0
  63. package/runtime/styles/base.css +687 -0
  64. package/runtime/styles/manager.css +346 -0
  65. package/runtime/token-map.mjs +432 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,99 @@
1
+ # Changelog
2
+
3
+ All notable changes to this package are documented here. This project follows
4
+ [Semantic Versioning](https://semver.org/).
5
+
6
+ ## [Unreleased]
7
+
8
+ ## [0.5.3] - 2026-07-26
9
+
10
+ ### Added
11
+
12
+ - `twskin stop` now stops the watcher and restores TRAE's native appearance
13
+ without quitting TRAE, while preserving the selected theme and its settings.
14
+ - The selected theme is reapplied automatically after TRAE restarts while the
15
+ watcher remains active.
16
+
17
+ ### Changed
18
+
19
+ - The watcher now remains available while TRAE is closed and reconnects on a later
20
+ launch.
21
+ - JSONC comments, unrelated settings and any existing `remote-debugging-port`
22
+ value are preserved when enabling automatic reconnection, then restored on
23
+ stop, restore or uninstall.
24
+
25
+ ### Removed
26
+
27
+ - The misspelled `twskin unisntall` compatibility alias is no longer accepted.
28
+
29
+ ### Fixed
30
+
31
+ - The restore control now returns from `取消 / 确认恢复` to `恢复默认` after the
32
+ user confirms restoration.
33
+ - Publish the CLI under its internal registry name, `@byted-relic/twskin`.
34
+
35
+ ## [0.5.2] - 2026-07-24
36
+
37
+ ### Changed
38
+
39
+ - Ask users to save their work and confirm before `twskin start` restarts a
40
+ running TRAE process to enable CDP. Non-interactive callers must pass `--yes`.
41
+
42
+ ## [0.5.1] - 2026-07-24
43
+
44
+ ### Changed
45
+
46
+ - Download the latest fixed-name theme assets directly from GitHub Release
47
+ redirects instead of consuming anonymous GitHub API quota.
48
+
49
+ ## [0.5.0] - 2026-07-24
50
+
51
+ ### Added
52
+
53
+ - `twskin theme download [id]` for verified official GitHub Release theme packs.
54
+ - `twskin theme load <directory>` for atomic local theme installation.
55
+ - Independent, checksummed theme-pack build and Release upload automation.
56
+ - Per-theme background brightness and main-workspace overlay controls in Theme
57
+ Manager, with values persisted in each theme's settings.
58
+ - A V3 bridge for VS Code core color variables so IM Channel and legacy
59
+ workbench surfaces follow the active theme palette.
60
+
61
+ ### Changed
62
+
63
+ - Renamed the unpublished package and command to `twskin`; the default data
64
+ directory is now `~/.trae-work-skin` and public environment variables use the
65
+ `TWSKIN_` prefix.
66
+ - Rebuilt the command layer in strict TypeScript and moved the executable to the
67
+ compiled `dist/` entrypoint.
68
+ - Adopted Clack for first-start confirmation, download progress, cancellation,
69
+ and completion guidance while preserving clean `--json` output.
70
+ - Standardized installation on the npm CLI and its external theme download
71
+ flow.
72
+ - Consolidated the injection engine into the tracked `runtime/` directory;
73
+ manifest generation no longer copies a second runtime tree.
74
+ - Split shared and Theme Manager CSS out of `skin.js`, and moved EVA/Xianzhou
75
+ component styling into each theme's dynamically loaded `theme.css`.
76
+ - Resolve runtime, data and theme paths consistently from
77
+ `~/.trae-work-skin`, including global and internal-registry installations.
78
+ - Theme Manager configuration now exposes only controls supported by the
79
+ selected theme.
80
+
81
+ ### Fixed
82
+
83
+ - Allow authenticated GitHub Release downloads when anonymous API quota is
84
+ unavailable, without forwarding credentials to configured mirrors.
85
+ - Clear stale theme artwork variables when switching between themes.
86
+ - Keep the generated runtime manifest limited to the canonical payload files.
87
+ - Restore and startup scripts now use the same data directory as the CLI.
88
+
89
+ ## [0.4.0] - 2026-07-22
90
+
91
+ ### Added
92
+
93
+ - First npm-ready `twskin` CLI package.
94
+ - Commands for start, status, themes, theme selection, doctor, restore,
95
+ uninstall, version and help.
96
+ - External theme-directory loading with `TWSKIN_THEMES_DIR` support.
97
+ - Integrity-manifested injection runtime with no bundled theme assets.
98
+ - Structured JSON output for status, themes and doctor.
99
+ - Concurrency lock and stale-lock recovery for mutating commands.
@@ -0,0 +1,37 @@
1
+ # Contributing
2
+
3
+ Thank you for improving TRAE Work Skin.
4
+
5
+ ## Development setup
6
+
7
+ Use a supported Node.js LTS release (22 or 24):
8
+
9
+ ```bash
10
+ cd packages/cli
11
+ npm run prepare:runtime
12
+ npm run check
13
+ npm test
14
+ ```
15
+
16
+ Before opening a pull request, also inspect the exact npm payload:
17
+
18
+ ```bash
19
+ npm pack --dry-run
20
+ ```
21
+
22
+ ## Pull requests
23
+
24
+ - Keep CLI behavior backward compatible unless the change is explicitly marked
25
+ as breaking.
26
+ - Add tests for successful behavior and failure atomicity.
27
+ - Do not add network downloads without integrity verification and rollback.
28
+ - Do not add runtime dependencies without explaining the security and package
29
+ size trade-off.
30
+ - Never include source artwork, credentials, local state or CDP logs in the npm
31
+ tarball.
32
+
33
+ ## Releases
34
+
35
+ Versions follow Semantic Versioning. Publishing is performed from CI with npm
36
+ trusted publishing/provenance; maintainers should not publish ad hoc local
37
+ tarballs to the public registry.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Fullstop000
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,104 @@
1
+ # TRAE Work Skin CLI
2
+
3
+ `twskin` provides the `twskin` command for installing, diagnosing,
4
+ switching and restoring local themes in TRAE Work on macOS.
5
+
6
+ > **Unofficial:** TRAE Work Skin is an unofficial community theme manager for TRAE
7
+ > Work. It is not affiliated with, endorsed by, or sponsored by TRAE or
8
+ > ByteDance.
9
+
10
+ ## Requirements
11
+
12
+ - macOS
13
+ - Node.js 22 or newer
14
+ - TRAE Work CN installed locally
15
+
16
+ ## Install
17
+
18
+ ```bash
19
+ npm install --global twskin
20
+ twskin start
21
+ ```
22
+
23
+ The command layer is written in strict TypeScript and uses Clack for interactive
24
+ prompts and progress feedback. It only connects to the local TRAE process
25
+ through CDP on `127.0.0.1`; it does not modify the TRAE application bundle or
26
+ its code signature.
27
+
28
+ On first start, an empty theme directory prompts before downloading from the
29
+ latest official GitHub Release. Use `twskin start --yes` for explicit consent in
30
+ automation. If TRAE is already running without CDP, the CLI asks the user to
31
+ save their work and confirm before restarting it; `--yes` also explicitly
32
+ confirms that restart. After a successful start, the CLI persists the loopback
33
+ CDP port in TRAE's user-level `argv.json`. While the watcher remains active,
34
+ quitting and reopening TRAE automatically reconnects and reapplies the selected
35
+ theme. Later starts use the local themes without downloading.
36
+
37
+ ## Commands
38
+
39
+ ```text
40
+ twskin start [--yes] Initialize and start Theme Manager and its watcher
41
+ twskin stop Stop Skin and restore native appearance without quitting TRAE
42
+ twskin status [--json] Show App, CDP, watcher and active-theme status
43
+ twskin themes [--json] List locally installed themes
44
+ twskin theme <id> Select a theme
45
+ twskin theme download [id] Download all or one theme from the latest GitHub Release
46
+ twskin theme load <directory> Install one theme, or immediate child theme directories
47
+ twskin doctor [--json] Validate Node, TRAE, port and package integrity
48
+ twskin restore Restore the native TRAE appearance
49
+ twskin uninstall [--yes] Restore TRAE and remove TRAE Work Skin data
50
+ twskin version Print the CLI version
51
+ twskin help Print command help
52
+ ```
53
+
54
+ `twskin theme <id>` applies immediately while Theme Manager is active. Otherwise
55
+ the selection is saved and applied by the next `twskin start`. `twskin stop`
56
+ preserves the selected theme and its settings, so a later `twskin start` can
57
+ restore them. It also restores the pre-existing `remote-debugging-port` value
58
+ instead of leaving twskin's persistent CDP configuration behind.
59
+
60
+ ## Theme directory
61
+
62
+ The CLI package does not contain themes. It loads them from:
63
+
64
+ ```text
65
+ ~/.trae-work-skin/themes
66
+ ```
67
+
68
+ Set `TWSKIN_THEMES_DIR` to use another absolute directory.
69
+
70
+ In a source checkout, the default is the repository's top-level `themes/`
71
+ directory. `theme load` copies only the canonical theme payload and installs it
72
+ atomically. `theme download` reads the latest official GitHub Release, verifies
73
+ the attached SHA-256 file and archive structure, then installs into the same
74
+ directory. See
75
+ [docs/theme-distribution.md](docs/theme-distribution.md).
76
+
77
+ The canonical payload may include `theme.css` for theme-specific component
78
+ styling and motion. The injector replaces this stylesheet atomically whenever
79
+ the active theme changes; declarative colors and component roles remain in
80
+ `theme.json`.
81
+
82
+ ## Development
83
+
84
+ ```bash
85
+ cd packages/cli
86
+ npm install
87
+ npm run prepare:runtime
88
+ npm run check
89
+ npm test
90
+ npm pack --dry-run
91
+ ```
92
+
93
+ TypeScript compiles to `dist/`. The tracked `runtime/` directory is the single
94
+ source of truth for the injection engine; `prepare:runtime` only generates its
95
+ SHA-256 manifest. npm publishes both outputs, while themes remain external.
96
+
97
+ ## Security
98
+
99
+ Please read [SECURITY.md](SECURITY.md). Do not report vulnerabilities in public
100
+ issues before a fix is available.
101
+
102
+ ## License
103
+
104
+ MIT © Fullstop000
package/SECURITY.md ADDED
@@ -0,0 +1,28 @@
1
+ # Security Policy
2
+
3
+ ## Supported versions
4
+
5
+ Security fixes are provided for the latest minor release.
6
+
7
+ ## Reporting a vulnerability
8
+
9
+ Please use GitHub's private vulnerability reporting for this repository. Include
10
+ the affected version, macOS and TRAE versions, reproduction steps and expected
11
+ impact. Do not include access tokens, personal data or unrelated application
12
+ content.
13
+
14
+ ## Security boundaries
15
+
16
+ - CDP binds to `127.0.0.1` only.
17
+ - The CLI verifies that the configured CDP port belongs to TRAE before using it.
18
+ - The CLI changes only `remote-debugging-port` in TRAE's user-level `argv.json`,
19
+ preserves JSONC comments and unrelated settings, and restores the previous
20
+ value on stop, restore or uninstall.
21
+ - The TRAE application bundle and code signature are never modified.
22
+ - Packaged engine files are covered by a SHA-256 manifest checked by
23
+ `twskin doctor`.
24
+ - Themes are loaded from a user-controlled data directory, never `node_modules`.
25
+ - Remote theme packs are size-limited, SHA-256 verified, checked for unsafe tar
26
+ paths and link/special-file entries, then installed atomically outside the npm
27
+ package directory.
28
+ - Local theme loading rejects symlinks and copies only canonical theme assets.
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=twskin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"twskin.d.ts","sourceRoot":"","sources":["../../src/bin/twskin.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import { run } from "../main.js";
3
+ await run();
4
+ //# sourceMappingURL=twskin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"twskin.js","sourceRoot":"","sources":["../../src/bin/twskin.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEjC,MAAM,GAAG,EAAE,CAAC"}
@@ -0,0 +1,41 @@
1
+ import type { CliContext, CliOptions } from "./types.js";
2
+ export declare function helpText(context: CliContext): string;
3
+ export declare function getStatus(context: CliContext): Promise<{
4
+ app: {
5
+ installed: boolean;
6
+ running: boolean;
7
+ bundle: string;
8
+ };
9
+ cdp: {
10
+ reachable: boolean;
11
+ port: number;
12
+ browser: string | null;
13
+ owner: {
14
+ pid: number;
15
+ command: string;
16
+ expected: boolean;
17
+ } | null;
18
+ };
19
+ watcher: {
20
+ pid: number | null;
21
+ running: boolean;
22
+ pidAlive: boolean;
23
+ };
24
+ theme: {
25
+ id: string;
26
+ valid: boolean;
27
+ };
28
+ version: string;
29
+ distribution: string;
30
+ }>;
31
+ export declare function startCommand(context: CliContext, options: CliOptions): Promise<void>;
32
+ export declare function statusCommand(context: CliContext, options: CliOptions): Promise<void>;
33
+ export declare function stopCommand(context: CliContext, options: CliOptions): Promise<void>;
34
+ export declare function themesCommand(context: CliContext, options: CliOptions): void;
35
+ export declare function themeCommand(context: CliContext, id: string | undefined, options: CliOptions): Promise<void>;
36
+ export declare function loadThemeCommand(context: CliContext, sourceDirectory: string | undefined, options: CliOptions): Promise<void>;
37
+ export declare function downloadThemeCommand(context: CliContext, id: string | undefined, options: CliOptions): Promise<void>;
38
+ export declare function doctorCommand(context: CliContext, options: CliOptions): Promise<void>;
39
+ export declare function restoreCommand(context: CliContext, options: CliOptions): Promise<void>;
40
+ export declare function uninstallCommand(context: CliContext, options: CliOptions): Promise<void>;
41
+ //# sourceMappingURL=commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AA0CzD,wBAAgB,QAAQ,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,CAiBpD;AAED,wBAAsB,SAAS,CAAC,OAAO,EAAE,UAAU;;QAQxC,SAAS;QAA4B,OAAO;QAAkC,MAAM;;;;;;;;;;;;;QAOhF,GAAG;QAAe,OAAO;QAAqC,QAAQ;;;QACxE,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