@adhd/backlog 0.1.3 → 0.1.4
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/cli.d.ts +80 -2
- package/client.d.ts +17 -0
- package/index.d.ts +2 -2
- package/index.js +112 -106
- package/index.mjs +14976 -14192
- package/package.json +13 -12
- package/store/crud.d.ts +33 -0
package/cli.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Operation } from '@adhd/apigen-core-client';
|
|
1
|
+
import { Operation, Plugin } from '@adhd/apigen-core-client';
|
|
2
2
|
import { Scope } from '@adhd/environment-base-spec';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -26,6 +26,72 @@ import { Scope } from '@adhd/environment-base-spec';
|
|
|
26
26
|
* table the way a hardcoded `['backlog']` constant would.
|
|
27
27
|
*/
|
|
28
28
|
export declare function resolveCommandPrefix(operations: readonly Operation[]): string[];
|
|
29
|
+
/**
|
|
30
|
+
* The exact `--use` mount-plugin array `runBacklogCli` hands to
|
|
31
|
+
* `cliPlugin.run()`'s `options.usePlugins` AND the array
|
|
32
|
+
* {@link resolveMountNamespaces} derives reserved top-level segments from —
|
|
33
|
+
* the SAME array reference, never two independently-written lists, so the
|
|
34
|
+
* two can never drift apart (that drift is exactly what made the old
|
|
35
|
+
* hand-maintained `MOUNT_COMMAND_NAMESPACES` constant go stale).
|
|
36
|
+
*/
|
|
37
|
+
export declare const USE_PLUGINS: readonly Plugin[];
|
|
38
|
+
/**
|
|
39
|
+
* Derives the set of top-level command segments reserved by every mount
|
|
40
|
+
* plugin in `usePlugins`' own synthetic operations, registered SIBLING to
|
|
41
|
+
* (never nested under) `backlog`'s own `['backlog', ...]` namespace.
|
|
42
|
+
*
|
|
43
|
+
* Previously this repo (BUG-BACKLOG-CLI-BATCH-PREFIX-CLOBBER-001) hand-
|
|
44
|
+
* maintained a `MOUNT_COMMAND_NAMESPACES` constant with a doc comment
|
|
45
|
+
* claiming a mount plugin's real synthetic namespace "can only be known by
|
|
46
|
+
* actually invoking its `capabilities.mount.operations(descriptor, …)`, which
|
|
47
|
+
* needs a real `Descriptor` this file does not have before dispatch" — that
|
|
48
|
+
* claim was WRONG, verified by reading source rather than assumed:
|
|
49
|
+
*
|
|
50
|
+
* 1. `runBacklogCli` DOES have a real descriptor's ingredients at the exact
|
|
51
|
+
* point this is called — `operations` (from `buildBacklogApigenPackage`)
|
|
52
|
+
* is real, already-extracted `Operation[]`, and the host string is the
|
|
53
|
+
* same `pkg.id` (`'backlog'`) that
|
|
54
|
+
* `apigen-plugin-cli-output`'s `run()` itself uses for the identical
|
|
55
|
+
* purpose (`packages/apigen/apigen-plugin-cli-output/src/lib/run.ts`:
|
|
56
|
+
* `const mountHost = input.packages[0]?.id ?? 'ts';`).
|
|
57
|
+
* 2. `batchPlugin.capabilities.mount.operations(descriptor, opts, hostBridge)`
|
|
58
|
+
* (`packages/apigen/apigen-plugin-batch/src/lib/plugin.ts`,
|
|
59
|
+
* `buildBatchOperations`) delegates to `buildBatchMountedOperations`
|
|
60
|
+
* (`packages/apigen/apigen-core-client/src/lib/batch.ts`) to compute
|
|
61
|
+
* every mounted operation's SHAPE — including `namespace`/`path`, since
|
|
62
|
+
* `MountedOperation extends Operation`
|
|
63
|
+
* (`apigen-core-client/src/lib/plugin.ts:422`) — and only uses
|
|
64
|
+
* `hostBridge` AFTERWARD, separately, to build each shape's `.handler`
|
|
65
|
+
* (`buildBatchHandler(shape.operationIds, hostBridge)`, same file). The
|
|
66
|
+
* handler closure simply captures `hostBridge` (including `undefined`)
|
|
67
|
+
* without dereferencing it — `buildBatchOperations`/`operations()` never
|
|
68
|
+
* throw when `hostBridge` is omitted; only actually CALLING the built
|
|
69
|
+
* handler with a missing bridge throws
|
|
70
|
+
* (`packages/apigen/apigen-plugin-batch/src/lib/plugin.ts:148`,
|
|
71
|
+
* `if (!hostBridge) { throw … }` inside `buildBatchHandler`, never
|
|
72
|
+
* inside `operations()`). So calling `operations(descriptor, opts)` with
|
|
73
|
+
* `hostBridge` omitted is safe for path-derivation purposes: the
|
|
74
|
+
* returned ops' handlers would be broken if invoked, but this function
|
|
75
|
+
* never invokes them, only reads `.namespace`/`.path`.
|
|
76
|
+
* 3. `buildBatchMountedOperations` (`apigen-core-client/src/lib/batch.ts`)
|
|
77
|
+
* is cheap — it groups already-extracted `descriptor.operations` by kind
|
|
78
|
+
* and derives JSON-Schema fragments from them; it does no ts-morph
|
|
79
|
+
* parsing or schema generation of its own, so calling it once per CLI
|
|
80
|
+
* invocation (in addition to the identical call `run()` itself makes
|
|
81
|
+
* later) has no measurable cost.
|
|
82
|
+
*
|
|
83
|
+
* So this is derived dynamically instead: for each plugin in `usePlugins`
|
|
84
|
+
* exposing a `mount` capability, call `capabilities.mount.operations(...)`
|
|
85
|
+
* (no `hostBridge`) and project each returned op's real CLI top-level
|
|
86
|
+
* segment via `@adhd/apigen-engine-naming`'s `project(op).cli.path[0]` — the
|
|
87
|
+
* SAME derivation `resolveCommandPrefix` above uses for `backlog`'s own
|
|
88
|
+
* prefix. Adding a future mount plugin to {@link USE_PLUGINS} now
|
|
89
|
+
* automatically and correctly extends the reserved set with zero separate
|
|
90
|
+
* bookkeeping — it can never again silently go stale the way the old
|
|
91
|
+
* hardcoded set did the moment a second mount plugin was added without
|
|
92
|
+
* remembering to update it too.
|
|
93
|
+
*/
|
|
94
|
+
export declare function resolveMountNamespaces(usePlugins: readonly Plugin[], operations: readonly Operation[], host: string): Set<string>;
|
|
29
95
|
/**
|
|
30
96
|
* Prepends `prefix` (the real, namespace-qualified command path segments
|
|
31
97
|
* every `client.ts` export shares — see {@link resolveCommandPrefix}) to a
|
|
@@ -44,8 +110,20 @@ export declare function resolveCommandPrefix(operations: readonly Operation[]):
|
|
|
44
110
|
* BEFORE ever consulting the command table
|
|
45
111
|
* (`if (argv.length === 0 || argv[0] === '--help' || argv[0] === '-h')`),
|
|
46
112
|
* so prefixing here would shadow that check and break `backlog --help`.
|
|
113
|
+
* - Argv whose first token is a reserved mount-namespace segment (per
|
|
114
|
+
* {@link resolveMountNamespaces}'s dynamically-derived set — currently
|
|
115
|
+
* just `batch`, from {@link USE_PLUGINS}) is returned unchanged — that
|
|
116
|
+
* command is registered at the CLI's top level by a mount plugin, never
|
|
117
|
+
* under `backlog`'s own namespace; prefixing it would make it
|
|
118
|
+
* unresolvable.
|
|
119
|
+
*
|
|
120
|
+
* `reservedNamespaces` has no default — the real call site
|
|
121
|
+
* (`runBacklogCli`) always passes a freshly-derived
|
|
122
|
+
* `resolveMountNamespaces(...)` result; the caller must supply one
|
|
123
|
+
* explicitly (an empty `Set` for a caller with no mount plugins) so this
|
|
124
|
+
* can never silently fall back to a stale hardcoded default.
|
|
47
125
|
*/
|
|
48
|
-
export declare function prefixCommand(userArgv: readonly string[], prefix: readonly string[]): string[];
|
|
126
|
+
export declare function prefixCommand(userArgv: readonly string[], prefix: readonly string[], reservedNamespaces: ReadonlySet<string>): string[];
|
|
49
127
|
export interface RunBacklogCliOpts {
|
|
50
128
|
scope?: Scope;
|
|
51
129
|
/** Test-only override — see `buildBacklogEnv`'s `BuildBacklogEnvOptions`. */
|
package/client.d.ts
CHANGED
|
@@ -126,3 +126,20 @@ export declare function migrationStatus(ctx: BacklogCtx): Promise<MigrationStatu
|
|
|
126
126
|
* DoD, never speculatively.
|
|
127
127
|
*/
|
|
128
128
|
export declare function setMigrationPhase(ctx: BacklogCtx, phase: MigrationPhase): Promise<SetMigrationPhaseResult>;
|
|
129
|
+
export interface BacklogVersionInfo {
|
|
130
|
+
/** This package's real `package.json` name, e.g. `"@adhd/backlog"`. */
|
|
131
|
+
name: string;
|
|
132
|
+
/** This package's real `package.json` version — never hardcoded. */
|
|
133
|
+
version: string;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Reports this running package's own real `name`/`version`, read fresh from
|
|
137
|
+
* `package.json` on every call (never a compiled-in constant, so a
|
|
138
|
+
* republished build can never drift from what this reports). `ctx` is
|
|
139
|
+
* unused — kept for signature consistency with every other `client.ts`
|
|
140
|
+
* export (the `ctx-name-only` invariant every extraction/mount/CLI-dispatch
|
|
141
|
+
* path in this package assumes, per this file's own top-of-file doc
|
|
142
|
+
* comment) rather than special-casing a bare, ctx-less export whose
|
|
143
|
+
* extraction/dispatch behavior has not been verified.
|
|
144
|
+
*/
|
|
145
|
+
export declare function version(ctx: BacklogCtx): Promise<BacklogVersionInfo>;
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { addCitation, addDependency, appendNote, archiveResolved, assignItem, attachToPlan, auditTrail, blockers, claimItem, createItem, dependencyGraph, exportJson, getItem, importFromMarkdown, linkRelated, listItems, mergeItems, migrationStatus, readyItems, releaseClaim, removeDependency, renderToMarkdown, renewClaim, resolveItem, setMigrationPhase, setPriority, softDeleteItem, spotlight, splitItem, staleClaims, startWork, stats, supersedeItem, topoOrder, transitionStatus, updateItem, } from './client.js';
|
|
2
|
-
export type { BacklogCtx } from './client.js';
|
|
1
|
+
export { addCitation, addDependency, appendNote, archiveResolved, assignItem, attachToPlan, auditTrail, blockers, claimItem, createItem, dependencyGraph, exportJson, getItem, importFromMarkdown, linkRelated, listItems, mergeItems, migrationStatus, readyItems, releaseClaim, removeDependency, renderToMarkdown, renewClaim, resolveItem, setMigrationPhase, setPriority, softDeleteItem, spotlight, splitItem, staleClaims, startWork, stats, supersedeItem, topoOrder, transitionStatus, updateItem, version, } from './client.js';
|
|
2
|
+
export type { BacklogCtx, BacklogVersionInfo } from './client.js';
|
|
3
3
|
export { startBacklogServer, buildBacklogApigenPackage } from './server.js';
|
|
4
4
|
export type { StartOpts } from './server.js';
|
|
5
5
|
export { runBacklogCli, resolveCommandPrefix, prefixCommand } from './cli.js';
|