claude-code-extensions 0.1.0 → 0.1.1
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-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 +18 -0
- package/dist/cli.js +218 -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 +60 -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} +4 -0
- package/dist/patches/index.js +22 -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/session-export.d.ts +16 -0
- package/dist/patches/session-export.js +93 -0
- package/dist/patches/session-export.js.map +1 -0
- package/dist/patches/session-timer.d.ts +18 -0
- package/dist/patches/session-timer.js +217 -0
- package/dist/patches/session-timer.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 +30 -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 +16 -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
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* /cd Command Patch
|
|
3
|
+
*
|
|
4
|
+
* Adds a /cd <path> slash command to change the working directory
|
|
5
|
+
* mid-session without losing conversation context.
|
|
6
|
+
*
|
|
7
|
+
* Addresses: https://github.com/anthropics/claude-code/issues/3473 (54 thumbs up)
|
|
8
|
+
*
|
|
9
|
+
* AST strategy: find the bundled setCwd function (via its "tengu_shell_set_cwd"
|
|
10
|
+
* telemetry string) and getCwdState (via its named export mapping), then inject
|
|
11
|
+
* a new LocalCommand into the memoized COMMANDS array. The command calls setCwd
|
|
12
|
+
* and reports the new working directory.
|
|
13
|
+
*/
|
|
14
|
+
const patch = {
|
|
15
|
+
id: 'cd-command',
|
|
16
|
+
name: '/cd Command',
|
|
17
|
+
description: '/cd <path> — change where bash commands run (same as shell cd, keeps project settings)',
|
|
18
|
+
apply(ctx) {
|
|
19
|
+
const { ast, editor, find, query, index, src, assert } = ctx;
|
|
20
|
+
// ── 1. Find setCwd function via telemetry string ─────────────────
|
|
21
|
+
// setCwd logs "tengu_shell_set_cwd" on success. The shell exec function
|
|
22
|
+
// also logs it on failure, but inside an async arrow — setCwd is the
|
|
23
|
+
// only sync FunctionDeclaration containing this string.
|
|
24
|
+
const setCwdFns = query.findFunctionsContainingStrings(ast, 'tengu_shell_set_cwd');
|
|
25
|
+
assert(setCwdFns.length >= 1, 'Could not find functions with tengu_shell_set_cwd');
|
|
26
|
+
const setCwdFn = setCwdFns.find((fn) => fn.type === 'FunctionDeclaration' && !fn.async);
|
|
27
|
+
assert(setCwdFn, 'Could not find setCwd (sync FunctionDeclaration)');
|
|
28
|
+
const setCwdName = ctx.getFunctionName(setCwdFn);
|
|
29
|
+
assert(setCwdName, 'Could not determine setCwd function name');
|
|
30
|
+
// ── 2. Find getCwdState via export mapping ───────────────────────
|
|
31
|
+
// The state module exports: getCwdState:()=>XX
|
|
32
|
+
// This is a Property with Identifier key and zero-param ArrowFunction value.
|
|
33
|
+
const getCwdProp = find.findFirst(ast, (n) => n.type === 'Property' &&
|
|
34
|
+
n.key?.type === 'Identifier' && n.key.name === 'getCwdState' &&
|
|
35
|
+
n.value?.type === 'ArrowFunctionExpression' &&
|
|
36
|
+
n.value.params.length === 0 &&
|
|
37
|
+
n.value.body?.type === 'Identifier');
|
|
38
|
+
assert(getCwdProp, 'Could not find getCwdState export mapping');
|
|
39
|
+
const getCwdName = getCwdProp.value.body.name;
|
|
40
|
+
// ── 3. Find the COMMANDS array ───────────────────────────────────
|
|
41
|
+
// Locate via the compact command: find its definition object, trace to
|
|
42
|
+
// the exported variable, then find the large array containing it.
|
|
43
|
+
const compactObj = query.findObjectWithStringProps(ast, [
|
|
44
|
+
['name', 'compact'],
|
|
45
|
+
['type', 'local'],
|
|
46
|
+
]);
|
|
47
|
+
assert(compactObj, 'Could not find compact command definition');
|
|
48
|
+
// Walk up to: localVar = {name:"compact",...}
|
|
49
|
+
let assignNode = index.parentMap.get(compactObj);
|
|
50
|
+
while (assignNode && assignNode.type !== 'AssignmentExpression') {
|
|
51
|
+
assignNode = index.parentMap.get(assignNode);
|
|
52
|
+
}
|
|
53
|
+
assert(assignNode?.type === 'AssignmentExpression' &&
|
|
54
|
+
assignNode.left?.type === 'Identifier', 'Could not find compact assignment');
|
|
55
|
+
const localVar = assignNode.left.name;
|
|
56
|
+
// Find re-export: exportVar = localVar
|
|
57
|
+
const reExport = find.findFirst(ast, (n) => n.type === 'AssignmentExpression' &&
|
|
58
|
+
n.right?.type === 'Identifier' && n.right.name === localVar &&
|
|
59
|
+
n.left?.type === 'Identifier' && n.left.name !== localVar);
|
|
60
|
+
assert(reExport, 'Could not find compact re-export');
|
|
61
|
+
const exportVar = reExport.left.name;
|
|
62
|
+
// Find the array containing exportVar (COMMANDS has 40+ elements)
|
|
63
|
+
const commandsArr = find.findFirst(ast, (n) => {
|
|
64
|
+
if (n.type !== 'ArrayExpression')
|
|
65
|
+
return false;
|
|
66
|
+
if (n.elements.length < 20)
|
|
67
|
+
return false;
|
|
68
|
+
return n.elements.some((el) => el?.type === 'Identifier' && el.name === exportVar);
|
|
69
|
+
});
|
|
70
|
+
assert(commandsArr, 'Could not find COMMANDS array');
|
|
71
|
+
// ── 4. Inject /cd command ────────────────────────────────────────
|
|
72
|
+
// Insert as last concrete element, before the closing bracket.
|
|
73
|
+
// The command calls setCwd (which validates path, resolves symlinks,
|
|
74
|
+
// updates internal state) and returns the new CWD.
|
|
75
|
+
const lastEl = commandsArr.elements[commandsArr.elements.length - 1];
|
|
76
|
+
const cdCmd = `,{type:"local",name:"cd",description:"Change working directory"` +
|
|
77
|
+
`,argumentHint:"<path>",supportsNonInteractive:true` +
|
|
78
|
+
`,load:()=>Promise.resolve({call:async(q)=>{` +
|
|
79
|
+
`let p=q.trim();` +
|
|
80
|
+
`if(!p)return{type:"text",value:"Current directory: "+${getCwdName}()};` +
|
|
81
|
+
`if(p.startsWith("~"))p=(process.env.HOME||"")+p.slice(1);` +
|
|
82
|
+
`try{${setCwdName}(p);return{type:"text",value:"Changed to "+${getCwdName}()}}` +
|
|
83
|
+
`catch(e){return{type:"text",value:e.message||"Failed to change directory"}}` +
|
|
84
|
+
`}})}`;
|
|
85
|
+
editor.insertAt(lastEl.end, cdCmd);
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
export default patch;
|
|
89
|
+
//# sourceMappingURL=cd-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cd-command.js","sourceRoot":"","sources":["../../src/patches/cd-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,MAAM,KAAK,GAAU;IACnB,EAAE,EAAE,YAAY;IAChB,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,wFAAwF;IAErG,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;QAE7D,oEAAoE;QACpE,wEAAwE;QACxE,qEAAqE;QACrE,wDAAwD;QACxD,MAAM,SAAS,GAAG,KAAK,CAAC,8BAA8B,CACpD,GAAG,EAAE,qBAAqB,CAC3B,CAAC;QACF,MAAM,CAAC,SAAS,CAAC,MAAM,IAAI,CAAC,EAAE,mDAAmD,CAAC,CAAC;QACnF,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,EAAO,EAAE,EAAE,CAC1C,EAAE,CAAC,IAAI,KAAK,qBAAqB,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;QAClD,MAAM,CAAC,QAAQ,EAAE,kDAAkD,CAAC,CAAC;QACrE,MAAM,UAAU,GAAG,GAAG,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;QACjD,MAAM,CAAC,UAAU,EAAE,0CAA0C,CAAC,CAAC;QAE/D,oEAAoE;QACpE,+CAA+C;QAC/C,6EAA6E;QAC7E,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;YAC/E,6EAA6E;YAC/E,MAAM,CAAC;QACT,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACrC,CAAC;CACF,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CX Badge Patch
|
|
3
|
+
*
|
|
4
|
+
* Adds a small "cx" indicator to the left of the permission mode text
|
|
5
|
+
* (e.g. "bypass permissions on", "accept edits on") in the footer.
|
|
6
|
+
* When no mode is active, the badge still shows on the footer line.
|
|
7
|
+
*/
|
|
8
|
+
import type { Patch } from '../types.js';
|
|
9
|
+
declare const patch: Patch;
|
|
10
|
+
export default patch;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CX Badge Patch
|
|
3
|
+
*
|
|
4
|
+
* Adds a small "cx" indicator to the left of the permission mode text
|
|
5
|
+
* (e.g. "bypass permissions on", "accept edits on") in the footer.
|
|
6
|
+
* When no mode is active, the badge still shows on the footer line.
|
|
7
|
+
*/
|
|
8
|
+
const patch = {
|
|
9
|
+
id: 'cx-badge',
|
|
10
|
+
name: 'CX Badge',
|
|
11
|
+
description: 'Show a persistent "cx" indicator in the prompt footer',
|
|
12
|
+
apply(ctx) {
|
|
13
|
+
const { ast, editor, find, src, assert } = ctx;
|
|
14
|
+
const { findFirst } = find;
|
|
15
|
+
// Find the ModeIndicator function via the unique "? for shortcuts" string.
|
|
16
|
+
// Then locate the final return that builds <Box height={1} overflow="hidden">
|
|
17
|
+
// which contains modePart, tasksPart, and parts.
|
|
18
|
+
// Strategy: find the string "? for shortcuts" — it's inside a JSX element
|
|
19
|
+
// in ModeIndicator. Then find the enclosing function.
|
|
20
|
+
const shortcutsHint = findFirst(ast, (n) => n.type === 'Literal' && n.value === '? for shortcuts');
|
|
21
|
+
assert(shortcutsHint, 'Could not find "? for shortcuts" literal');
|
|
22
|
+
// Walk up to find the function containing this
|
|
23
|
+
const modeIndicatorFn = findFirst(ast, (node) => {
|
|
24
|
+
if (node.type !== 'FunctionDeclaration' && node.type !== 'FunctionExpression')
|
|
25
|
+
return false;
|
|
26
|
+
// Check if the "? for shortcuts" literal is inside this function
|
|
27
|
+
let found = false;
|
|
28
|
+
const check = (n) => {
|
|
29
|
+
if (n === shortcutsHint) {
|
|
30
|
+
found = true;
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (found)
|
|
34
|
+
return;
|
|
35
|
+
for (const key of Object.keys(n)) {
|
|
36
|
+
if (key === 'type' || key === 'start' || key === 'end')
|
|
37
|
+
continue;
|
|
38
|
+
const val = n[key];
|
|
39
|
+
if (val && typeof val === 'object') {
|
|
40
|
+
if (Array.isArray(val)) {
|
|
41
|
+
for (const item of val) {
|
|
42
|
+
if (item && typeof item.type === 'string')
|
|
43
|
+
check(item);
|
|
44
|
+
if (found)
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
else if (typeof val.type === 'string') {
|
|
49
|
+
check(val);
|
|
50
|
+
if (found)
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
check(node);
|
|
57
|
+
return found;
|
|
58
|
+
});
|
|
59
|
+
assert(modeIndicatorFn, 'Could not find ModeIndicator function');
|
|
60
|
+
// Find the createElement call with height:1 and overflow:"hidden" props
|
|
61
|
+
// This is the final return: <Box height={1} overflow="hidden">
|
|
62
|
+
const boxWithHeight1 = findFirst(modeIndicatorFn, (n) => {
|
|
63
|
+
if (n.type !== 'CallExpression')
|
|
64
|
+
return false;
|
|
65
|
+
// Look for an object argument with height:1 and overflow:"hidden"
|
|
66
|
+
return n.arguments.some((arg) => {
|
|
67
|
+
if (arg?.type !== 'ObjectExpression')
|
|
68
|
+
return false;
|
|
69
|
+
let hasHeight = false;
|
|
70
|
+
let hasOverflow = false;
|
|
71
|
+
for (const p of arg.properties) {
|
|
72
|
+
if (p.key?.name === 'height' && p.value?.value === 1)
|
|
73
|
+
hasHeight = true;
|
|
74
|
+
if (p.key?.name === 'overflow' && p.value?.value === 'hidden')
|
|
75
|
+
hasOverflow = true;
|
|
76
|
+
}
|
|
77
|
+
return hasHeight && hasOverflow;
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
assert(boxWithHeight1, 'Could not find <Box height={1} overflow="hidden">');
|
|
81
|
+
// Get the React namespace from the createElement call
|
|
82
|
+
// The call looks like: R.createElement(Box, {height:1, overflow:"hidden"}, ...children)
|
|
83
|
+
const callee = boxWithHeight1.callee;
|
|
84
|
+
let R;
|
|
85
|
+
if (callee.type === 'MemberExpression') {
|
|
86
|
+
R = src(callee.object);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
// Could be jsxs or jsx direct call
|
|
90
|
+
R = src(callee);
|
|
91
|
+
}
|
|
92
|
+
// Find the Box component reference (first argument to createElement)
|
|
93
|
+
const BoxRef = src(boxWithHeight1.arguments[0]);
|
|
94
|
+
// Find the Text component — look for a createElement call with " · " string
|
|
95
|
+
const separatorCall = findFirst(modeIndicatorFn, (n) => {
|
|
96
|
+
if (n.type !== 'CallExpression')
|
|
97
|
+
return false;
|
|
98
|
+
return n.arguments.some((a) => a?.type === 'Literal' && a.value === ' · ');
|
|
99
|
+
});
|
|
100
|
+
assert(separatorCall, 'Could not find separator " · " createElement');
|
|
101
|
+
const TextRef = src(separatorCall.arguments[0]);
|
|
102
|
+
// Insert a CX badge as the first child of the Box.
|
|
103
|
+
// The children start after the props object.
|
|
104
|
+
// Find the props object position
|
|
105
|
+
const propsArg = boxWithHeight1.arguments.find((a) => a?.type === 'ObjectExpression' &&
|
|
106
|
+
a.properties.some((p) => p.key?.name === 'height'));
|
|
107
|
+
// Insert right after the props argument (before the first child)
|
|
108
|
+
const insertPos = propsArg.end;
|
|
109
|
+
// CX badge: inverse claude orange
|
|
110
|
+
const cxBadge = `,${R}.createElement(${BoxRef},{flexShrink:0},${R}.createElement(${TextRef},{inverse:true,color:"claude"},"cx"),${R}.createElement(${TextRef},null," "))`;
|
|
111
|
+
editor.insertAt(insertPos, cxBadge);
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
export default patch;
|
|
115
|
+
//# sourceMappingURL=cx-badge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cx-badge.js","sourceRoot":"","sources":["../../src/patches/cx-badge.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,KAAK,GAAU;IACnB,EAAE,EAAE,UAAU;IACd,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE,uDAAuD;IAEpE,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;QAC/C,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;QAE3B,2EAA2E;QAC3E,8EAA8E;QAC9E,iDAAiD;QAEjD,0EAA0E;QAC1E,sDAAsD;QACtD,MAAM,aAAa,GAAG,SAAS,CAAC,GAAG,EAAE,CAAC,CAAM,EAAE,EAAE,CAC9C,CAAC,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,CAAC,KAAK,KAAK,iBAAiB,CAAC,CAAC;QACzD,MAAM,CAAC,aAAa,EAAE,0CAA0C,CAAC,CAAC;QAElE,+CAA+C;QAC/C,MAAM,eAAe,GAAG,SAAS,CAAC,GAAG,EAAE,CAAC,IAAS,EAAE,EAAE;YACnD,IAAI,IAAI,CAAC,IAAI,KAAK,qBAAqB,IAAI,IAAI,CAAC,IAAI,KAAK,oBAAoB;gBAAE,OAAO,KAAK,CAAC;YAC5F,iEAAiE;YACjE,IAAI,KAAK,GAAG,KAAK,CAAC;YAClB,MAAM,KAAK,GAAG,CAAC,CAAM,EAAE,EAAE;gBACvB,IAAI,CAAC,KAAK,aAAa,EAAE,CAAC;oBAAC,KAAK,GAAG,IAAI,CAAC;o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AE,CAAC,CAAC,EAAE,IAAI,KAAK,SAAS,IAAI,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC;QAClF,CAAC,CAAC,CAAC;QACH,MAAM,CAAC,aAAa,EAAE,8CAA8C,CAAC,CAAC;QACtE,MAAM,OAAO,GAAG,GAAG,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QAEhD,mDAAmD;QACnD,6CAA6C;QAC7C,iCAAiC;QACjC,MAAM,QAAQ,GAAG,cAAc,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAM,EAAE,EAAE,CACxD,CAAC,EAAE,IAAI,KAAK,kBAAkB;YAC9B,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC;QAE3D,iEAAiE;QACjE,MAAM,SAAS,GAAG,QAAQ,CAAC,GAAG,CAAC;QAE/B,kCAAkC;QAClC,MAAM,OAAO,GAAG,IAAI,CAAC,kBAAkB,MAAM,mBAAmB,CAAC,kBAAkB,OAAO,wCAAwC,CAAC,kBAAkB,OAAO,aAAa,CAAC;QAE1K,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;CACF,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* cx Resume Commands Patch
|
|
3
|
+
*
|
|
4
|
+
* Rewrites user-facing resume/continue command hints so they point at
|
|
5
|
+
* the cx wrapper instead of bare claude.
|
|
6
|
+
*
|
|
7
|
+
* AST strategy: scan string literals and template chunks for the stable
|
|
8
|
+
* command snippets that Claude prints to users, then replace only those
|
|
9
|
+
* substrings in-place. This covers shutdown hints, cross-project resume
|
|
10
|
+
* commands, and resume tips without relying on minified variable names.
|
|
11
|
+
*/
|
|
12
|
+
import type { Patch } from '../types.js';
|
|
13
|
+
declare const patch: Patch;
|
|
14
|
+
export default patch;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* cx Resume Commands Patch
|
|
3
|
+
*
|
|
4
|
+
* Rewrites user-facing resume/continue command hints so they point at
|
|
5
|
+
* the cx wrapper instead of bare claude.
|
|
6
|
+
*
|
|
7
|
+
* AST strategy: scan string literals and template chunks for the stable
|
|
8
|
+
* command snippets that Claude prints to users, then replace only those
|
|
9
|
+
* substrings in-place. This covers shutdown hints, cross-project resume
|
|
10
|
+
* commands, and resume tips without relying on minified variable names.
|
|
11
|
+
*/
|
|
12
|
+
const patch = {
|
|
13
|
+
id: 'cx-resume-commands',
|
|
14
|
+
name: 'cx Resume Commands',
|
|
15
|
+
description: 'Show cx instead of claude in resume/continue command hints',
|
|
16
|
+
apply(ctx) {
|
|
17
|
+
const { ast, editor, find, src, assert } = ctx;
|
|
18
|
+
const { findAll } = find;
|
|
19
|
+
const replacements = [
|
|
20
|
+
['claude --continue', 'cx --continue'],
|
|
21
|
+
['claude --resume', 'cx --resume'],
|
|
22
|
+
['claude -p --resume', 'cx -p --resume'],
|
|
23
|
+
];
|
|
24
|
+
let changed = 0;
|
|
25
|
+
const rewrite = (node, text) => {
|
|
26
|
+
let next = text;
|
|
27
|
+
for (const [from, to] of replacements) {
|
|
28
|
+
next = next.split(from).join(to);
|
|
29
|
+
}
|
|
30
|
+
if (next !== text) {
|
|
31
|
+
editor.replaceRange(node.start, node.end, JSON.stringify(next));
|
|
32
|
+
changed++;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
for (const node of findAll(ast, (n) => n.type === 'Literal' && typeof n.value === 'string')) {
|
|
36
|
+
rewrite(node, node.value);
|
|
37
|
+
}
|
|
38
|
+
for (const node of findAll(ast, (n) => n.type === 'TemplateElement' && typeof n.value?.raw === 'string')) {
|
|
39
|
+
const raw = src(node);
|
|
40
|
+
let nextRaw = raw;
|
|
41
|
+
for (const [from, to] of replacements) {
|
|
42
|
+
nextRaw = nextRaw.split(from).join(to);
|
|
43
|
+
}
|
|
44
|
+
if (nextRaw !== raw) {
|
|
45
|
+
editor.replaceRange(node.start, node.end, nextRaw);
|
|
46
|
+
changed++;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
assert(changed >= 4, `Expected at least 4 resume/continue command rewrites, found ${changed}`);
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
export default patch;
|
|
53
|
+
//# sourceMappingURL=cx-resume-commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cx-resume-commands.js","sourceRoot":"","sources":["../../src/patches/cx-resume-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,MAAM,KAAK,GAAU;IACnB,EAAE,EAAE,oBAAoB;IACxB,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,4DAA4D;IAEzE,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;QAC/C,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;QAEzB,MAAM,YAAY,GAAuB;YACvC,CAAC,mBAAmB,EAAE,eAAe,CAAC;YACtC,CAAC,iBAAiB,EAAE,aAAa,CAAC;YAClC,CAAC,oBAAoB,EAAE,gBAAgB,CAAC;SACzC,CAAC;QAEF,IAAI,OAAO,GAAG,CAAC,CAAC;QAChB,MAAM,OAAO,GAAG,CAAC,IAAS,EAAE,IAAY,EAAE,EAAE;YAC1C,IAAI,IAAI,GAAG,IAAI,CAAC;YAChB,KAAK,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,YAAY,EAAE,CAAC;gBACtC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACnC,CAAC;YACD,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC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
+
/**
|
|
2
|
+
* Disable Paste Collapse
|
|
3
|
+
*
|
|
4
|
+
* Prevents pasted text from being collapsed into "[Pasted text #N +X lines]"
|
|
5
|
+
* placeholders. All pasted content is inserted inline so you can review and
|
|
6
|
+
* edit it before submitting.
|
|
7
|
+
*
|
|
8
|
+
* Addresses: https://github.com/anthropics/claude-code/issues/23134 (77 thumbs up)
|
|
9
|
+
*
|
|
10
|
+
* Strategy: find the paste-collapse condition in onTextPaste() — identified
|
|
11
|
+
* by the call to formatPastedTextRef (Xd8) which contains the stable string
|
|
12
|
+
* literal "Pasted text #" — and replace the guard condition with `false`.
|
|
13
|
+
*/
|
|
14
|
+
import type { Patch } from '../types.js';
|
|
15
|
+
declare const patch: Patch;
|
|
16
|
+
export default patch;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Disable Paste Collapse
|
|
3
|
+
*
|
|
4
|
+
* Prevents pasted text from being collapsed into "[Pasted text #N +X lines]"
|
|
5
|
+
* placeholders. All pasted content is inserted inline so you can review and
|
|
6
|
+
* edit it before submitting.
|
|
7
|
+
*
|
|
8
|
+
* Addresses: https://github.com/anthropics/claude-code/issues/23134 (77 thumbs up)
|
|
9
|
+
*
|
|
10
|
+
* Strategy: find the paste-collapse condition in onTextPaste() — identified
|
|
11
|
+
* by the call to formatPastedTextRef (Xd8) which contains the stable string
|
|
12
|
+
* literal "Pasted text #" — and replace the guard condition with `false`.
|
|
13
|
+
*/
|
|
14
|
+
const patch = {
|
|
15
|
+
id: 'disable-paste-collapse',
|
|
16
|
+
name: 'Disable Paste Collapse',
|
|
17
|
+
description: 'Show pasted text inline instead of collapsing into [Pasted text #N]',
|
|
18
|
+
apply(ctx) {
|
|
19
|
+
const { ast, editor, find, src, assert } = ctx;
|
|
20
|
+
const { findFirst } = find;
|
|
21
|
+
// Find the formatPastedTextRef function by its "Pasted text #" template literal.
|
|
22
|
+
const fmtFn = findFirst(ast, (n) => n.type === 'FunctionDeclaration' &&
|
|
23
|
+
src(n).includes('Pasted text #'));
|
|
24
|
+
assert(fmtFn, 'Could not find formatPastedTextRef function');
|
|
25
|
+
const fmtName = fmtFn.id.name; // e.g. "Xd8"
|
|
26
|
+
// Find the onTextPaste function: contains a call to formatPastedTextRef
|
|
27
|
+
// and an if-statement whose consequent calls it.
|
|
28
|
+
// We look for the IfStatement whose consequent block contains a call
|
|
29
|
+
// to fmtName — that's the collapse gate.
|
|
30
|
+
const collapseIf = findFirst(ast, (n) => {
|
|
31
|
+
if (n.type !== 'IfStatement')
|
|
32
|
+
return false;
|
|
33
|
+
// The consequent must contain a call to fmtName
|
|
34
|
+
const hasFmtCall = findFirst(n.consequent, (c) => c.type === 'CallExpression' &&
|
|
35
|
+
c.callee.type === 'Identifier' &&
|
|
36
|
+
c.callee.name === fmtName);
|
|
37
|
+
if (!hasFmtCall)
|
|
38
|
+
return false;
|
|
39
|
+
// The alternate should insert text directly (else branch)
|
|
40
|
+
return n.alternate !== null;
|
|
41
|
+
});
|
|
42
|
+
assert(collapseIf, 'Could not find paste-collapse if-statement');
|
|
43
|
+
// Replace the test expression with `false`
|
|
44
|
+
const test = collapseIf.test;
|
|
45
|
+
editor.replaceRange(test.start, test.end, 'false');
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
export default patch;
|
|
49
|
+
//# sourceMappingURL=disable-paste-collapse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disable-paste-collapse.js","sourceRoot":"","sources":["../../src/patches/disable-paste-collapse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,MAAM,KAAK,GAAU;IACnB,EAAE,EAAE,wBAAwB;IAC5B,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EAAE,qEAAqE;IAElF,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;QAC/C,MAAM,EAAE,SA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
|
1
|
+
/**
|
|
2
|
+
* Disable Telemetry Patch
|
|
3
|
+
*
|
|
4
|
+
* Strips Datadog and 1P (first-party) analytics calls.
|
|
5
|
+
*
|
|
6
|
+
* Three surgical cuts:
|
|
7
|
+
* 1. Kill the analytics sink — logEvent() queues forever, nothing drains
|
|
8
|
+
* 2. Noop Datadog HTTP flush + blank endpoint — no POST to Datadog
|
|
9
|
+
* 3. Noop 1P event logging init — prevents exporter + retry of old events
|
|
10
|
+
*/
|
|
11
|
+
import type { Patch } from '../types.js';
|
|
12
|
+
declare const patch: Patch;
|
|
13
|
+
export default patch;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Disable Telemetry Patch
|
|
3
|
+
*
|
|
4
|
+
* Strips Datadog and 1P (first-party) analytics calls.
|
|
5
|
+
*
|
|
6
|
+
* Three surgical cuts:
|
|
7
|
+
* 1. Kill the analytics sink — logEvent() queues forever, nothing drains
|
|
8
|
+
* 2. Noop Datadog HTTP flush + blank endpoint — no POST to Datadog
|
|
9
|
+
* 3. Noop 1P event logging init — prevents exporter + retry of old events
|
|
10
|
+
*/
|
|
11
|
+
const patch = {
|
|
12
|
+
id: 'disable-telemetry',
|
|
13
|
+
name: 'Disable Telemetry',
|
|
14
|
+
description: 'Strip Datadog and 1P analytics calls',
|
|
15
|
+
apply(ctx) {
|
|
16
|
+
const { ast, editor, find, query, assert } = ctx;
|
|
17
|
+
const { findFirst } = find;
|
|
18
|
+
// ── 1. Kill the analytics sink ───────────────────────────────────────
|
|
19
|
+
// initializeAnalyticsSink() calls attachAnalyticsSink({logEvent, logEventAsync}).
|
|
20
|
+
// Replace that call with void 0 so the sink never attaches. Without a
|
|
21
|
+
// sink, logEvent() just pushes to an internal queue that never drains —
|
|
22
|
+
// neither Datadog nor 1P receives anything.
|
|
23
|
+
//
|
|
24
|
+
// Marker: object literal with preserved keys "logEvent" + "logEventAsync"
|
|
25
|
+
// passed as sole argument to a call expression.
|
|
26
|
+
const sinkCall = findFirst(ast, (n) => {
|
|
27
|
+
if (n.type !== 'CallExpression' || n.arguments.length !== 1)
|
|
28
|
+
return false;
|
|
29
|
+
const arg = n.arguments[0];
|
|
30
|
+
if (arg.type !== 'ObjectExpression')
|
|
31
|
+
return false;
|
|
32
|
+
const keys = arg.properties
|
|
33
|
+
.filter((p) => p.type === 'Property')
|
|
34
|
+
.map((p) => p.key.name || p.key.value);
|
|
35
|
+
return keys.includes('logEvent') && keys.includes('logEventAsync');
|
|
36
|
+
});
|
|
37
|
+
assert(sinkCall, 'Could not find attachAnalyticsSink({logEvent, logEventAsync})');
|
|
38
|
+
editor.replaceRange(sinkCall.start, sinkCall.end, 'void 0');
|
|
39
|
+
// ── 2. Noop Datadog HTTP flush + blank endpoint ─────────────────────
|
|
40
|
+
// shutdownDatadog() calls flushLogs() on exit, which would POST
|
|
41
|
+
// whatever's in logBatch. Insert early return to prevent any HTTP call.
|
|
42
|
+
//
|
|
43
|
+
// Marker: "DD-API-KEY" header string. Take the smallest zero-param
|
|
44
|
+
// function containing it (flushLogs, not a module wrapper).
|
|
45
|
+
const ddCandidates = query.findFunctionsContainingStrings(ast, 'DD-API-KEY');
|
|
46
|
+
const flushFns = ddCandidates
|
|
47
|
+
.filter((fn) => fn.params.length === 0)
|
|
48
|
+
.sort((a, b) => (a.end - a.start) - (b.end - b.start));
|
|
49
|
+
assert(flushFns.length >= 1, 'Could not find Datadog flushLogs function');
|
|
50
|
+
const flushBody = flushFns[0].body;
|
|
51
|
+
assert(flushBody.type === 'BlockStatement', 'flushLogs: expected block body');
|
|
52
|
+
editor.insertAt(flushBody.start + 1, 'return;');
|
|
53
|
+
// Blank the endpoint URL as extra safety (token is not a plain literal
|
|
54
|
+
// in the bundle, so we target the URL instead).
|
|
55
|
+
const endpointLit = findFirst(ast, (n) => n.type === 'Literal' &&
|
|
56
|
+
n.value === 'https://http-intake.logs.us5.datadoghq.com/api/v2/logs');
|
|
57
|
+
assert(endpointLit, 'Could not find Datadog endpoint URL');
|
|
58
|
+
editor.replaceRange(endpointLit.start, endpointLit.end, '""');
|
|
59
|
+
// ── 3. Noop 1P event logging init ───────────────────────────────────
|
|
60
|
+
// Prevents the OpenTelemetry exporter from being created, which also
|
|
61
|
+
// stops retryPreviousBatches from re-sending old failed events.
|
|
62
|
+
//
|
|
63
|
+
// Marker: "com.anthropic.claude_code.events" instrumentation scope.
|
|
64
|
+
// Take the smallest zero-param function containing it.
|
|
65
|
+
const init1PCandidates = query.findFunctionsContainingStrings(ast, 'com.anthropic.claude_code.events');
|
|
66
|
+
const init1PFns = init1PCandidates
|
|
67
|
+
.filter((fn) => fn.params.length === 0)
|
|
68
|
+
.sort((a, b) => (a.end - a.start) - (b.end - b.start));
|
|
69
|
+
assert(init1PFns.length >= 1, 'Could not find initialize1PEventLogging');
|
|
70
|
+
const init1PBody = init1PFns[0].body;
|
|
71
|
+
assert(init1PBody.type === 'BlockStatement', 'initialize1PEventLogging: expected block body');
|
|
72
|
+
editor.insertAt(init1PBody.start + 1, 'return;');
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
export default patch;
|
|
76
|
+
//# sourceMappingURL=disable-telemetry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disable-telemetry.js","sourceRoot":"","sources":["../../src/patches/disable-telemetry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,MAAM,KAAK,GAAU;IACnB,EAAE,EAAE,mBAAmB;IACvB,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,sCAAsC;IAEnD,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;QACjD,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;QAE3B,wEAAwE;QACxE,kFAAkF;QAClF,sEAAsE;QACtE,wEAAwE;QACxE,4CAA4C;QAC5C,EAAE;QACF,0EAA0E;QAC1E,g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KAAK,CAAC,CAAC,CAAC;QACnE,MAAM,CAAC,SAAS,CAAC,MAAM,IAAI,CAAC,EAAE,yCAAyC,CAAC,CAAC;QACzE,MAAM,UAAU,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACrC,MAAM,CAAC,UAAU,CAAC,IAAI,KAAK,gBAAgB,EACzC,+CAA+C,CAAC,CAAC;QACnD,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,GAAG,CAAC,EAAE,SAAS,CAAC,CAAC;IACnD,CAAC;CACF,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -15,3 +15,7 @@ export { default as cdCommand } from './cd-command.js';
|
|
|
15
15
|
export { default as disableTelemetry } from './disable-telemetry.js';
|
|
16
16
|
export { default as noAttribution } from './no-attribution.js';
|
|
17
17
|
export { default as noTips } from './no-tips.js';
|
|
18
|
+
export { default as simpleSpinner } from './simple-spinner.js';
|
|
19
|
+
export { default as sessionTimer } from './session-timer.js';
|
|
20
|
+
export { default as noFeedback } from './no-feedback.js';
|
|
21
|
+
export { default as sessionExport } from './session-export.js';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export { default as queue } from './queue.js';
|
|
2
|
+
export { default as banner } from './banner.js';
|
|
3
|
+
export { default as randomClawd } from './random-clawd.js';
|
|
4
|
+
export { default as alwaysShowThinking } from './always-show-thinking.js';
|
|
5
|
+
export { default as showFileInCollapsedRead } from './show-file-in-collapsed-read.js';
|
|
6
|
+
export { default as persistMaxEffort } from './persist-max-effort.js';
|
|
7
|
+
export { default as noNpmWarning } from './no-npm-warning.js';
|
|
8
|
+
export { default as cxBadge } from './cx-badge.js';
|
|
9
|
+
export { default as cxResumeCommands } from './cx-resume-commands.js';
|
|
10
|
+
export { default as reload } from './reload.js';
|
|
11
|
+
export { default as swapEnterSubmit } from './swap-enter-submit.js';
|
|
12
|
+
export { default as disablePasteCollapse } from './disable-paste-collapse.js';
|
|
13
|
+
export { default as alwaysShowContext } from './always-show-context.js';
|
|
14
|
+
export { default as cdCommand } from './cd-command.js';
|
|
15
|
+
export { default as disableTelemetry } from './disable-telemetry.js';
|
|
16
|
+
export { default as noAttribution } from './no-attribution.js';
|
|
17
|
+
export { default as noTips } from './no-tips.js';
|
|
18
|
+
export { default as simpleSpinner } from './simple-spinner.js';
|
|
19
|
+
export { default as sessionTimer } from './session-timer.js';
|
|
20
|
+
export { default as noFeedback } from './no-feedback.js';
|
|
21
|
+
export { default as sessionExport } from './session-export.js';
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/patches/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AACtF,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* No Attribution Patch
|
|
3
|
+
*
|
|
4
|
+
* Strips all Claude Code attribution from commits and PRs:
|
|
5
|
+
* - Removes "Co-Authored-By: <model> <noreply@anthropic.com>" from commits
|
|
6
|
+
* - Removes "Generated with Claude Code" from PR descriptions
|
|
7
|
+
* - Removes enhanced attribution ("X% N-shotted by ...") from PRs
|
|
8
|
+
*
|
|
9
|
+
* Works by patching getAttributionTexts() and getEnhancedPRAttribution()
|
|
10
|
+
* to return empty strings, which the prompt templates already handle
|
|
11
|
+
* gracefully via ternary guards.
|
|
12
|
+
*/
|
|
13
|
+
import type { Patch } from '../types.js';
|
|
14
|
+
declare const patch: Patch;
|
|
15
|
+
export default patch;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* No Attribution Patch
|
|
3
|
+
*
|
|
4
|
+
* Strips all Claude Code attribution from commits and PRs:
|
|
5
|
+
* - Removes "Co-Authored-By: <model> <noreply@anthropic.com>" from commits
|
|
6
|
+
* - Removes "Generated with Claude Code" from PR descriptions
|
|
7
|
+
* - Removes enhanced attribution ("X% N-shotted by ...") from PRs
|
|
8
|
+
*
|
|
9
|
+
* Works by patching getAttributionTexts() and getEnhancedPRAttribution()
|
|
10
|
+
* to return empty strings, which the prompt templates already handle
|
|
11
|
+
* gracefully via ternary guards.
|
|
12
|
+
*/
|
|
13
|
+
const patch = {
|
|
14
|
+
id: 'no-attribution',
|
|
15
|
+
name: 'No Attribution',
|
|
16
|
+
description: 'Strip Claude Code attribution from commits and PRs',
|
|
17
|
+
apply(ctx) {
|
|
18
|
+
const { ast, editor, find, index, assert } = ctx;
|
|
19
|
+
// ── getAttributionTexts ──────────────────────────────────────────
|
|
20
|
+
// Returns { commit: "Co-Authored-By: ...", pr: "Generated..." }
|
|
21
|
+
// Find via TemplateLiteral quasis containing "noreply@anthropic.com"
|
|
22
|
+
const noreplyQuasi = find.findFirst(ast, (n) => n.type === 'TemplateElement' &&
|
|
23
|
+
n.value?.cooked?.includes('noreply@anthropic.com'));
|
|
24
|
+
assert(noreplyQuasi, 'Could not find TemplateElement with noreply@anthropic.com');
|
|
25
|
+
const getAttrTexts = index.enclosingFunction(noreplyQuasi);
|
|
26
|
+
assert(getAttrTexts, 'Could not find enclosing function for noreply quasi');
|
|
27
|
+
assert(getAttrTexts.body.type === 'BlockStatement', 'getAttributionTexts body is not a BlockStatement');
|
|
28
|
+
// Insert early return at start of function body
|
|
29
|
+
editor.insertAt(getAttrTexts.body.start + 1, 'return{commit:"",pr:""};');
|
|
30
|
+
// ── getEnhancedPRAttribution ─────────────────────────────────────
|
|
31
|
+
// Returns "Generated with Claude Code (X% N-shotted by ...)"
|
|
32
|
+
// Find via the unique debug string literal it contains
|
|
33
|
+
const enhancedFns = index.findFunctionsContainingStrings(ast, 'PR Attribution: returning default (no data)');
|
|
34
|
+
assert(enhancedFns.length >= 1, 'Could not find getEnhancedPRAttribution (PR Attribution debug string)');
|
|
35
|
+
const getEnhanced = enhancedFns[0];
|
|
36
|
+
assert(getEnhanced.body.type === 'BlockStatement', 'getEnhancedPRAttribution body is not a BlockStatement');
|
|
37
|
+
// Insert early return (async fn, so return "" resolves to Promise<"">)
|
|
38
|
+
editor.insertAt(getEnhanced.body.start + 1, 'return"";');
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
export default patch;
|
|
42
|
+
//# sourceMappingURL=no-attribution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-attribution.js","sourceRoot":"","sources":["../../src/patches/no-attribution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,MAAM,KAAK,GAAU;IACnB,EAAE,EAAE,gBAAgB;IACpB,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,oDAAoD;IAEjE,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;QAEjD,oEAAoE;QACpE,gEAAgE;QAChE,qEAAqE;QAErE,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,CAAM,EAAE,EAAE,CAClD,CAAC,CAAC,IAAI,KAAK,iBAAiB;YAC5B,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,uBAAuB,CAAC,CAAC,CAAC;QACtD,MAAM,CAAC,YAAY,EAAE,2DAA2D,CAAC,CAAC;QAElF,MAAM,YAAY,GAAG,KAAK,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;QAC3D,MAAM,CAAC,YAAY,EAAE,qDAAqD,CAAC,CAAC;QAC5E,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,KAAK,gBAAgB,EAChD,kDAAkD,CAAC,CAAC;QAEtD,gDAAgD;QAChD,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,EAAE,0BAA0B,CAAC,CAAC;QAEzE,oEAAoE;QACpE,6DAA6D;QAC7D,uDAAuD;QAEvD,MAAM,WAAW,GAAG,KAAK,CAAC,8BAA8B,CACtD,GAAG,EAAE,6CAA6C,CAAC,CAAC;QACtD,MAAM,CAAC,WAAW,CAAC,MAAM,IAAI,CAAC,EAC5B,uEAAuE,CAAC,CAAC;QAE3E,MAAM,WAAW,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;QACnC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,KAAK,gBAAgB,EAC/C,uDAAuD,CAAC,CAAC;QAE3D,uEAAuE;QACvE,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,EAAE,WAAW,CAAC,CAAC;IAC3D,CAAC;CACF,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* No Feedback Patch
|
|
3
|
+
*
|
|
4
|
+
* Strips all feedback survey prompts from Claude Code. The FeedbackSurvey
|
|
5
|
+
* component renders session ratings ("How is Claude doing this session?"),
|
|
6
|
+
* post-compact surveys, memory surveys, transcript share prompts, and
|
|
7
|
+
* frustration detection prompts. Patching this single component to
|
|
8
|
+
* return null silences all of them.
|
|
9
|
+
*/
|
|
10
|
+
import type { Patch } from '../types.js';
|
|
11
|
+
declare const patch: Patch;
|
|
12
|
+
export default patch;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* No Feedback Patch
|
|
3
|
+
*
|
|
4
|
+
* Strips all feedback survey prompts from Claude Code. The FeedbackSurvey
|
|
5
|
+
* component renders session ratings ("How is Claude doing this session?"),
|
|
6
|
+
* post-compact surveys, memory surveys, transcript share prompts, and
|
|
7
|
+
* frustration detection prompts. Patching this single component to
|
|
8
|
+
* return null silences all of them.
|
|
9
|
+
*/
|
|
10
|
+
const patch = {
|
|
11
|
+
id: 'no-feedback',
|
|
12
|
+
name: 'No Feedback Prompts',
|
|
13
|
+
description: 'Remove feedback survey prompts',
|
|
14
|
+
apply(ctx) {
|
|
15
|
+
const { ast, editor, query, assert } = ctx;
|
|
16
|
+
// The FeedbackSurvey component contains the unique string
|
|
17
|
+
// " Thanks for sharing your transcript!" (with leading space) in
|
|
18
|
+
// its JSX. Find the smallest function containing that marker.
|
|
19
|
+
const marker = ' Thanks for sharing your transcript!';
|
|
20
|
+
const candidates = query.findFunctionsContainingStrings(ast, marker);
|
|
21
|
+
assert(candidates.length > 0, `Could not find FeedbackSurvey component (marker: "${marker}")`);
|
|
22
|
+
// Take the smallest function (the component itself, not a wrapper).
|
|
23
|
+
const fn = candidates
|
|
24
|
+
.sort((a, b) => (a.end - a.start) - (b.end - b.start))[0];
|
|
25
|
+
assert(fn.body?.type === 'BlockStatement', 'FeedbackSurvey: expected block body');
|
|
26
|
+
// Inject early return so the component always renders nothing.
|
|
27
|
+
editor.insertAt(fn.body.start + 1, 'return null;');
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
export default patch;
|
|
31
|
+
//# sourceMappingURL=no-feedback.js.map
|