claude-session-skill 1.1.6 → 1.1.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.
@@ -15071,7 +15071,7 @@ function searchSessions(sessions, query) {
15071
15071
  }
15072
15072
  scored.push({ session, score });
15073
15073
  }
15074
- scored.sort((a, b) => b.score - a.score || b.session.lastTimestamp - a.session.lastTimestamp);
15074
+ scored.sort((a, b) => b.session.lastTimestamp - a.session.lastTimestamp);
15075
15075
  return scored.map((s) => s.session);
15076
15076
  }
15077
15077
 
package/dist/session.js CHANGED
@@ -76,7 +76,7 @@ function searchSessions(sessions, query) {
76
76
  }
77
77
  scored.push({ session, score });
78
78
  }
79
- scored.sort((a, b) => b.score - a.score || b.session.lastTimestamp - a.session.lastTimestamp);
79
+ scored.sort((a, b) => b.session.lastTimestamp - a.session.lastTimestamp);
80
80
  return scored.map((s) => s.session);
81
81
  }
82
82
 
@@ -47,40 +47,44 @@ describe("searchSessions", () => {
47
47
  expect(results[0].id).toBe("a");
48
48
  });
49
49
 
50
- test("ranks name matches highest", () => {
50
+ test("name match is included even without topic match", () => {
51
51
  const sessions = [
52
52
  makeSession({ id: "a", name: "", topic: "deploy pipeline" }),
53
53
  makeSession({ id: "b", name: "Deploy Fix", topic: "unrelated" }),
54
54
  ];
55
55
  const results = searchSessions(sessions, "deploy");
56
- expect(results[0].id).toBe("b");
56
+ expect(results.map((r) => r.id)).toContain("a");
57
+ expect(results.map((r) => r.id)).toContain("b");
57
58
  });
58
59
 
59
- test("ranks topic matches above allMessages matches", () => {
60
+ test("topic match is included", () => {
60
61
  const sessions = [
61
62
  makeSession({ id: "a", topic: "unrelated", allMessages: "deploy fix" }),
62
63
  makeSession({ id: "b", topic: "deploy pipeline", allMessages: "other stuff" }),
63
64
  ];
64
65
  const results = searchSessions(sessions, "deploy");
65
- expect(results[0].id).toBe("b");
66
+ expect(results.map((r) => r.id)).toContain("a");
67
+ expect(results.map((r) => r.id)).toContain("b");
66
68
  });
67
69
 
68
- test("ranks firstMessage matches above lastMessage", () => {
70
+ test("firstMessage and lastMessage matches are both included", () => {
69
71
  const sessions = [
70
72
  makeSession({ id: "a", firstMessage: "unrelated", lastMessage: "fixed the deploy" }),
71
73
  makeSession({ id: "b", firstMessage: "fix the deploy", lastMessage: "unrelated" }),
72
74
  ];
73
75
  const results = searchSessions(sessions, "deploy");
74
- expect(results[0].id).toBe("b");
76
+ expect(results.map((r) => r.id)).toContain("a");
77
+ expect(results.map((r) => r.id)).toContain("b");
75
78
  });
76
79
 
77
- test("supports quoted phrase matching", () => {
80
+ test("quoted phrase filters to exact matches only", () => {
78
81
  const sessions = [
79
82
  makeSession({ id: "a", topic: "deploy fix" }),
80
83
  makeSession({ id: "b", topic: "fix deploy issue" }),
81
84
  ];
82
85
  const results = searchSessions(sessions, '"deploy fix"');
83
- expect(results[0].id).toBe("a");
86
+ expect(results.map((r) => r.id)).toContain("a");
87
+ expect(results.map((r) => r.id)).not.toContain("b");
84
88
  });
85
89
 
86
90
  test("matches on project path", () => {
@@ -103,7 +107,7 @@ describe("searchSessions", () => {
103
107
  expect(results[0].id).toBe("a");
104
108
  });
105
109
 
106
- test("applies recency boost for sessions within 1 day", () => {
110
+ test("results are ordered most recent first", () => {
107
111
  const now = Date.now();
108
112
  const sessions = [
109
113
  makeSession({ id: "old", topic: "deploy", lastTimestamp: now - 86400000 * 30 }),
@@ -111,19 +115,27 @@ describe("searchSessions", () => {
111
115
  ];
112
116
  const results = searchSessions(sessions, "deploy");
113
117
  expect(results[0].id).toBe("recent");
118
+ expect(results[1].id).toBe("old");
114
119
  });
115
120
 
116
- test("handles multiple search tokens", () => {
121
+ test("handles multiple search tokens — all matching sessions included", () => {
122
+ const now = Date.now();
117
123
  const sessions = [
118
- makeSession({ id: "a", topic: "fix login bug in auth" }),
119
- makeSession({ id: "b", topic: "fix deploy pipeline" }),
120
- makeSession({ id: "c", topic: "login page redesign" }),
124
+ makeSession({ id: "a", topic: "fix login bug in auth", lastTimestamp: now - 1000 }),
125
+ makeSession({ id: "b", topic: "fix deploy pipeline", lastTimestamp: now - 2000 }),
126
+ makeSession({ id: "c", topic: "login page redesign", lastTimestamp: now - 3000 }),
121
127
  ];
122
128
  const results = searchSessions(sessions, "fix login");
129
+ // a and c both match ("fix login" shares tokens); b matches "fix"
130
+ const ids = results.map((r) => r.id);
131
+ expect(ids).toContain("a");
132
+ expect(ids).toContain("b");
133
+ expect(ids).toContain("c");
134
+ // All ordered most recent first
123
135
  expect(results[0].id).toBe("a");
124
136
  });
125
137
 
126
- test("returns results sorted by score then recency", () => {
138
+ test("returns results sorted by most recent first regardless of score", () => {
127
139
  const now = Date.now();
128
140
  const sessions = [
129
141
  makeSession({ id: "a", topic: "deploy", lastTimestamp: now - 86400000 * 10 }),
@@ -131,5 +143,6 @@ describe("searchSessions", () => {
131
143
  ];
132
144
  const results = searchSessions(sessions, "deploy");
133
145
  expect(results[0].id).toBe("b");
146
+ expect(results[1].id).toBe("a");
134
147
  });
135
148
  });
package/lib/search.ts CHANGED
@@ -74,8 +74,8 @@ export function searchSessions(
74
74
  scored.push({ session, score });
75
75
  }
76
76
 
77
- // Sort by score desc, then by lastTimestamp desc
78
- scored.sort((a, b) => b.score - a.score || b.session.lastTimestamp - a.session.lastTimestamp);
77
+ // Sort by most recent first (timestamp desc). Score only determines inclusion, not order.
78
+ scored.sort((a, b) => b.session.lastTimestamp - a.session.lastTimestamp);
79
79
 
80
80
  return scored.map((s) => s.session);
81
81
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-session-skill",
3
- "version": "1.1.6",
3
+ "version": "1.1.7",
4
4
  "description": "Search, browse, and resume past Claude Code sessions with AI-generated summaries — plus an MCP server for any MCP-compatible client",
5
5
  "author": "ITeachYouAI <engineering@iteachyouai.com>",
6
6
  "license": "MIT",