claude-code-extensions 0.1.0 → 0.1.2

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 (115) hide show
  1. package/dist/ast.d.ts +43 -0
  2. package/dist/ast.js +308 -0
  3. package/dist/ast.js.map +1 -0
  4. package/dist/cli-list.d.ts +5 -0
  5. package/dist/cli-list.js +33 -0
  6. package/dist/cli-list.js.map +1 -0
  7. package/dist/cli-reload.d.ts +7 -0
  8. package/dist/cli-reload.js +24 -0
  9. package/dist/cli-reload.js.map +1 -0
  10. package/dist/cli-setup.d.ts +14 -0
  11. package/dist/cli-setup.js +110 -0
  12. package/dist/cli-setup.js.map +1 -0
  13. package/dist/cli.d.ts +14 -0
  14. package/dist/cli.js +183 -0
  15. package/dist/cli.js.map +1 -0
  16. package/dist/patch-worker.d.ts +6 -0
  17. package/dist/patch-worker.js +27 -0
  18. package/dist/patch-worker.js.map +1 -0
  19. package/dist/patches/always-show-context.d.ts +23 -0
  20. package/dist/patches/always-show-context.js +97 -0
  21. package/dist/patches/always-show-context.js.map +1 -0
  22. package/dist/patches/always-show-thinking.d.ts +18 -0
  23. package/dist/patches/always-show-thinking.js +55 -0
  24. package/dist/patches/always-show-thinking.js.map +1 -0
  25. package/dist/patches/banner.d.ts +10 -0
  26. package/dist/patches/banner.js +105 -0
  27. package/dist/patches/banner.js.map +1 -0
  28. package/dist/patches/cd-command.d.ts +16 -0
  29. package/dist/patches/cd-command.js +89 -0
  30. package/dist/patches/cd-command.js.map +1 -0
  31. package/dist/patches/cx-badge.d.ts +10 -0
  32. package/dist/patches/cx-badge.js +115 -0
  33. package/dist/patches/cx-badge.js.map +1 -0
  34. package/dist/patches/cx-resume-commands.d.ts +14 -0
  35. package/dist/patches/cx-resume-commands.js +53 -0
  36. package/dist/patches/cx-resume-commands.js.map +1 -0
  37. package/dist/patches/disable-paste-collapse.d.ts +16 -0
  38. package/dist/patches/disable-paste-collapse.js +49 -0
  39. package/dist/patches/disable-paste-collapse.js.map +1 -0
  40. package/dist/patches/disable-telemetry.d.ts +13 -0
  41. package/dist/patches/disable-telemetry.js +76 -0
  42. package/dist/patches/disable-telemetry.js.map +1 -0
  43. package/{patches/index.js → dist/patches/index.d.ts} +2 -0
  44. package/dist/patches/index.js +20 -0
  45. package/dist/patches/index.js.map +1 -0
  46. package/dist/patches/no-attribution.d.ts +15 -0
  47. package/dist/patches/no-attribution.js +42 -0
  48. package/dist/patches/no-attribution.js.map +1 -0
  49. package/dist/patches/no-feedback.d.ts +12 -0
  50. package/dist/patches/no-feedback.js +31 -0
  51. package/dist/patches/no-feedback.js.map +1 -0
  52. package/dist/patches/no-npm-warning.d.ts +9 -0
  53. package/dist/patches/no-npm-warning.js +31 -0
  54. package/dist/patches/no-npm-warning.js.map +1 -0
  55. package/dist/patches/no-tips.d.ts +10 -0
  56. package/dist/patches/no-tips.js +26 -0
  57. package/dist/patches/no-tips.js.map +1 -0
  58. package/dist/patches/persist-max-effort.d.ts +15 -0
  59. package/dist/patches/persist-max-effort.js +75 -0
  60. package/dist/patches/persist-max-effort.js.map +1 -0
  61. package/dist/patches/queue.d.ts +10 -0
  62. package/dist/patches/queue.js +202 -0
  63. package/dist/patches/queue.js.map +1 -0
  64. package/dist/patches/random-clawd.d.ts +9 -0
  65. package/dist/patches/random-clawd.js +49 -0
  66. package/dist/patches/random-clawd.js.map +1 -0
  67. package/dist/patches/reload.d.ts +10 -0
  68. package/dist/patches/reload.js +50 -0
  69. package/dist/patches/reload.js.map +1 -0
  70. package/dist/patches/show-file-in-collapsed-read.d.ts +17 -0
  71. package/dist/patches/show-file-in-collapsed-read.js +151 -0
  72. package/dist/patches/show-file-in-collapsed-read.js.map +1 -0
  73. package/dist/patches/simple-spinner.d.ts +12 -0
  74. package/dist/patches/simple-spinner.js +31 -0
  75. package/dist/patches/simple-spinner.js.map +1 -0
  76. package/dist/patches/swap-enter-submit.d.ts +26 -0
  77. package/dist/patches/swap-enter-submit.js +155 -0
  78. package/dist/patches/swap-enter-submit.js.map +1 -0
  79. package/dist/setup.d.ts +11 -0
  80. package/dist/setup.js +268 -0
  81. package/dist/setup.js.map +1 -0
  82. package/dist/transform-worker.d.ts +10 -0
  83. package/dist/transform-worker.js +35 -0
  84. package/dist/transform-worker.js.map +1 -0
  85. package/dist/transform.d.ts +12 -0
  86. package/dist/transform.js +83 -0
  87. package/dist/transform.js.map +1 -0
  88. package/dist/types.d.ts +105 -0
  89. package/dist/types.js +8 -0
  90. package/dist/types.js.map +1 -0
  91. package/package.json +19 -11
  92. package/ast.js +0 -276
  93. package/cx +0 -228
  94. package/cx-setup +0 -101
  95. package/patch-worker.js +0 -31
  96. package/patches/always-show-context.js +0 -123
  97. package/patches/always-show-thinking.js +0 -65
  98. package/patches/banner.js +0 -58
  99. package/patches/cd-command.js +0 -104
  100. package/patches/cx-badge.js +0 -112
  101. package/patches/cx-resume-commands.js +0 -58
  102. package/patches/disable-paste-collapse.js +0 -52
  103. package/patches/disable-telemetry.js +0 -84
  104. package/patches/no-attribution.js +0 -55
  105. package/patches/no-npm-warning.js +0 -32
  106. package/patches/no-tips.js +0 -29
  107. package/patches/persist-max-effort.js +0 -70
  108. package/patches/queue.js +0 -215
  109. package/patches/random-clawd.js +0 -52
  110. package/patches/reload.js +0 -68
  111. package/patches/show-file-in-collapsed-read.js +0 -178
  112. package/patches/swap-enter-submit.js +0 -188
  113. package/setup.js +0 -222
  114. package/transform-worker.js +0 -38
  115. package/transform.js +0 -99
