@ranger-testing/ranger-cli 2.0.5 → 2.0.7

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 (116) hide show
  1. package/build/cli.js +1 -914
  2. package/build/commands/addEnv.js +1 -1
  3. package/build/commands/authEncrypt.js +1 -36
  4. package/build/commands/clean.js +1 -1
  5. package/build/commands/config.js +1 -93
  6. package/build/commands/env.js +1 -98
  7. package/build/commands/feature.js +1 -653
  8. package/build/commands/hook.js +1 -33
  9. package/build/commands/hooks/autoPrompt.js +1 -32
  10. package/build/commands/hooks/disable.js +1 -33
  11. package/build/commands/hooks/enable.js +1 -58
  12. package/build/commands/hooks/exitPlanMode.js +1 -35
  13. package/build/commands/hooks/index.js +1 -12
  14. package/build/commands/hooks/output.js +1 -71
  15. package/build/commands/hooks/planReminder.js +1 -46
  16. package/build/commands/hooks/planStart.js +1 -30
  17. package/build/commands/hooks/postEdit.js +1 -43
  18. package/build/commands/hooks/preCompact.js +1 -30
  19. package/build/commands/hooks/sessionEnd.js +1 -25
  20. package/build/commands/hooks/sessionStart.js +1 -93
  21. package/build/commands/hooks/stopHook.js +1 -155
  22. package/build/commands/index.js +1 -12
  23. package/build/commands/login.js +1 -26
  24. package/build/commands/setupCi.js +1 -189
  25. package/build/commands/skillup.js +1 -80
  26. package/build/commands/start.js +1 -1
  27. package/build/commands/status.js +1 -198
  28. package/build/commands/update.js +1 -182
  29. package/build/commands/updateEnv.js +1 -1
  30. package/build/commands/useEnv.js +1 -1
  31. package/build/commands/utils/activeProfile.js +1 -76
  32. package/build/commands/utils/browserSessionsApi.js +1 -1
  33. package/build/commands/utils/claudeConfig.js +1 -73
  34. package/build/commands/utils/claudePlugin.js +1 -85
  35. package/build/commands/utils/crypto.js +1 -42
  36. package/build/commands/utils/desirePathLog.js +1 -139
  37. package/build/commands/utils/deviceAuth.js +1 -232
  38. package/build/commands/utils/environment.js +1 -65
  39. package/build/commands/utils/featureApi.js +1 -371
  40. package/build/commands/utils/featureReportGenerator.js +1 -204
  41. package/build/commands/utils/fixWebmDuration.js +1 -0
  42. package/build/commands/utils/git.js +1 -44
  43. package/build/commands/utils/keychain.js +1 -1
  44. package/build/commands/utils/localAgentInstallationsApi.js +1 -1
  45. package/build/commands/utils/profileMessages.js +1 -8
  46. package/build/commands/utils/profileSetupBanner.js +1 -167
  47. package/build/commands/utils/rangerRoot.js +1 -60
  48. package/build/commands/utils/reportGenerator.js +1 -130
  49. package/build/commands/utils/retry.js +1 -25
  50. package/build/commands/utils/sessionCache.js +1 -299
  51. package/build/commands/utils/settings.js +1 -313
  52. package/build/commands/utils/skillContent.js +1 -28
  53. package/build/commands/utils/skills.js +1 -1
  54. package/build/commands/utils/telemetry.js +1 -254
  55. package/build/commands/utils/userApi.js +1 -32
  56. package/build/commands/utils/version.js +1 -62
  57. package/build/commands/verifyFeature.js +1 -1343
  58. package/build/commands/verifyInBrowser.js +1 -1
  59. package/package.json +4 -1
  60. package/build/cli.js.map +0 -1
  61. package/build/commands/addEnv.js.map +0 -1
  62. package/build/commands/authEncrypt.js.map +0 -1
  63. package/build/commands/clean.js.map +0 -1
  64. package/build/commands/config.js.map +0 -1
  65. package/build/commands/env.js.map +0 -1
  66. package/build/commands/feature.js.map +0 -1
  67. package/build/commands/hook.js.map +0 -1
  68. package/build/commands/hooks/autoPrompt.js.map +0 -1
  69. package/build/commands/hooks/disable.js.map +0 -1
  70. package/build/commands/hooks/enable.js.map +0 -1
  71. package/build/commands/hooks/exitPlanMode.js.map +0 -1
  72. package/build/commands/hooks/index.js.map +0 -1
  73. package/build/commands/hooks/output.js.map +0 -1
  74. package/build/commands/hooks/planReminder.js.map +0 -1
  75. package/build/commands/hooks/planStart.js.map +0 -1
  76. package/build/commands/hooks/postEdit.js.map +0 -1
  77. package/build/commands/hooks/preCompact.js.map +0 -1
  78. package/build/commands/hooks/sessionEnd.js.map +0 -1
  79. package/build/commands/hooks/sessionStart.js.map +0 -1
  80. package/build/commands/hooks/stopHook.js.map +0 -1
  81. package/build/commands/index.js.map +0 -1
  82. package/build/commands/login.js.map +0 -1
  83. package/build/commands/setupCi.js.map +0 -1
  84. package/build/commands/skillup.js.map +0 -1
  85. package/build/commands/start.js.map +0 -1
  86. package/build/commands/status.js.map +0 -1
  87. package/build/commands/update.js.map +0 -1
  88. package/build/commands/updateEnv.js.map +0 -1
  89. package/build/commands/useEnv.js.map +0 -1
  90. package/build/commands/utils/activeProfile.js.map +0 -1
  91. package/build/commands/utils/browserSessionsApi.js.map +0 -1
  92. package/build/commands/utils/claudeConfig.js.map +0 -1
  93. package/build/commands/utils/claudePlugin.js.map +0 -1
  94. package/build/commands/utils/crypto.js.map +0 -1
  95. package/build/commands/utils/desirePathLog.js.map +0 -1
  96. package/build/commands/utils/deviceAuth.js.map +0 -1
  97. package/build/commands/utils/environment.js.map +0 -1
  98. package/build/commands/utils/featureApi.js.map +0 -1
  99. package/build/commands/utils/featureReportGenerator.js.map +0 -1
  100. package/build/commands/utils/git.js.map +0 -1
  101. package/build/commands/utils/keychain.js.map +0 -1
  102. package/build/commands/utils/localAgentInstallationsApi.js.map +0 -1
  103. package/build/commands/utils/profileMessages.js.map +0 -1
  104. package/build/commands/utils/profileSetupBanner.js.map +0 -1
  105. package/build/commands/utils/rangerRoot.js.map +0 -1
  106. package/build/commands/utils/reportGenerator.js.map +0 -1
  107. package/build/commands/utils/retry.js.map +0 -1
  108. package/build/commands/utils/sessionCache.js.map +0 -1
  109. package/build/commands/utils/settings.js.map +0 -1
  110. package/build/commands/utils/skillContent.js.map +0 -1
  111. package/build/commands/utils/skills.js.map +0 -1
  112. package/build/commands/utils/telemetry.js.map +0 -1
  113. package/build/commands/utils/userApi.js.map +0 -1
  114. package/build/commands/utils/version.js.map +0 -1
  115. package/build/commands/verifyFeature.js.map +0 -1
  116. package/build/commands/verifyInBrowser.js.map +0 -1
