ework-web 0.10.117 → 0.10.118

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ework-web",
3
- "version": "0.10.117",
3
+ "version": "0.10.118",
4
4
  "type": "module",
5
5
  "description": "ework-web — standalone multi-project issue tracker. Local SQLite-backed, no external API dependency. Bun + TypeScript + SSR HTML.",
6
6
  "license": "MIT",
package/src/store.ts CHANGED
@@ -451,6 +451,9 @@ export async function listAllIssues(opts: ListIssuesOpts = {}): Promise<IssueWit
451
451
  }
452
452
 
453
453
  export interface CreateIssueOpts {
454
+ /** Preferred local number (upstream imports keep local==upstream). Falls
455
+ * back to autoincrement when the number is taken. */
456
+ number?: number;
454
457
  createdAt?: string;
455
458
  updatedAt?: string;
456
459
  state?: "open" | "closed";
@@ -484,9 +487,15 @@ export async function createIssue(
484
487
  const state: "open" | "closed" = opts.state ?? "open";
485
488
  const closedAt = state === "closed" ? isoOr(opts.closedAt ?? undefined, updatedAt) : null;
486
489
  return await getDB().transaction(async () => {
487
- const next = (await getDB().get<{ n: number }>(
488
- "SELECT COALESCE(MAX(number), 0) + 1 AS n FROM {{issues}} WHERE project_id = ?", [projectId]
489
- ))!;
490
+ const want = opts.number && opts.number > 0 ? opts.number : null;
491
+ const taken = want
492
+ ? await getDB().get<{ id: number }>("SELECT id FROM {{issues}} WHERE project_id = ? AND number = ?", [projectId, want])
493
+ : undefined;
494
+ const next = want && !taken
495
+ ? { n: want }
496
+ : (await getDB().get<{ n: number }>(
497
+ "SELECT COALESCE(MAX(number), 0) + 1 AS n FROM {{issues}} WHERE project_id = ?", [projectId]
498
+ ))!;
490
499
  const info = await getDB().run(
491
500
  "INSERT INTO {{issues}} (project_id, number, title, body, state, author, created_at, updated_at, closed_at, model, runtime, upstream_issue_number) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
492
501
  [projectId, next.n, title, body, state, author, createdAt, updatedAt, closedAt, opts.model ?? "", opts.runtime ?? "", opts.upstreamIssueNumber ?? null]
@@ -139,6 +139,7 @@ export class UpstreamSync {
139
139
  updatedAt: gi.updated_at,
140
140
  state: gi.state === "closed" ? "closed" : "open",
141
141
  upstreamIssueNumber: gi.number,
142
+ number: gi.number,
142
143
  }
143
144
  );
144
145
  // PRs the sandbox agent opens itself carry the ework-agent-pr marker;