package/transform.js DELETED
@@ -1,99 +0,0 @@
1
- /**
2
- * AST transform framework for @anthropic-ai/claude-code
3
- *
4
- * Parses the minified bundle with acorn and applies modular patches
5
- * from the patches/ directory. Each patch receives a context object
6
- * with the AST, source, editor, and query helpers.
7
- *
8
- * Usage:
9
- * import { transform } from './transform.js';
10
- * const patched = transform(source); // all patches
11
- * const patched = transform(source, ['queue']); // specific patches
12
- * const patched = transform(source, null, ['banner']); // exclude patches
13
- */
14
-
15
- import * as acorn from 'acorn';
16
- import { Worker } from 'worker_threads';
17
- import { dirname, resolve } from 'path';
18
- import { fileURLToPath } from 'url';
19
- import { ASTIndex, SourceEditor, buildContext } from './ast.js';
20
- import * as allPatches from './patches/index.js';
21
-
22
- const __dirname = dirname(fileURLToPath(import.meta.url));
23
-
24
- // ═══════════════════════════════════════════════════════════════════════════
25
- // Patch resolution
26
- // ═══════════════════════════════════════════════════════════════════════════
27
-
28
- function resolvePatches(only, exclude) {
29
- const available = Object.values(allPatches);
30
- if (only) {
31
- return only.map(id => {
32
- const p = available.find(p => p.id === id);
33
- if (!p) throw new Error(`Unknown patch: "${id}". Available: ${available.map(p => p.id).join(', ')}`);
34
- return p;
35
- });
36
- }
37
- return available.filter(p => !exclude?.includes(p.id));
38
- }
39
-
40
- // ═══════════════════════════════════════════════════════════════════════════
41
- // Transform (sequential)
42
- // ═══════════════════════════════════════════════════════════════════════════
43
-
44
- /**
45
- * @param {string} source - Raw cli.js source
46
- * @param {string[]|null} only - If set, only apply these patch IDs
47
- * @param {string[]|null} exclude - If set, skip these patch IDs
48
- * @returns {string} Patched source
49
- */
50
- export function transform(source, only = null, exclude = null, { onReady, onDone } = {}) {
51
- const ast = acorn.parse(source, { ecmaVersion: 'latest', sourceType: 'module', allowHashBang: true });
52
- const index = new ASTIndex(ast);
53
- const editor = new SourceEditor();
54
- const ctx = buildContext(source, index, editor);
55
- const toApply = resolvePatches(only, exclude);
56
-
57
- onReady?.();
58
- for (const patch of toApply) {
59
- try {
60
- patch.apply(ctx);
61
- } catch (err) {
62
- throw new Error(`Patch "${patch.id}" failed: ${err.message}`);
63
- }
64
- onDone?.(patch.id);
65
- }
66
-
67
- return editor.apply(source);
68
- }
69
-
70
- // ═══════════════════════════════════════════════════════════════════════════
71
- // Transform (async — single worker thread for non-blocking UI)
72
- // ═══════════════════════════════════════════════════════════════════════════
73
-
74
- /**
75
- * Runs parse + index + all patches in a single worker thread.
76
- * Keeps the main thread free for UI updates (timers, spinners).
77
- */
78
- export function transformAsync(source, patchIds, { onReady, onDone } = {}) {
79
- const workerPath = resolve(__dirname, 'transform-worker.js');
80
- const patchesDir = resolve(__dirname, 'patches');
81
-
82
- return new Promise((res, rej) => {
83
- const worker = new Worker(workerPath, {
84
- workerData: { source, patchIds, patchesDir },
85
- });
86
- worker.on('message', msg => {
87
- if (msg.type === 'ready') onReady?.();
88
- else if (msg.type === 'done') onDone?.(msg.id);
89
- else if (msg.type === 'complete') res(msg.patched);
90
- else if (msg.type === 'error') rej(new Error(msg.error));
91
- });
92
- worker.on('error', rej);
93
- });
94
- }
95
-
96
- /** List all available patches. */
97
- export function listPatches() {
98
- return Object.values(allPatches).map(p => ({ id: p.id, name: p.name, description: p.description, defaultEnabled: p.defaultEnabled }));
99
- }