promptup-plugin 0.2.0 → 0.2.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/db.js CHANGED
@@ -40,6 +40,7 @@ export function initDatabase() {
40
40
  id TEXT PRIMARY KEY,
41
41
  project_path TEXT,
42
42
  transcript_path TEXT,
43
+ branch TEXT,
43
44
  status TEXT DEFAULT 'active',
44
45
  message_count INTEGER DEFAULT 0,
45
46
  started_at TEXT NOT NULL,
@@ -131,6 +132,11 @@ export function initDatabase() {
131
132
  );
132
133
  CREATE INDEX IF NOT EXISTS idx_pr_reports_branch ON pr_reports(branch, repo);
133
134
  `);
135
+ // Migrations — add columns to existing databases
136
+ try {
137
+ instance.exec('ALTER TABLE sessions ADD COLUMN branch TEXT');
138
+ }
139
+ catch { /* column already exists */ }
134
140
  db = instance;
135
141
  }
136
142
  export function closeDatabase() {
@@ -143,11 +149,11 @@ export function closeDatabase() {
143
149
  export function insertSession(session) {
144
150
  const d = getDb();
145
151
  d.prepare(`
146
- INSERT OR IGNORE INTO sessions (id, project_path, transcript_path, status,
152
+ INSERT OR IGNORE INTO sessions (id, project_path, transcript_path, branch, status,
147
153
  message_count, started_at, ended_at, created_at)
148
- VALUES (@id, @project_path, @transcript_path, @status,
154
+ VALUES (@id, @project_path, @transcript_path, @branch, @status,
149
155
  @message_count, @started_at, @ended_at, @created_at)
150
- `).run(session);
156
+ `).run({ branch: null, ...session });
151
157
  }
152
158
  export function getSession(id) {
153
159
  const row = getDb()
@@ -279,10 +285,20 @@ export function insertGitActivity(activity) {
279
285
  });
280
286
  }
281
287
  export function getSessionsByBranch(branch) {
282
- const rows = getDb()
288
+ const d = getDb();
289
+ // Primary: sessions with branch column set directly
290
+ const direct = d
291
+ .prepare('SELECT id FROM sessions WHERE branch = ? ORDER BY created_at')
292
+ .all(branch)
293
+ .map((r) => r.id);
294
+ // Supplement: sessions linked via git_activities
295
+ const fromGit = d
283
296
  .prepare('SELECT DISTINCT session_id FROM git_activities WHERE branch = ? ORDER BY created_at')
284
- .all(branch);
285
- return rows.map((r) => r.session_id);
297
+ .all(branch)
298
+ .map((r) => r.session_id);
299
+ // Merge, deduplicate
300
+ const all = [...new Set([...direct, ...fromGit])];
301
+ return all;
286
302
  }
287
303
  // ─── Session matching ────────────────────────────────────────────────────────
288
304
  export function getSessionsByTimeRange(from, to, projectPath) {
@@ -280,6 +280,7 @@ export async function generatePRReport(options) {
280
280
  id: sid,
281
281
  project_path: projectPath ?? process.cwd(),
282
282
  transcript_path: latestTranscript,
283
+ branch: branch,
283
284
  status: 'completed',
284
285
  message_count: msgs.length,
285
286
  started_at: msgs[0].created_at,
package/dist/tools.js CHANGED
@@ -17,6 +17,13 @@ import { ulid } from 'ulid';
17
17
  import { readFileSync, existsSync } from 'node:fs';
18
18
  import { join } from 'node:path';
19
19
  import { homedir } from 'node:os';
20
+ import { execSync } from 'node:child_process';
21
+ function detectBranch() {
22
+ try {
23
+ return execSync('git branch --show-current', { encoding: 'utf-8', timeout: 5000 }).trim() || null;
24
+ }
25
+ catch { return null; }
26
+ }
20
27
  import { loadConfig, updateConfig } from './config.js';
21
28
  function textResponse(text, isError = false) {
22
29
  return { content: [{ type: 'text', text }], ...(isError ? { isError } : {}) };
@@ -167,6 +174,7 @@ export async function handleEvaluateSession(args) {
167
174
  id: sessionId,
168
175
  project_path: process.cwd(),
169
176
  transcript_path: transcriptPath,
177
+ branch: detectBranch(),
170
178
  status: 'completed',
171
179
  message_count: messages.length,
172
180
  started_at: firstMsg.created_at,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "promptup-plugin",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "AI coding skill evaluator for Claude Code — 11-dimension scoring, decision intelligence, PR reports",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",