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.
- package/dist/ast.d.ts +43 -0
- package/dist/ast.js +308 -0
- package/dist/ast.js.map +1 -0
- package/dist/cli-list.d.ts +5 -0
- package/dist/cli-list.js +33 -0
- package/dist/cli-list.js.map +1 -0
- package/dist/cli-reload.d.ts +7 -0
- package/dist/cli-reload.js +24 -0
- package/dist/cli-reload.js.map +1 -0
- package/dist/cli-setup.d.ts +14 -0
- package/dist/cli-setup.js +110 -0
- package/dist/cli-setup.js.map +1 -0
- package/dist/cli.d.ts +14 -0
- package/dist/cli.js +183 -0
- package/dist/cli.js.map +1 -0
- package/dist/patch-worker.d.ts +6 -0
- package/dist/patch-worker.js +27 -0
- package/dist/patch-worker.js.map +1 -0
- package/dist/patches/always-show-context.d.ts +23 -0
- package/dist/patches/always-show-context.js +97 -0
- package/dist/patches/always-show-context.js.map +1 -0
- package/dist/patches/always-show-thinking.d.ts +18 -0
- package/dist/patches/always-show-thinking.js +55 -0
- package/dist/patches/always-show-thinking.js.map +1 -0
- package/dist/patches/banner.d.ts +10 -0
- package/dist/patches/banner.js +105 -0
- package/dist/patches/banner.js.map +1 -0
- package/dist/patches/cd-command.d.ts +16 -0
- package/dist/patches/cd-command.js +89 -0
- package/dist/patches/cd-command.js.map +1 -0
- package/dist/patches/cx-badge.d.ts +10 -0
- package/dist/patches/cx-badge.js +115 -0
- package/dist/patches/cx-badge.js.map +1 -0
- package/dist/patches/cx-resume-commands.d.ts +14 -0
- package/dist/patches/cx-resume-commands.js +53 -0
- package/dist/patches/cx-resume-commands.js.map +1 -0
- package/dist/patches/disable-paste-collapse.d.ts +16 -0
- package/dist/patches/disable-paste-collapse.js +49 -0
- package/dist/patches/disable-paste-collapse.js.map +1 -0
- package/dist/patches/disable-telemetry.d.ts +13 -0
- package/dist/patches/disable-telemetry.js +76 -0
- package/dist/patches/disable-telemetry.js.map +1 -0
- package/{patches/index.js → dist/patches/index.d.ts} +2 -0
- package/dist/patches/index.js +20 -0
- package/dist/patches/index.js.map +1 -0
- package/dist/patches/no-attribution.d.ts +15 -0
- package/dist/patches/no-attribution.js +42 -0
- package/dist/patches/no-attribution.js.map +1 -0
- package/dist/patches/no-feedback.d.ts +12 -0
- package/dist/patches/no-feedback.js +31 -0
- package/dist/patches/no-feedback.js.map +1 -0
- package/dist/patches/no-npm-warning.d.ts +9 -0
- package/dist/patches/no-npm-warning.js +31 -0
- package/dist/patches/no-npm-warning.js.map +1 -0
- package/dist/patches/no-tips.d.ts +10 -0
- package/dist/patches/no-tips.js +26 -0
- package/dist/patches/no-tips.js.map +1 -0
- package/dist/patches/persist-max-effort.d.ts +15 -0
- package/dist/patches/persist-max-effort.js +75 -0
- package/dist/patches/persist-max-effort.js.map +1 -0
- package/dist/patches/queue.d.ts +10 -0
- package/dist/patches/queue.js +202 -0
- package/dist/patches/queue.js.map +1 -0
- package/dist/patches/random-clawd.d.ts +9 -0
- package/dist/patches/random-clawd.js +49 -0
- package/dist/patches/random-clawd.js.map +1 -0
- package/dist/patches/reload.d.ts +10 -0
- package/dist/patches/reload.js +50 -0
- package/dist/patches/reload.js.map +1 -0
- package/dist/patches/show-file-in-collapsed-read.d.ts +17 -0
- package/dist/patches/show-file-in-collapsed-read.js +151 -0
- package/dist/patches/show-file-in-collapsed-read.js.map +1 -0
- package/dist/patches/simple-spinner.d.ts +12 -0
- package/dist/patches/simple-spinner.js +31 -0
- package/dist/patches/simple-spinner.js.map +1 -0
- package/dist/patches/swap-enter-submit.d.ts +26 -0
- package/dist/patches/swap-enter-submit.js +155 -0
- package/dist/patches/swap-enter-submit.js.map +1 -0
- package/dist/setup.d.ts +11 -0
- package/dist/setup.js +268 -0
- package/dist/setup.js.map +1 -0
- package/dist/transform-worker.d.ts +10 -0
- package/dist/transform-worker.js +35 -0
- package/dist/transform-worker.js.map +1 -0
- package/dist/transform.d.ts +12 -0
- package/dist/transform.js +83 -0
- package/dist/transform.js.map +1 -0
- package/dist/types.d.ts +105 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/package.json +19 -11
- package/ast.js +0 -276
- package/cx +0 -228
- package/cx-setup +0 -101
- package/patch-worker.js +0 -31
- package/patches/always-show-context.js +0 -123
- package/patches/always-show-thinking.js +0 -65
- package/patches/banner.js +0 -58
- package/patches/cd-command.js +0 -104
- package/patches/cx-badge.js +0 -112
- package/patches/cx-resume-commands.js +0 -58
- package/patches/disable-paste-collapse.js +0 -52
- package/patches/disable-telemetry.js +0 -84
- package/patches/no-attribution.js +0 -55
- package/patches/no-npm-warning.js +0 -32
- package/patches/no-tips.js +0 -29
- package/patches/persist-max-effort.js +0 -70
- package/patches/queue.js +0 -215
- package/patches/random-clawd.js +0 -52
- package/patches/reload.js +0 -68
- package/patches/show-file-in-collapsed-read.js +0 -178
- package/patches/swap-enter-submit.js +0 -188
- package/setup.js +0 -222
- package/transform-worker.js +0 -38
- 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
|
-
}
|