ccmanager 2.11.0 → 2.11.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/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Kodai Kabasawa
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -30,6 +30,12 @@ export class ConfigurationManager {
|
|
|
30
30
|
writable: true,
|
|
31
31
|
value: {}
|
|
32
32
|
});
|
|
33
|
+
Object.defineProperty(this, "worktreeLastOpened", {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
configurable: true,
|
|
36
|
+
writable: true,
|
|
37
|
+
value: new Map()
|
|
38
|
+
});
|
|
33
39
|
// Determine config directory based on platform
|
|
34
40
|
const homeDir = homedir();
|
|
35
41
|
this.configDir =
|
|
@@ -275,17 +281,13 @@ export class ConfigurationManager {
|
|
|
275
281
|
this.setCommandPresets(presets);
|
|
276
282
|
}
|
|
277
283
|
getWorktreeLastOpened() {
|
|
278
|
-
return this.
|
|
284
|
+
return Object.fromEntries(this.worktreeLastOpened);
|
|
279
285
|
}
|
|
280
286
|
setWorktreeLastOpened(worktreePath, timestamp) {
|
|
281
|
-
|
|
282
|
-
this.config.worktreeLastOpened = {};
|
|
283
|
-
}
|
|
284
|
-
this.config.worktreeLastOpened[worktreePath] = timestamp;
|
|
285
|
-
this.saveConfig();
|
|
287
|
+
this.worktreeLastOpened.set(worktreePath, timestamp);
|
|
286
288
|
}
|
|
287
289
|
getWorktreeLastOpenedTime(worktreePath) {
|
|
288
|
-
return this.
|
|
290
|
+
return this.worktreeLastOpened.get(worktreePath);
|
|
289
291
|
}
|
|
290
292
|
// Effect-based methods for type-safe error handling
|
|
291
293
|
/**
|
|
@@ -303,9 +303,13 @@ export class SessionManager extends EventEmitter {
|
|
|
303
303
|
const session = this.sessions.get(worktreePath);
|
|
304
304
|
if (session) {
|
|
305
305
|
session.isActive = active;
|
|
306
|
-
// If becoming active,
|
|
307
|
-
if (active
|
|
308
|
-
|
|
306
|
+
// If becoming active, record the timestamp when this worktree was opened
|
|
307
|
+
if (active) {
|
|
308
|
+
configurationManager.setWorktreeLastOpened(worktreePath, Date.now());
|
|
309
|
+
// Emit a restore event with the output history if available
|
|
310
|
+
if (session.outputHistory.length > 0) {
|
|
311
|
+
this.emit('sessionRestore', session);
|
|
312
|
+
}
|
|
309
313
|
}
|
|
310
314
|
}
|
|
311
315
|
}
|
|
@@ -641,10 +641,17 @@ export class WorktreeService {
|
|
|
641
641
|
if (sortByLastSession) {
|
|
642
642
|
worktrees.sort((a, b) => {
|
|
643
643
|
// Get last opened timestamps for both worktrees
|
|
644
|
-
const timeA = configurationManager.getWorktreeLastOpenedTime(a.path)
|
|
645
|
-
const timeB = configurationManager.getWorktreeLastOpenedTime(b.path)
|
|
644
|
+
const timeA = configurationManager.getWorktreeLastOpenedTime(a.path);
|
|
645
|
+
const timeB = configurationManager.getWorktreeLastOpenedTime(b.path);
|
|
646
|
+
// If both timestamps are undefined, preserve original order
|
|
647
|
+
if (timeA === undefined && timeB === undefined) {
|
|
648
|
+
return 0;
|
|
649
|
+
}
|
|
650
|
+
// If only one is undefined, treat it as older (0)
|
|
651
|
+
const compareTimeA = timeA || 0;
|
|
652
|
+
const compareTimeB = timeB || 0;
|
|
646
653
|
// Sort in descending order (most recent first)
|
|
647
|
-
return
|
|
654
|
+
return compareTimeB - compareTimeA;
|
|
648
655
|
});
|
|
649
656
|
}
|
|
650
657
|
return worktrees;
|
package/dist/types/index.d.ts
CHANGED