@@ -1,25 +1 @@
1
- const DEFAULT_MAX_RETRIES = 3;
2
- const DEFAULT_BASE_DELAY_MS = 500;
3
- export async function withRetry(fn, options) {
4
- const maxRetries = options?.maxRetries ?? DEFAULT_MAX_RETRIES;
5
- const baseDelay = options?.baseDelayMs ?? DEFAULT_BASE_DELAY_MS;
6
- let lastError;
7
- for (let attempt = 0; attempt <= maxRetries; attempt++) {
8
- try {
9
- return await fn();
10
- }
11
- catch (error) {
12
- lastError =
13
- error instanceof Error ? error : new Error(String(error));
14
- if (attempt < maxRetries) {
15
- const delay = baseDelay * Math.pow(2, attempt);
16
- if (options?.label) {
17
- console.error(`${options.label} failed (attempt ${attempt + 1}/${maxRetries + 1}), retrying in ${delay}ms...`);
18
- }
19
- await new Promise((resolve) => setTimeout(resolve, delay));
20
- }
21
- }
22
- }
23
- throw lastError;
24
- }
25
- //# sourceMappingURL=retry.js.map
1
+ (function(_0x29ad81,_0x4c62be){const _0xb079a2=_0x3d29,_0x3360ba=_0x29ad81();while(!![]){try{const _0x1f64ee=-parseInt(_0xb079a2(0xaf))/0x1*(-parseInt(_0xb079a2(0xaa))/0x2)+-parseInt(_0xb079a2(0xa9))/0x3*(parseInt(_0xb079a2(0xa8))/0x4)+parseInt(_0xb079a2(0xb2))/0x5*(parseInt(_0xb079a2(0xa5))/0x6)+-parseInt(_0xb079a2(0xa6))/0x7*(parseInt(_0xb079a2(0xb1))/0x8)+-parseInt(_0xb079a2(0xb3))/0x9+parseInt(_0xb079a2(0xa7))/0xa*(-parseInt(_0xb079a2(0xac))/0xb)+parseInt(_0xb079a2(0xb0))/0xc;if(_0x1f64ee===_0x4c62be)break;else _0x3360ba['push'](_0x3360ba['shift']());}catch(_0x10d47e){_0x3360ba['push'](_0x3360ba['shift']());}}}(_0x5ec9,0xbf5e9));function _0x3d29(_0x3f73bb,_0x1e8a5){_0x3f73bb=_0x3f73bb-0xa4;const _0x5ec9cc=_0x5ec9();let _0x3d2916=_0x5ec9cc[_0x3f73bb];return _0x3d2916;}const DEFAULT_MAX_RETRIES=0x3,DEFAULT_BASE_DELAY_MS=0x1f4;function _0x5ec9(){const _0x3f95fd=['6lrjfon','234444wYTAEw','15475190PCgfUj','6988Klfzkw','2361IsGTxQ','12rGZtvG','aXZOd','11jRpkYc','pow','baseDelayMs','192264rjdTWH','45464100OAVHss','256aJSNby','281915JTBfSt','1985769quEFfI','ms...','\x20failed\x20(attempt\x20','label','error'];_0x5ec9=function(){return _0x3f95fd;};return _0x5ec9();}export async function withRetry(_0xc26e33,_0x29a442){const _0x40a4e3=_0x3d29,_0x33f484={'aySEd':function(_0x2a1173,_0x25b9b8){return _0x2a1173<=_0x25b9b8;},'tPqon':function(_0x14283b,_0x5bd5be){return _0x14283b*_0x5bd5be;},'aXZOd':function(_0x3857c6,_0x1ee890){return _0x3857c6+_0x1ee890;}},_0x289ece=_0x29a442?.['maxRetries']??DEFAULT_MAX_RETRIES,_0x23c098=_0x29a442?.[_0x40a4e3(0xae)]??DEFAULT_BASE_DELAY_MS;let _0x13b706;for(let _0x1454d2=0x0;_0x33f484['aySEd'](_0x1454d2,_0x289ece);_0x1454d2++){try{return await _0xc26e33();}catch(_0x489134){_0x13b706=_0x489134 instanceof Error?_0x489134:new Error(String(_0x489134));if(_0x1454d2<_0x289ece){const _0x1fc8b5=_0x33f484['tPqon'](_0x23c098,Math[_0x40a4e3(0xad)](0x2,_0x1454d2));_0x29a442?.['label']&&console[_0x40a4e3(0xa4)](_0x29a442[_0x40a4e3(0xb6)]+_0x40a4e3(0xb5)+_0x33f484[_0x40a4e3(0xab)](_0x1454d2,0x1)+'/'+(_0x289ece+0x1)+'),\x20retrying\x20in\x20'+_0x1fc8b5+_0x40a4e3(0xb4)),await new Promise(_0x406919=>setTimeout(_0x406919,_0x1fc8b5));}}}throw _0x13b706;}
@@ -1,299 +1 @@
1
- import * as fs from 'fs';
2
- import * as path from 'path';
3
- import * as os from 'os';
4
- import { execSync } from 'child_process';
5
- const CACHE_FILE = path.join(os.homedir(), '.claude', '.ranger_cache.json');
6
- function createEmptyCache() {
7
- return { version: 3, sessions: {}, branches: {} };
8
- }
9
- function loadCache() {
10
- try {
11
- if (fs.existsSync(CACHE_FILE)) {
12
- const data = JSON.parse(fs.readFileSync(CACHE_FILE, 'utf-8'));
13
- return {
14
- version: 3,
15
- sessions: data.sessions || {},
16
- branches: data.branches || {},
17
- lastEnabledSessionClearedAt: data.lastEnabledSessionClearedAt,
18
- };
19
- }
20
- }
21
- catch {
22
- // Ignore errors
23
- }
24
- return createEmptyCache();
25
- }
26
- function saveCache(cache) {
27
- try {
28
- const dir = path.dirname(CACHE_FILE);
29
- if (!fs.existsSync(dir)) {
30
- fs.mkdirSync(dir, { recursive: true });
31
- }
32
- fs.writeFileSync(CACHE_FILE, JSON.stringify(cache, null, 2));
33
- }
34
- catch {
35
- // Ignore errors
36
- }
37
- }
38
- // ============ Git Helpers ============
39
- /**
40
- * Get the current git branch name.
41
- * Returns null if not in a git repo, in detached HEAD state, or on error.
42
- */
43
- export function getCurrentBranch() {
44
- try {
45
- const branch = execSync('git rev-parse --abbrev-ref HEAD', {
46
- encoding: 'utf-8',
47
- stdio: ['pipe', 'pipe', 'pipe'],
48
- }).trim();
49
- // Return null for empty string or detached HEAD state
50
- if (!branch || branch === 'HEAD') {
51
- return null;
52
- }
53
- return branch;
54
- }
55
- catch {
56
- return null;
57
- }
58
- }
59
- // ============ Branch Functions ============
60
- /**
61
- * Enable Ranger for a branch (persists across sessions)
62
- */
63
- export function enableBranch(branchName) {
64
- const cache = loadCache();
65
- cache.branches[branchName] = true;
66
- saveCache(cache);
67
- }
68
- /**
69
- * Disable Ranger for a branch
70
- */
71
- export function disableBranch(branchName) {
72
- const cache = loadCache();
73
- delete cache.branches[branchName];
74
- saveCache(cache);
75
- }
76
- /**
77
- * Check if Ranger is enabled for a branch
78
- */
79
- export function isBranchEnabled(branchName) {
80
- const cache = loadCache();
81
- return cache.branches[branchName] === true;
82
- }
83
- // ============ Session Functions ============
84
- /**
85
- * Get session entry, creating if needed
86
- */
87
- function getOrCreateSession(cache, sessionId) {
88
- if (!cache.sessions[sessionId]) {
89
- cache.sessions[sessionId] = {};
90
- }
91
- return cache.sessions[sessionId];
92
- }
93
- /**
94
- * Enable Ranger hooks for a Claude session.
95
- * If on a non-main branch, also enables that branch.
96
- */
97
- export function enableSession(claudeSessionId) {
98
- const cache = loadCache();
99
- const session = getOrCreateSession(cache, claudeSessionId);
100
- session.enabled = true;
101
- // Auto-enable branch if not on main
102
- const branch = getCurrentBranch();
103
- if (branch && branch !== 'main' && branch !== 'master') {
104
- cache.branches[branch] = true;
105
- session.currentBranch = branch;
106
- }
107
- saveCache(cache);
108
- }
109
- /**
110
- * Check if Ranger hooks are enabled for a Claude session.
111
- * - On main/master: only checks session-level enabled flag
112
- * - On other branches: enabled if branch is enabled OR session is enabled
113
- */
114
- export function isSessionEnabled(claudeSessionId) {
115
- const cache = loadCache();
116
- const branch = getCurrentBranch();
117
- // On main/master, only session-level enabling works
118
- if (!branch || branch === 'main' || branch === 'master') {
119
- return cache.sessions[claudeSessionId]?.enabled === true;
120
- }
121
- // On other branches: enabled if branch is enabled OR session is enabled
122
- const branchEnabled = cache.branches[branch] === true;
123
- const sessionEnabled = cache.sessions[claudeSessionId]?.enabled === true;
124
- return branchEnabled || sessionEnabled;
125
- }
126
- /**
127
- * Disable Ranger hooks for a Claude session
128
- */
129
- export function disableSession(claudeSessionId) {
130
- const cache = loadCache();
131
- const session = getOrCreateSession(cache, claudeSessionId);
132
- session.enabled = false;
133
- saveCache(cache);
134
- }
135
- /**
136
- * Update branch tracking on PostToolUse.
137
- * If session is enabled and switched to a new non-main branch, auto-enable it.
138
- */
139
- export function updateBranchTracking(claudeSessionId) {
140
- const cache = loadCache();
141
- const session = cache.sessions[claudeSessionId];
142
- if (!session?.enabled) {
143
- return;
144
- }
145
- const branch = getCurrentBranch();
146
- if (!branch || branch === 'main' || branch === 'master') {
147
- return;
148
- }
149
- // If we switched branches while enabled, auto-enable the new branch
150
- if (session.currentBranch !== branch) {
151
- cache.branches[branch] = true;
152
- session.currentBranch = branch;
153
- saveCache(cache);
154
- }
155
- }
156
- /**
157
- * Initialize branch tracking on session start.
158
- * If starting on an already-enabled branch, auto-enable the session.
159
- */
160
- export function initBranchTracking(claudeSessionId) {
161
- const cache = loadCache();
162
- const branch = getCurrentBranch();
163
- if (!branch || branch === 'main' || branch === 'master') {
164
- return;
165
- }
166
- // If branch is already enabled, auto-enable this session
167
- if (cache.branches[branch] === true) {
168
- const session = getOrCreateSession(cache, claudeSessionId);
169
- session.enabled = true;
170
- session.currentBranch = branch;
171
- saveCache(cache);
172
- }
173
- }
174
- // ============ Session Clear Tracking ============
175
- const CLEAR_AUTO_ENABLE_WINDOW_MS = 5000; // 5 seconds
176
- /**
177
- * Record that an enabled session was cleared.
178
- * Called on SessionEnd with reason === 'clear' if session was enabled.
179
- */
180
- export function recordEnabledSessionCleared(claudeSessionId) {
181
- const cache = loadCache();
182
- const session = cache.sessions[claudeSessionId];
183
- // Only record if the session was enabled
184
- if (session?.enabled) {
185
- cache.lastEnabledSessionClearedAt = Date.now();
186
- saveCache(cache);
187
- }
188
- }
189
- /**
190
- * Check if we should auto-enable due to a recent clear.
191
- * Returns true if source is 'clear' and within window of last enabled session clear.
192
- */
193
- export function shouldAutoEnableAfterClear(source) {
194
- if (source !== 'clear') {
195
- return false;
196
- }
197
- const cache = loadCache();
198
- const lastCleared = cache.lastEnabledSessionClearedAt;
199
- if (!lastCleared) {
200
- return false;
201
- }
202
- const elapsed = Date.now() - lastCleared;
203
- return elapsed <= CLEAR_AUTO_ENABLE_WINDOW_MS;
204
- }
205
- /**
206
- * Auto-enable a session after clear (preserves enabled state across /clear).
207
- */
208
- export function autoEnableAfterClear(claudeSessionId) {
209
- const cache = loadCache();
210
- const session = getOrCreateSession(cache, claudeSessionId);
211
- session.enabled = true;
212
- // Also track current branch
213
- const branch = getCurrentBranch();
214
- if (branch && branch !== 'main' && branch !== 'master') {
215
- session.currentBranch = branch;
216
- }
217
- // Clear the timestamp so we don't re-trigger
218
- delete cache.lastEnabledSessionClearedAt;
219
- saveCache(cache);
220
- }
221
- /**
222
- * Register a Claude session as working on a Ranger feature
223
- */
224
- export function registerSession(claudeSessionId, featureId) {
225
- const cache = loadCache();
226
- const session = getOrCreateSession(cache, claudeSessionId);
227
- session.featureId = featureId;
228
- session.registeredAt = new Date().toISOString();
229
- saveCache(cache);
230
- }
231
- /**
232
- * Get the feature info for a Claude session
233
- */
234
- export function getSessionEntry(claudeSessionId) {
235
- const cache = loadCache();
236
- const session = cache.sessions[claudeSessionId];
237
- if (session?.featureId && session?.registeredAt) {
238
- return {
239
- featureId: session.featureId,
240
- registeredAt: session.registeredAt,
241
- };
242
- }
243
- return null;
244
- }
245
- /**
246
- * Unregister a Claude session from its feature
247
- */
248
- export function unregisterSession(claudeSessionId) {
249
- const cache = loadCache();
250
- const session = cache.sessions[claudeSessionId];
251
- if (session) {
252
- delete session.featureId;
253
- delete session.registeredAt;
254
- saveCache(cache);
255
- }
256
- }
257
- // ============ Plan Reminder Functions ============
258
- const PLAN_REMINDER_INTERVAL_MS = 5 * 60 * 1000; // 5 minutes
259
- /**
260
- * Check if plan reminder should be shown (rate-limited to once per 5 min per session)
261
- * Returns true if reminder should be shown, and updates the timestamp.
262
- */
263
- export function shouldShowPlanReminder(claudeSessionId) {
264
- const cache = loadCache();
265
- const session = getOrCreateSession(cache, claudeSessionId);
266
- const lastShown = session.lastPlanReminderAt || 0;
267
- const now = Date.now();
268
- if (now - lastShown >= PLAN_REMINDER_INTERVAL_MS) {
269
- session.lastPlanReminderAt = now;
270
- saveCache(cache);
271
- return true;
272
- }
273
- return false;
274
- }
275
- // ============ Auto-Prompt Functions ============
276
- /**
277
- * Check if the auto-prompt has already been shown for this session.
278
- */
279
- export function hasSessionBeenPrompted(claudeSessionId) {
280
- const cache = loadCache();
281
- return cache.sessions[claudeSessionId]?.prompted === true;
282
- }
283
- /**
284
- * Mark that the auto-prompt has been shown for this session.
285
- */
286
- export function markSessionPrompted(claudeSessionId) {
287
- const cache = loadCache();
288
- const session = getOrCreateSession(cache, claudeSessionId);
289
- session.prompted = true;
290
- saveCache(cache);
291
- }
292
- // ============ Cache Management ============
293
- /**
294
- * Get the cache file path (for cleanup)
295
- */
296
- export function getCacheFile() {
297
- return CACHE_FILE;
298
- }
299
- //# sourceMappingURL=sessionCache.js.map
1
+ function _0xf6a7(){const _0x4e43bc=['parse','lastEnabledSessionClearedAt','czyHg','toISOString','440573leNdOm','readFileSync','30636lcVfWW','330255camkSE','git\x20rev-parse\x20--abbrev-ref\x20HEAD','TZxVW','18vfDBLN','kkpwK','6aDcUWw','stringify','writeFileSync','branches','LLngE','646296fEZije','lastPlanReminderAt','4AhMuLf','laqJC','132256godbCo','lpqSD','utf-8','.ranger_cache.json','mXeSb','nnGRb','ggozm','TCBSx','CXhbg','DPuCC','riknZ','LqaRD','sessions','main','pipe','trim','registeredAt','2494390VznBJp','featureId','master','enabled','96582PniEJk','currentBranch'];_0xf6a7=function(){return _0x4e43bc;};return _0xf6a7();}const _0x3d3c6e=_0x2129;(function(_0x13f54e,_0x386efc){const _0x2eb5a8=_0x2129,_0x5055d3=_0x13f54e();while(!![]){try{const _0x48767c=parseInt(_0x2eb5a8(0xb2))/0x1+-parseInt(_0x2eb5a8(0xbf))/0x2*(-parseInt(_0x2eb5a8(0xaa))/0x3)+parseInt(_0x2eb5a8(0xbd))/0x4+parseInt(_0x2eb5a8(0xb3))/0x5+parseInt(_0x2eb5a8(0xb8))/0x6*(parseInt(_0x2eb5a8(0xb0))/0x7)+-parseInt(_0x2eb5a8(0xc1))/0x8*(parseInt(_0x2eb5a8(0xb6))/0x9)+-parseInt(_0x2eb5a8(0xd2))/0xa;if(_0x48767c===_0x386efc)break;else _0x5055d3['push'](_0x5055d3['shift']());}catch(_0xaf0fc5){_0x5055d3['push'](_0x5055d3['shift']());}}}(_0xf6a7,0x192ad));import*as _0x23b163 from'fs';import*as _0x1b0f68 from'path';import*as _0x24a8c2 from'os';import{execSync}from'child_process';const CACHE_FILE=_0x1b0f68['join'](_0x24a8c2['homedir'](),'.claude',_0x3d3c6e(0xc4));function createEmptyCache(){return{'version':0x3,'sessions':{},'branches':{}};}function _0x2129(_0x29cfcf,_0x3d6db4){_0x29cfcf=_0x29cfcf-0xaa;const _0xf6a744=_0xf6a7();let _0x2129b4=_0xf6a744[_0x29cfcf];return _0x2129b4;}function loadCache(){const _0x750d9=_0x3d3c6e,_0x146548={'vlPIJ':'utf-8','riknZ':function(_0x407baf){return _0x407baf();}};try{if(_0x23b163['existsSync'](CACHE_FILE)){const _0x445ed9=JSON[_0x750d9(0xac)](_0x23b163[_0x750d9(0xb1)](CACHE_FILE,_0x146548['vlPIJ']));return{'version':0x3,'sessions':_0x445ed9[_0x750d9(0xcd)]||{},'branches':_0x445ed9['branches']||{},'lastEnabledSessionClearedAt':_0x445ed9['lastEnabledSessionClearedAt']};}}catch{}return _0x146548[_0x750d9(0xcb)](createEmptyCache);}function saveCache(_0x3e5866){const _0x446425=_0x3d3c6e;try{const _0x4031c=_0x1b0f68['dirname'](CACHE_FILE);!_0x23b163['existsSync'](_0x4031c)&&_0x23b163['mkdirSync'](_0x4031c,{'recursive':!![]}),_0x23b163[_0x446425(0xba)](CACHE_FILE,JSON[_0x446425(0xb9)](_0x3e5866,null,0x2));}catch{}}export function getCurrentBranch(){const _0x53160f=_0x3d3c6e,_0x3aec99={'LLngE':_0x53160f(0xb4),'zUNEG':_0x53160f(0xcf),'TKhXX':function(_0x11e32d,_0x2e553e){return _0x11e32d===_0x2e553e;}};try{const _0x547817=execSync(_0x3aec99[_0x53160f(0xbc)],{'encoding':_0x53160f(0xc3),'stdio':['pipe','pipe',_0x3aec99['zUNEG']]})[_0x53160f(0xd0)]();if(!_0x547817||_0x3aec99['TKhXX'](_0x547817,'HEAD'))return null;return _0x547817;}catch{return null;}}export function enableBranch(_0x11b792){const _0x149830=_0x3d3c6e,_0x57f0aa=loadCache();_0x57f0aa[_0x149830(0xbb)][_0x11b792]=!![],saveCache(_0x57f0aa);}export function disableBranch(_0x36dddc){const _0x3ed9f6=loadCache();delete _0x3ed9f6['branches'][_0x36dddc],saveCache(_0x3ed9f6);}export function isBranchEnabled(_0x4338e4){const _0x232ec4=_0x3d3c6e,_0x3614b8={'lpqSD':function(_0x4514c7,_0x22553d){return _0x4514c7===_0x22553d;}},_0x33a4ab=loadCache();return _0x3614b8[_0x232ec4(0xc2)](_0x33a4ab[_0x232ec4(0xbb)][_0x4338e4],!![]);}function getOrCreateSession(_0x1dd52e,_0x4da962){const _0x240437=_0x3d3c6e;return!_0x1dd52e[_0x240437(0xcd)][_0x4da962]&&(_0x1dd52e[_0x240437(0xcd)][_0x4da962]={}),_0x1dd52e['sessions'][_0x4da962];}export function enableSession(_0x3a1c7e){const _0x37a30d=_0x3d3c6e,_0x3cf6e9={'oXlnI':function(_0x389cc8){return _0x389cc8();},'JXqpj':_0x37a30d(0xce)},_0x3371e2=_0x3cf6e9['oXlnI'](loadCache),_0x2c413c=getOrCreateSession(_0x3371e2,_0x3a1c7e);_0x2c413c['enabled']=!![];const _0xc8ea4d=getCurrentBranch();_0xc8ea4d&&_0xc8ea4d!==_0x3cf6e9['JXqpj']&&_0xc8ea4d!=='master'&&(_0x3371e2[_0x37a30d(0xbb)][_0xc8ea4d]=!![],_0x2c413c['currentBranch']=_0xc8ea4d),saveCache(_0x3371e2);}export function isSessionEnabled(_0x24a8f9){const _0x238e18=_0x3d3c6e,_0x4a8956={'Uiqao':'main','kkpwK':'master','yAxjs':function(_0x385b70,_0xefbda5){return _0x385b70===_0xefbda5;}},_0x8b9029=loadCache(),_0x5bd5f2=getCurrentBranch();if(!_0x5bd5f2||_0x5bd5f2===_0x4a8956['Uiqao']||_0x5bd5f2===_0x4a8956[_0x238e18(0xb7)])return _0x8b9029['sessions'][_0x24a8f9]?.['enabled']===!![];const _0x54891b=_0x8b9029[_0x238e18(0xbb)][_0x5bd5f2]===!![],_0x6ced74=_0x4a8956['yAxjs'](_0x8b9029['sessions'][_0x24a8f9]?.['enabled'],!![]);return _0x54891b||_0x6ced74;}export function disableSession(_0x5d9142){const _0x54d58c=_0x3d3c6e,_0x26bdf7=loadCache(),_0xc59195=getOrCreateSession(_0x26bdf7,_0x5d9142);_0xc59195[_0x54d58c(0xd5)]=![],saveCache(_0x26bdf7);}export function updateBranchTracking(_0x2912d5){const _0x2fe4be=_0x3d3c6e,_0x3c9f0b={'umIbs':function(_0x19aa80){return _0x19aa80();},'TZxVW':function(_0xade8fa){return _0xade8fa();},'laqJC':function(_0x49281e,_0x17f92a){return _0x49281e===_0x17f92a;}},_0x5ba6cd=_0x3c9f0b['umIbs'](loadCache),_0x296864=_0x5ba6cd[_0x2fe4be(0xcd)][_0x2912d5];if(!_0x296864?.['enabled'])return;const _0x592ba5=_0x3c9f0b[_0x2fe4be(0xb5)](getCurrentBranch);if(!_0x592ba5||_0x3c9f0b[_0x2fe4be(0xc0)](_0x592ba5,'main')||_0x3c9f0b[_0x2fe4be(0xc0)](_0x592ba5,_0x2fe4be(0xd4)))return;_0x296864[_0x2fe4be(0xab)]!==_0x592ba5&&(_0x5ba6cd[_0x2fe4be(0xbb)][_0x592ba5]=!![],_0x296864['currentBranch']=_0x592ba5,saveCache(_0x5ba6cd));}export function initBranchTracking(_0x24ad23){const _0x89e749=_0x3d3c6e,_0x3967f2={'ZDbwg':function(_0x4c6475){return _0x4c6475();},'mXeSb':function(_0x389e74,_0x224877,_0x3ca871){return _0x389e74(_0x224877,_0x3ca871);}},_0x54fc33=loadCache(),_0x486f1c=_0x3967f2['ZDbwg'](getCurrentBranch);if(!_0x486f1c||_0x486f1c==='main'||_0x486f1c===_0x89e749(0xd4))return;if(_0x54fc33['branches'][_0x486f1c]===!![]){const _0x169e9b=_0x3967f2[_0x89e749(0xc5)](getOrCreateSession,_0x54fc33,_0x24ad23);_0x169e9b[_0x89e749(0xd5)]=!![],_0x169e9b[_0x89e749(0xab)]=_0x486f1c,saveCache(_0x54fc33);}}const CLEAR_AUTO_ENABLE_WINDOW_MS=0x1388;export function recordEnabledSessionCleared(_0x303dd4){const _0x292123=_0x3d3c6e,_0x26a9f8={'Jevzl':function(_0x2fd7f2){return _0x2fd7f2();},'WpxSt':function(_0x21b96e,_0x4af822){return _0x21b96e(_0x4af822);}},_0xcdaa59=_0x26a9f8['Jevzl'](loadCache),_0x3dfe4b=_0xcdaa59[_0x292123(0xcd)][_0x303dd4];_0x3dfe4b?.[_0x292123(0xd5)]&&(_0xcdaa59[_0x292123(0xad)]=Date['now'](),_0x26a9f8['WpxSt'](saveCache,_0xcdaa59));}export function shouldAutoEnableAfterClear(_0x2792fc){const _0xbfbc68=_0x3d3c6e,_0xf9f02e={'czyHg':function(_0x42ab63,_0x2b60a3){return _0x42ab63!==_0x2b60a3;},'oQyEo':function(_0x42cc47,_0x42dcf4){return _0x42cc47<=_0x42dcf4;}};if(_0xf9f02e[_0xbfbc68(0xae)](_0x2792fc,'clear'))return![];const _0x4deeac=loadCache(),_0x28c627=_0x4deeac['lastEnabledSessionClearedAt'];if(!_0x28c627)return![];const _0x90b59f=Date['now']()-_0x28c627;return _0xf9f02e['oQyEo'](_0x90b59f,CLEAR_AUTO_ENABLE_WINDOW_MS);}export function autoEnableAfterClear(_0x6f6199){const _0x406497=_0x3d3c6e,_0x1c4486={'CXhbg':function(_0x47b412,_0x270b77){return _0x47b412!==_0x270b77;},'LqaRD':function(_0x270aba,_0x2d101b){return _0x270aba(_0x2d101b);}},_0x2a2987=loadCache(),_0x401a4f=getOrCreateSession(_0x2a2987,_0x6f6199);_0x401a4f['enabled']=!![];const _0x58a10e=getCurrentBranch();_0x58a10e&&_0x1c4486[_0x406497(0xc9)](_0x58a10e,'main')&&_0x58a10e!==_0x406497(0xd4)&&(_0x401a4f['currentBranch']=_0x58a10e),delete _0x2a2987[_0x406497(0xad)],_0x1c4486[_0x406497(0xcc)](saveCache,_0x2a2987);}export function registerSession(_0x35b049,_0x9980a9){const _0x2464de=_0x3d3c6e,_0x16b76f={'ggozm':function(_0x1ef460){return _0x1ef460();}},_0x5d24c4=_0x16b76f[_0x2464de(0xc7)](loadCache),_0x333b32=getOrCreateSession(_0x5d24c4,_0x35b049);_0x333b32['featureId']=_0x9980a9,_0x333b32[_0x2464de(0xd1)]=new Date()[_0x2464de(0xaf)](),saveCache(_0x5d24c4);}export function getSessionEntry(_0x56af4f){const _0x51ceea=_0x3d3c6e,_0x59d075=loadCache(),_0x43cf1b=_0x59d075['sessions'][_0x56af4f];if(_0x43cf1b?.['featureId']&&_0x43cf1b?.[_0x51ceea(0xd1)])return{'featureId':_0x43cf1b[_0x51ceea(0xd3)],'registeredAt':_0x43cf1b[_0x51ceea(0xd1)]};return null;}export function unregisterSession(_0x4d081c){const _0x16b029=_0x3d3c6e,_0x5ac54f={'DPuCC':function(_0xc8f185){return _0xc8f185();}},_0x2189f0=_0x5ac54f[_0x16b029(0xca)](loadCache),_0x37789d=_0x2189f0['sessions'][_0x4d081c];_0x37789d&&(delete _0x37789d['featureId'],delete _0x37789d['registeredAt'],saveCache(_0x2189f0));}const PLAN_REMINDER_INTERVAL_MS=0x5*0x3c*0x3e8;export function shouldShowPlanReminder(_0x3bd8bf){const _0x18a663=_0x3d3c6e,_0x320e4b={'nKhLC':function(_0xc7e6a0,_0x47d511,_0x4b3747){return _0xc7e6a0(_0x47d511,_0x4b3747);},'IjxSZ':function(_0x4f8935,_0x4130d1){return _0x4f8935-_0x4130d1;}},_0x4d3ae7=loadCache(),_0x223d19=_0x320e4b['nKhLC'](getOrCreateSession,_0x4d3ae7,_0x3bd8bf),_0x1e0351=_0x223d19[_0x18a663(0xbe)]||0x0,_0x25eaba=Date['now']();if(_0x320e4b['IjxSZ'](_0x25eaba,_0x1e0351)>=PLAN_REMINDER_INTERVAL_MS)return _0x223d19[_0x18a663(0xbe)]=_0x25eaba,saveCache(_0x4d3ae7),!![];return![];}export function hasSessionBeenPrompted(_0xc7b8f2){const _0xe21206=_0x3d3c6e,_0x2f58ef={'XIioV':function(_0x2023f1){return _0x2023f1();},'TCBSx':function(_0x37df5a,_0x355f43){return _0x37df5a===_0x355f43;}},_0x2bc473=_0x2f58ef['XIioV'](loadCache);return _0x2f58ef[_0xe21206(0xc8)](_0x2bc473[_0xe21206(0xcd)][_0xc7b8f2]?.['prompted'],!![]);}export function markSessionPrompted(_0x32d82c){const _0x15c7bd=_0x3d3c6e,_0x9b7ee5={'eBWKV':function(_0x17ff65){return _0x17ff65();},'nnGRb':function(_0x46ecc2,_0x56f7c9,_0x54a3f8){return _0x46ecc2(_0x56f7c9,_0x54a3f8);}},_0x51e085=_0x9b7ee5['eBWKV'](loadCache),_0x54ea33=_0x9b7ee5[_0x15c7bd(0xc6)](getOrCreateSession,_0x51e085,_0x32d82c);_0x54ea33['prompted']=!![],saveCache(_0x51e085);}export function getCacheFile(){return CACHE_FILE;}