@adhd/backlog 0.1.9 → 1.0.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.
Files changed (65) hide show
  1. package/CHANGELOG.md +128 -47
  2. package/README.md +369 -81
  3. package/api.d.ts +196 -0
  4. package/api.ir.json +1 -0
  5. package/cli.d.ts +45 -18
  6. package/env.d.ts +23 -3
  7. package/envelope.d.ts +163 -0
  8. package/extract-live.d.ts +56 -0
  9. package/index.d.ts +11 -10
  10. package/index.js +255 -197
  11. package/index.mjs +11348 -19043
  12. package/install-skill.d.ts +23 -0
  13. package/ir-artifact.d.ts +86 -0
  14. package/package.json +51 -15
  15. package/query/card.d.ts +31 -0
  16. package/query/get.d.ts +11 -0
  17. package/query/index.d.ts +67 -0
  18. package/query/markdown.d.ts +11 -0
  19. package/query/query.d.ts +131 -0
  20. package/query/resolve.d.ts +123 -0
  21. package/query/types.d.ts +450 -0
  22. package/query/views/registry.d.ts +43 -0
  23. package/query/views/semantic.d.ts +101 -0
  24. package/query/views/stats.d.ts +109 -0
  25. package/search-shortcut.d.ts +79 -0
  26. package/serve.d.ts +18 -0
  27. package/server.d.ts +139 -4
  28. package/skill/SKILL.md +632 -138
  29. package/store/graph-backlog-store.d.ts +80 -17
  30. package/store/immediate-retry.d.ts +24 -13
  31. package/store/type-policy.d.ts +4 -0
  32. package/store/vocabulary-guard.d.ts +52 -0
  33. package/write/audit.d.ts +36 -0
  34. package/write/bootstrap.d.ts +161 -0
  35. package/write/catalog.d.ts +369 -0
  36. package/write/citation-path.d.ts +133 -0
  37. package/write/claim-lease.d.ts +21 -0
  38. package/write/claim.d.ts +80 -0
  39. package/write/create-issue.d.ts +253 -0
  40. package/write/delete.d.ts +39 -0
  41. package/write/embed-drain.d.ts +68 -0
  42. package/write/embedding-config.d.ts +81 -0
  43. package/write/embedding-observer.d.ts +80 -0
  44. package/write/errors.d.ts +365 -0
  45. package/write/issue-status.d.ts +10 -0
  46. package/write/move.d.ts +70 -0
  47. package/write/relate.d.ts +52 -0
  48. package/write/transition.d.ts +64 -0
  49. package/write/tx.d.ts +344 -0
  50. package/write/update.d.ts +81 -0
  51. package/client.d.ts +0 -174
  52. package/markdown.d.ts +0 -75
  53. package/migration-admin.d.ts +0 -26
  54. package/model.d.ts +0 -437
  55. package/store/audit-log.d.ts +0 -16
  56. package/store/claim.d.ts +0 -24
  57. package/store/crud.d.ts +0 -62
  58. package/store/ids.d.ts +0 -24
  59. package/store/lifecycle.d.ts +0 -36
  60. package/store/mapping.d.ts +0 -101
  61. package/store/mutate-metadata.d.ts +0 -8
  62. package/store/query.d.ts +0 -68
  63. package/store/repo-migration.d.ts +0 -51
  64. package/store/serve-lock.d.ts +0 -42
  65. package/store/structure.d.ts +0 -66
@@ -1,36 +0,0 @@
1
- import { GraphBacklogStore } from './graph-backlog-store.js';
2
- import { ArchiveOpts, BacklogItem, BacklogStatus, Citation, StatsScope, TransitionOpts } from '../model.js';
3
-
4
- /**
5
- * `Citation.file` is required at the TypeScript/JSON-Schema level
6
- * (BUG-APIGEN-CORE-CLIENT-001 makes that presence check reach the extracted
7
- * schema), but presence alone still accepts `""`/whitespace — a citation
8
- * with no actual file is not evidence. Every write path that accepts a
9
- * caller-supplied `Citation` (inline on `transitionStatus`/`resolveItem`, and
10
- * standalone `addCitation`) runs every entry through this before it is
11
- * persisted. Also reused by `crud.ts`'s `createItemNode` and
12
- * `structure.ts`'s `supersedeItemNode` for citations supplied inline on
13
- * `CreateItemInput` (BUG-BACKLOG-CREATE-ITEM-DROPS-CITATIONS-001) — one
14
- * validation rule, every write path.
15
- */
16
- export declare function assertValidCitation(citation: Citation): void;
17
- export declare function transitionStatusNode(store: GraphBacklogStore, repo: string, humanId: string, status: BacklogStatus, opts: TransitionOpts): Promise<BacklogItem>;
18
- /** Sugar for transitionStatus into any terminal status (SPEC.md §5.4). */
19
- export declare function resolveItemNode(store: GraphBacklogStore, repo: string, humanId: string, status: BacklogStatus, opts: TransitionOpts): Promise<BacklogItem>;
20
- /**
21
- * `transitionStatus(id, 'IN_PROGRESS', ...)` + an implicit `claimItem(id, by)`.
22
- * If the item is actively claimed (not stale) by someone else, the claim
23
- * step returns `held` and startWork refuses — starting work on a
24
- * contended item would silently override the claim protocol otherwise.
25
- */
26
- export declare function startWorkNode(store: GraphBacklogStore, repo: string, humanId: string, by: string): Promise<BacklogItem>;
27
- export declare function addCitationNode(store: GraphBacklogStore, repo: string, humanId: string, citation: Citation): Promise<BacklogItem>;
28
- export declare function appendNoteNode(store: GraphBacklogStore, repo: string, humanId: string, by: string, text: string): Promise<BacklogItem>;
29
- /**
30
- * Marks every terminal, non-excluded item in scope as archived
31
- * (`metadata.archivedAt`) and returns them — the graph node itself is NEVER
32
- * deleted (bi-temporal history is permanent). Rendering the archived set to
33
- * CHANGELOG.md-formatted markdown is `client.ts`'s job (via `markdown.ts`) —
34
- * store/* never depends on markdown.ts (DESIGN.md §1 layering).
35
- */
36
- export declare function archiveTerminalItems(store: GraphBacklogStore, scope: StatsScope, opts?: ArchiveOpts): Promise<BacklogItem[]>;
@@ -1,101 +0,0 @@
1
- import { BacklogItem, BacklogStatus, Citation, Note, Priority } from '../model.js';
2
- import { NodeRecord } from '@adhd/sox-graph-store';
3
-
4
- export declare const BACKLOG_ITEM_TAG = "backlog-item";
5
- export declare const BACKLOG_PLAN_TAG = "backlog-plan";
6
- export declare const BACKLOG_ASSIGNEE_TAG = "backlog-assignee";
7
- /**
8
- * Mirrors `@adhd/sox-graph-store`'s PRIVATE (unexported) `hashContent()`
9
- * (`sha256(content.trim().toLowerCase())`) exactly. Needed only by
10
- * `updateItemNode` (crud.ts), which writes `node.content`/`node.content_hash`
11
- * directly via raw SQL (DESIGN.md §14's sanctioned escape hatch for the one
12
- * gap `touch()` doesn't cover — DEBT-BACKLOG-CONTENT-IMMUTABLE-001) and must
13
- * keep `content_hash` consistent with the `content` it just wrote, exactly as
14
- * `writeNode()` would have. If upstream ever changes its normalization, this
15
- * copy must change with it — there is no shared primitive to import instead.
16
- */
17
- export declare function computeContentHash(content: string): string;
18
- /**
19
- * `@adhd/sox-graph-store`'s `searchNodes(query)` binds `query` DIRECTLY as an
20
- * FTS5 `MATCH` argument, parsed by FTS5's own boolean/column-filter query
21
- * grammar — NOT a plain-text search. `searchNodes`'s own `query.replace(/"/g,
22
- * '""')` cannot make this safe for arbitrary text: doubling an EXISTING `"`
23
- * always yields an EVEN number of quote characters in the output, so a
24
- * caller can never end up with a validly single-quoted phrase this way
25
- * (verified empirically — wrapping a title in quotes before calling
26
- * `searchNodes` still throws). A title containing a bare `-`, `:`, `(`, `)`,
27
- * or `"` (all real English titles — "off-by-one", "fix: the thing" — not
28
- * edge cases) crashes `createItemNode`'s dedupe scan outright with a raw
29
- * `SqliteError`, since `force:true` (the only path that SKIPS the dedupe
30
- * scan) is not the default. `dedupeScan` (crud.ts) uses this to strip every
31
- * FTS5-syntax-significant character to a space before searching — this is
32
- * BEHAVIOR-PRESERVING for the already-working case (a title with no special
33
- * characters passes through unchanged, still an implicit-AND bareword
34
- * query), and merely prevents the CRASH for the common case that hits one.
35
- */
36
- /**
37
- * Strips every FTS5-syntax-significant character to a space before a title/
38
- * grep term ever reaches `searchNodes`'s raw MATCH bind (dedupeScan and
39
- * `queryItemNodes`'s grep path, BUG-BACKLOG-DEDUPE-FTS-SYNTAX-CRASH-001).
40
- *
41
- * The original fix (2026-07) only stripped the small set of characters found
42
- * in the reported crash: `"():^*-`. `#` (an entirely ordinary character in a
43
- * real title, e.g. "Fixes #123" or this file's own regression test) was
44
- * discovered independently to ALSO crash `searchNodes` with `fts5: syntax
45
- * error near "#"` — and probing FTS5's actual grammar directly (not
46
- * guessing) turned up a much longer list that crashes the same way: `. { }
47
- * ~ [ ] @ ! $ % & = < > ? / \ ; ,` — `{` is the most dangerous of these
48
- * (`no such column: create` — it gets parsed as column-filter syntax rather
49
- * than merely erroring, a correctness risk beyond a crash). A second
50
- * whack-a-mole char-by-char addition would leave the same class of gap open
51
- * for whatever punctuation mark comes up next, so this strips every
52
- * character that is NOT a Unicode letter, number, underscore, or whitespace
53
- * — the complete, non-enumerable-by-hand safe set for an FTS5 bareword
54
- * query — rather than continuing to enumerate a denylist.
55
- */
56
- export declare function sanitizeFtsQuery(text: string): string;
57
- /**
58
- * The JSON shape persisted in `node.meta` (DESIGN.md §2.2/§4.1). Every
59
- * mutating store operation reads the CURRENT full object, computes a new
60
- * COMPLETE object, and writes it back via `mutateMetadata` — `touch()`
61
- * replaces `meta` wholesale (verified, DESIGN.md §14 point 4), so a partial
62
- * write here would silently drop every other field.
63
- */
64
- export interface BacklogNodeMeta {
65
- humanId: string;
66
- kind: string;
67
- family: string;
68
- title: string;
69
- body: string;
70
- status: BacklogStatus;
71
- priority?: Priority;
72
- repo: string;
73
- projectPath?: string;
74
- plan?: string;
75
- /** Source markdown path this item was imported from, if any (DEBT-BACKLOG-IMPORT-PLAN-PROVENANCE-001). */
76
- importedFrom?: string;
77
- assignee?: string;
78
- claimedBy?: string;
79
- claimedAt?: string;
80
- citations: Citation[];
81
- notes: Note[];
82
- createdAt: string;
83
- updatedAt: string;
84
- /** Set by archiveResolved — excludes the item from renderToMarkdown's default view. */
85
- archivedAt?: string;
86
- /** Dedupe-scan exact-match fields (DESIGN.md §2.4). */
87
- dedupeSymbol?: string;
88
- dedupePath?: string;
89
- dedupeErrorText?: string;
90
- }
91
- export declare function humanIdKind(humanId: string): string;
92
- export declare function humanIdFamily(humanId: string): string;
93
- /** See the file-level DEVIATION doc comment for why the marker is appended. */
94
- export declare function buildNodeContent(repo: string, humanId: string, title: string, body: string): string;
95
- export declare function buildNodeName(repo: string, humanId: string): string;
96
- /** DESIGN.md §2.2 — importance derived deterministically from priority. */
97
- export declare function importanceForPriority(priority: Priority | undefined): number;
98
- export declare function buildTags(kind: string, family: string, userTags?: readonly string[]): string[];
99
- /** A node counts as a live backlog item iff it carries the tag AND is not superseded (DESIGN.md §14). */
100
- export declare function isLiveBacklogItemNode(node: NodeRecord): boolean;
101
- export declare function toBacklogItem(node: NodeRecord): BacklogItem;
@@ -1,8 +0,0 @@
1
- import { BacklogNodeMeta } from './mapping.js';
2
- import { GraphBacklogStore } from './graph-backlog-store.js';
3
-
4
- export declare class NotFoundError extends Error {
5
- readonly nodeId: number;
6
- constructor(nodeId: number);
7
- }
8
- export declare function mutateMetadata<M = BacklogNodeMeta>(store: GraphBacklogStore, nodeId: number, updater: (current: M) => M): Promise<M>;
package/store/query.d.ts DELETED
@@ -1,68 +0,0 @@
1
- import { BacklogNodeMeta } from './mapping.js';
2
- import { GraphBacklogStore } from './graph-backlog-store.js';
3
- import { AuditTrailResult, BacklogFilter, BacklogItem, DependencyGraph, StatsScope, TopoOrderResult, BacklogItemNotFoundError } from '../model.js';
4
- import { NodeRecord } from '@adhd/sox-graph-store';
5
-
6
- /** Raw NodeRecord query — used internally where the full node (not just the mapped BacklogItem) is needed. */
7
- export declare function queryItemNodes(store: GraphBacklogStore, filter?: BacklogFilter): Promise<NodeRecord[]>;
8
- export declare function listItems(store: GraphBacklogStore, filter?: BacklogFilter): Promise<BacklogItem[]>;
9
- /**
10
- * BUG-BACKLOG-HUMANID-COLLISION-001 fix #2: this is THE shared `(repo,
11
- * humanId) -> NodeRecord` lookup every store module funnels through
12
- * (`crud.ts`/`lifecycle.ts`/`structure.ts`/`client.ts`'s `requireItem*`
13
- * helpers all call this, directly or via `buildNotFoundError`'s sibling
14
- * miss path). It used to silently resolve to "whichever live node happens
15
- * to match `name`, else whichever is first" when more than one live node
16
- * shared the same `(repo, humanId)` key — the exact shape of the
17
- * pre-existing `"undefined-001"` collisions, and the root cause of a real
18
- * mis-transition (see the backlog item body: a `resolveItem` call intended
19
- * for one node silently landed on a different, unrelated one). Any lookup
20
- * that finds >1 live match now throws `AmbiguousHumanIdError` instead of
21
- * guessing.
22
- */
23
- export declare function findItemNode(store: GraphBacklogStore, repo: string, humanId: string): Promise<NodeRecord | null>;
24
- /**
25
- * Finds every LIVE node carrying this `humanId`, across ALL repos (no
26
- * `namespace` filter) — BUG-BACKLOG-REPO-LOOKUP-UX-001's "did you mean repo
27
- * X?" hint needs this to distinguish "this humanId truly doesn't exist" from
28
- * "it exists, just filed under a different repo string than the caller
29
- * passed." Used only on the miss path (`buildNotFoundError`) — never on the
30
- * hot successful-lookup path, so it costs nothing when a lookup is correct.
31
- */
32
- export declare function findHumanIdInAnyRepo(store: GraphBacklogStore, humanId: string): Promise<NodeRecord[]>;
33
- /**
34
- * Every distinct repo value any LIVE backlog item is currently filed under.
35
- * Used by `createItemNode`'s soft repo-drift warning (write-time half of
36
- * BUG-BACKLOG-REPO-LOOKUP-UX-001) — an empty store (no items yet) has no
37
- * "known" repos, so the very first item filed under any repo string never
38
- * triggers a false-positive warning.
39
- */
40
- export declare function knownRepos(store: GraphBacklogStore): Promise<Set<string>>;
41
- /**
42
- * Builds the `BacklogItemNotFoundError` every miss site throws — the single
43
- * place that decides whether a "did you mean repo X?" hint is warranted
44
- * (BUG-BACKLOG-REPO-LOOKUP-UX-001, read-time half). Callers pass the SAME
45
- * `(repo, humanId)` they just failed to find via `findItemNode` — this
46
- * re-queries WITHOUT the `namespace` restriction to see if the humanId lives
47
- * under a different repo string instead.
48
- */
49
- export declare function buildNotFoundError(store: GraphBacklogStore, repo: string, humanId: string): Promise<BacklogItemNotFoundError>;
50
- export declare function computeStats(store: GraphBacklogStore, scope?: StatsScope): Promise<import('../model.js').BacklogStats>;
51
- export declare function spotlight(store: GraphBacklogStore, scope?: StatsScope, limit?: number): Promise<BacklogItem[]>;
52
- export declare function blockers(store: GraphBacklogStore, repo: string, humanId: string): Promise<BacklogItem[]>;
53
- export declare function readyItems(store: GraphBacklogStore, scope?: StatsScope): Promise<BacklogItem[]>;
54
- export declare function dependencyGraph(store: GraphBacklogStore, scope?: StatsScope): Promise<DependencyGraph>;
55
- export declare function topoOrder(store: GraphBacklogStore, scope?: StatsScope): Promise<TopoOrderResult>;
56
- export declare function staleClaims(store: GraphBacklogStore, maxAgeMin: number, scope?: StatsScope): Promise<BacklogItem[]>;
57
- /**
58
- * Bi-temporal history + supersession chain (SPEC.md §5.6, DESIGN.md §2.3).
59
- * DEVIATION: the store does not persist a full mutation event log (no
60
- * separate transitions/claims-over-time table) — `history` is therefore
61
- * honestly derived from the durable fields we DO keep (a synthetic
62
- * `created` entry, every real `note`, every real `citation`), not a
63
- * fabricated replay of every status/claim change. Citation entries reuse
64
- * `item.updatedAt` as their timestamp since `Citation` carries no `at` field
65
- * of its own. Filed as DEBT-BACKLOG-AUDIT-TRAIL-PARTIAL-001.
66
- */
67
- export declare function auditTrail(store: GraphBacklogStore, repo: string, humanId: string): Promise<AuditTrailResult>;
68
- export type { BacklogNodeMeta };
@@ -1,51 +0,0 @@
1
- import { GraphBacklogStore } from './graph-backlog-store.js';
2
- import { BacklogItem, RepoMigrationItemResult, RepoMigrationPlan, RepoMigrationPlanItem, RepoMigrationResult } from '../model.js';
3
-
4
- /**
5
- * Pure, read-only, deterministic migration plan for every LIVE item whose
6
- * `namespace` is `fromRepo` — deliberately namespace-scoped (not
7
- * `metadata.repo`-scoped) so an item whose two repo fields have already
8
- * diverged (found empirically: `FEAT-001`/`FEAT-002`, `namespace:"adhd"` but
9
- * `metadata.repo:"PseudoSky/adhd"`) is still picked up and fully repaired,
10
- * not silently skipped because its rendered `repo` already "looks" correct.
11
- *
12
- * Collision resolution walks `sourceItems` in humanId order (stable,
13
- * reproducible across repeated calls) and, for a colliding humanId, assigns
14
- * the next free number in that family — tracked in an in-memory
15
- * `familyMaxInTarget` map seeded from `toRepo`'s REAL current max per family
16
- * and incremented for every rename already planned earlier in this same
17
- * pass, so two same-family collisions in one batch never target each other.
18
- */
19
- export declare function planRepoMigration(store: GraphBacklogStore, fromRepo: string, toRepo: string): Promise<RepoMigrationPlan>;
20
- /**
21
- * Executes exactly ONE planned move, re-verifying the live state at the
22
- * exact node still matches what the plan assumed (a stale plan — the source
23
- * item moved/mutated, or the target humanId got claimed — since planning
24
- * throws `InvalidArgumentError` rather than silently proceeding on bad
25
- * assumptions; `executeRepoMigration` catches this per-item so one stale
26
- * entry never aborts the whole batch or gets silently skipped).
27
- *
28
- * Mirrors `structure.ts`'s `renameHumanIdNode` exactly, generalized to also
29
- * rewrite `namespace` (which `renameHumanIdNode` deliberately refuses to
30
- * touch — same-repo only) — see this module's top-of-file doc comment for
31
- * why `touch()` cannot do that column and a raw `UPDATE` is required.
32
- */
33
- export declare function migrateRepoItemNode(store: GraphBacklogStore, item: RepoMigrationPlanItem, fromRepo: string, toRepo: string, actor: string): Promise<BacklogItem>;
34
- /**
35
- * Executes every item in `plan`, sequentially (each rename must observe the
36
- * previous item's real committed state before computing/verifying the next
37
- * — see `planRepoMigration`'s doc comment on why this must not run in
38
- * parallel). Every planned item gets exactly one result — `ok:true` or
39
- * `ok:false` with `error` — so a failure is always visible and never
40
- * silently drops an item from the report; a per-item failure does not abort
41
- * the remaining items (an aborted batch would leave an unpredictable subset
42
- * moved with no way to tell which from the caller's plan alone).
43
- */
44
- export declare function executeRepoMigration(store: GraphBacklogStore, plan: RepoMigrationPlan, actor: string): Promise<RepoMigrationItemResult[]>;
45
- /**
46
- * The single entry point client.ts/CLI/MCP expose. `dryRun` defaults to
47
- * `true` — a caller MUST pass `dryRun:false` explicitly to mutate anything,
48
- * so a bare "preview this migration" call (e.g. an agent double-checking
49
- * before committing) can never accidentally execute.
50
- */
51
- export declare function migrateRepo(store: GraphBacklogStore, fromRepo: string, toRepo: string, actor: string, dryRun?: boolean): Promise<RepoMigrationResult>;
@@ -1,42 +0,0 @@
1
- /** Thrown when another live process already holds the serve lock for this
2
- * store. Carries the holder's pid and the lock file path so callers can
3
- * surface both — refusing SILENTLY (a bare non-zero exit with no reason)
4
- * is exactly the failure mode that let this incident go undetected. */
5
- export declare class ServeLockHeldError extends Error {
6
- readonly holderPid: number;
7
- readonly lockPath: string;
8
- constructor(holderPid: number, lockPath: string);
9
- }
10
- export interface ServeLockHandle {
11
- /** Idempotent. Removes the lock file ONLY if it still names this process
12
- * as holder (never deletes a lock a later process legitimately took over
13
- * after detecting this one as stale — that would delete a live peer's
14
- * lock out from under it). */
15
- release: () => void;
16
- }
17
- /** `:memory:` has no filesystem identity — no cross-process concern, no lock. */
18
- export declare function isLockableDbPath(dbPath: string): boolean;
19
- /** Canonicalizes to the realpath when the file (or its parent dir) exists,
20
- * so two spellings of the same store collapse to one lock identity; falls
21
- * back to a plain absolute resolve when nothing on disk exists yet (a
22
- * not-yet-created db is still a valid lock anchor — mirrors sox-ecosystem's
23
- * `singleton.ts` `canonicalizePath`, reimplemented here for the same reason
24
- * noted in this file's header). */
25
- export declare function canonicalDbPath(dbPath: string): string;
26
- export declare function serveLockPath(dbPath: string): string;
27
- /**
28
- * Acquire the `backlog serve` writer lock for `dbPath`. Fails LOUD and
29
- * IMMEDIATELY (no spin-wait/retry-until-timeout — a refused `serve` should
30
- * say why right now, not silently poll and eventually give up) when a live
31
- * holder is found: throws {@link ServeLockHeldError} naming the holder's
32
- * pid. A lock file whose recorded pid is no longer alive (crash, SIGKILL,
33
- * native panic — the same "can't run cleanup code" cases
34
- * `signal-cleanup.ts`'s own doc comment is honest about) is detected via a
35
- * liveness probe on READ, not relied on to have been cleaned up by the dead
36
- * process, and is reclaimed automatically.
37
- *
38
- * Call this BEFORE opening the store; release the returned handle only
39
- * AFTER the store is fully closed (see this file's header re: the
40
- * shutdown-window).
41
- */
42
- export declare function acquireServeLock(dbPath: string): ServeLockHandle;
@@ -1,66 +0,0 @@
1
- import { GraphBacklogStore } from './graph-backlog-store.js';
2
- import { BacklogItem, CreateItemInput, Priority } from '../model.js';
3
-
4
- export declare function addDependencyNode(store: GraphBacklogStore, repo: string, humanId: string, dependsOnHumanId: string): Promise<void>;
5
- /**
6
- * `@adhd/sox-graph-store` exposes no edge-delete primitive (only
7
- * `invalidate()` for nodes, bi-temporal) — DESIGN.md §14 explicitly sanctions
8
- * a raw `DELETE` on the store-owned handle as the one place the adapter
9
- * reaches past the `GraphBackend` API, confirmed against the real `edge`
10
- * table column names (`src`/`dst`/`rel`). F-01/F-02: routed through the
11
- * store-adapter's `executeRun` query surface (the raw `store.db` handle is
12
- * gone) — same SQL, same semantics.
13
- */
14
- export declare function removeDependencyNode(store: GraphBacklogStore, repo: string, humanId: string, dependsOnHumanId: string): Promise<void>;
15
- export declare function linkRelatedNode(store: GraphBacklogStore, repo: string, humanIdA: string, humanIdB: string): Promise<void>;
16
- /**
17
- * DESIGN.md §14 point 2 (CONFIRMED against the real source): `supersede(oldId,
18
- * newContent, meta)` writes `SUPERSEDES` new -> old, sets `is_superseded=1`
19
- * on the old node, and mints the new node — ALL in one internal transaction.
20
- * It does NOT invalidate the old node (`t_invalid` stays null) — SPEC.md
21
- * §5.5 additionally requires the old item to become bi-temporally invalid
22
- * with `reason`, so this composes `supersede()` with a status update (BEFORE
23
- * invalidation — `touch()`/`mutateMetadata` throw once `t_invalid` is set)
24
- * and a final `invalidate(oldId, reason)`.
25
- */
26
- export declare function supersedeItemNode(store: GraphBacklogStore, repo: string, oldHumanId: string, newInput: CreateItemInput, reason: string): Promise<BacklogItem>;
27
- /** Creates N children, each linked child PART_OF parent. Parent is left open. */
28
- export declare function splitItemNode(store: GraphBacklogStore, repo: string, parentHumanId: string, children: CreateItemInput[]): Promise<BacklogItem[]>;
29
- /**
30
- * `SAME_AS(drop -> keep)` per DESIGN.md §14 point 2 (obsolete -> canonical,
31
- * matching the `supersede()` convention), then `invalidate(drop, reason)`.
32
- * Returns the KEPT item.
33
- */
34
- export declare function mergeItemsNode(store: GraphBacklogStore, repo: string, keepHumanId: string, dropHumanId: string, reason: string): Promise<BacklogItem>;
35
- export declare function setPriorityNode(store: GraphBacklogStore, repo: string, humanId: string, priority: Priority): Promise<BacklogItem>;
36
- export declare function attachToPlanNode(store: GraphBacklogStore, repo: string, humanId: string, planSlug: string): Promise<void>;
37
- export declare function assignItemNode(store: GraphBacklogStore, repo: string, humanId: string, to: string, by: string): Promise<BacklogItem>;
38
- /**
39
- * BUG-BACKLOG-HUMANID-COLLISION-001 fix #3 (repair primitive): re-ids a
40
- * single, `nodeId`-scoped live backlog item to a new `humanId` within the
41
- * same `repo`. `nodeId`-scoped (not `(repo, oldHumanId)`-keyed) so this is
42
- * unambiguous EVEN under the exact collision it exists to repair — every
43
- * other `(repo, humanId)`-keyed lookup in this file would throw
44
- * `AmbiguousHumanIdError` on a colliding key (fix #2, `findItemNode`), so a
45
- * repair tool needs a way in that doesn't go through that same lookup.
46
- *
47
- * There is no tool-level rename/re-id operation exposed anywhere in this
48
- * store today (the backlog item's fix direction #5 explicitly calls this
49
- * gap out) — this is that primitive, added as part of this fix, kept
50
- * store-internal (not wired to `client.ts`/the MCP surface) since it is a
51
- * narrow one-off repair tool, not a general-purpose end-user operation.
52
- *
53
- * Guards:
54
- * - the node at `nodeId` must be live and its CURRENT `metadata.humanId`
55
- * must equal `oldHumanId` (sanity check — refuses to rename the wrong
56
- * node out from under a caller who mis-copied a nodeId).
57
- * - `newHumanId` must not already resolve to a DIFFERENT live node in this
58
- * `repo` (refuses to rename INTO a fresh collision).
59
- * - re-derives `kind`/`family` from `newHumanId`, rebuilds `tags` (swapping
60
- * the old kind/family tags for the new ones, preserving every other
61
- * user tag) and the node `name`/`content`/`content_hash` (which both bake
62
- * in `repo::humanId` — DESIGN.md §2.2, mapping.ts's `buildNodeName`/
63
- * `buildNodeContent`) so the renamed node is indistinguishable from one
64
- * that was always minted under `newHumanId`.
65
- */
66
- export declare function renameHumanIdNode(store: GraphBacklogStore, repo: string, nodeId: number, oldHumanId: string, newHumanId: string): Promise<BacklogItem>;