@bendyline/docblocks 2.6.1 → 2.7.0

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 (62) hide show
  1. package/THIRD_PARTY_NOTICES.txt +33 -33
  2. package/dist/capabilities-CdQAc745.d.ts +1233 -0
  3. package/dist/catalog-BQK05tne.d.ts +122 -0
  4. package/dist/chunk-245W57QP.js +31 -0
  5. package/dist/{chunk-2WDJ27EH.js → chunk-46AGYHDY.js} +8 -0
  6. package/dist/{chunk-4437YWLE.js → chunk-6UPO2GE6.js} +4 -2
  7. package/dist/{chunk-UMWCTEXW.js → chunk-7SN7YQL4.js} +211 -40
  8. package/dist/{chunk-OQCPBOQA.js → chunk-DAPFSEKY.js} +35 -0
  9. package/dist/{chunk-M62ZGJ5I.js → chunk-HABG2JM3.js} +0 -17
  10. package/dist/{chunk-YM7O3PWO.js → chunk-HKOOHM67.js} +20 -12
  11. package/dist/chunk-IDYE73TU.js +77 -0
  12. package/dist/{chunk-KLQKU74Q.js → chunk-IGB2VSRE.js} +124 -330
  13. package/dist/{chunk-BVY7GGNV.js → chunk-L6PRMR7T.js} +137 -95
  14. package/dist/chunk-LPIJ6HKL.js +19 -0
  15. package/dist/{chunk-SJBB5OD7.js → chunk-QS5WTLUZ.js} +10 -8
  16. package/dist/chunk-R2JX5N3F.js +382 -0
  17. package/dist/{chunk-ZO7G53QP.js → chunk-UDEWLHQI.js} +4 -2
  18. package/dist/chunk-UK7R3RC7.js +514 -0
  19. package/dist/chunk-XTNWCNSK.js +464 -0
  20. package/dist/chunk-YHSFRPBS.js +42 -0
  21. package/dist/chunk-YNUQG4GF.js +1173 -0
  22. package/dist/document/index.d.ts +31 -1
  23. package/dist/document/index.js +7 -6
  24. package/dist/filesystem/electron.d.ts +8 -34
  25. package/dist/filesystem/electron.js +7 -4
  26. package/dist/filesystem/host.d.ts +28 -0
  27. package/dist/filesystem/host.js +103 -0
  28. package/dist/filesystem/index.d.ts +52 -6
  29. package/dist/filesystem/index.js +36 -15
  30. package/dist/filesystem/indexeddb.d.ts +8 -1
  31. package/dist/filesystem/indexeddb.js +7 -6
  32. package/dist/filesystem/memory.d.ts +2 -1
  33. package/dist/filesystem/memory.js +3 -2
  34. package/dist/filesystem/native.d.ts +2 -1
  35. package/dist/filesystem/native.js +3 -2
  36. package/dist/filesystem-v2-C8AdSXUN.d.ts +74 -0
  37. package/dist/host/index.d.ts +127 -5
  38. package/dist/host/index.js +100 -4
  39. package/dist/host/mobile.d.ts +389 -0
  40. package/dist/host/mobile.js +315 -0
  41. package/dist/host-provider-v2-CyLTRKJF.d.ts +51 -0
  42. package/dist/index.d.ts +8 -5
  43. package/dist/index.js +153 -34
  44. package/dist/mcp/index.d.ts +2 -2
  45. package/dist/mcp/zod.d.ts +23 -1
  46. package/dist/mcp/zod.js +1 -0
  47. package/dist/settings-HrrCikVX.d.ts +170 -0
  48. package/dist/types-BvDnr3YU.d.ts +88 -0
  49. package/dist/{types-Oy9U5FST.d.ts → types-d0yvHUJz.d.ts} +6 -0
  50. package/dist/{types-Bb3yccTH.d.ts → v2-BVnZZyd4.d.ts} +1 -86
  51. package/dist/vscode/index.d.ts +43 -1
  52. package/dist/vscode/index.js +67 -1
  53. package/dist/workspace/index.d.ts +10 -6
  54. package/dist/workspace/index.js +4 -2
  55. package/dist/workspace-index/index.d.ts +240 -0
  56. package/dist/workspace-index/index.js +1287 -0
  57. package/dist/workspace-settings/index.d.ts +301 -0
  58. package/dist/workspace-settings/index.js +820 -0
  59. package/package.json +22 -2
  60. package/dist/chunk-6XHOOBYF.js +0 -36
  61. package/dist/chunk-QI6YKTQV.js +0 -110
  62. package/dist/types-DBYraXxE.d.ts +0 -557
@@ -0,0 +1,301 @@
1
+ import { R as ResolvedCatalogOutputs, W as WorkspaceSettings, a as WorkspaceSettingsPatch } from '../settings-HrrCikVX.js';
2
+ export { b as CATALOG_JSON_CONTENT_MODES, c as CATALOG_SORT_ORDERS, d as CatalogJsonContent, e as CatalogOutputKind, C as CatalogSortOrder, D as DEFAULT_CATALOG_HTML_PATH, f as DEFAULT_CATALOG_JSON_PATH, g as DEFAULT_CATALOG_TITLE, E as EMPTY_WORKSPACE_SETTINGS, U as UnsupportedWorkspaceSettingsVersionError, h as WORKSPACE_SETTINGS_DIRECTORY, i as WORKSPACE_SETTINGS_LIMITS, j as WORKSPACE_SETTINGS_PATH, k as WORKSPACE_SETTINGS_VERSION, l as WORKSPACE_THEME_ID_PATTERN, m as WorkspaceCatalogHtmlSettings, n as WorkspaceCatalogJsonSettings, o as WorkspaceCatalogSettings, p as WorkspaceDocumentSettings, q as WorkspaceSettingsParseResult, r as WorkspaceVersionHistorySettings, s as applyWorkspaceSettingsPatch, t as checkCatalogOutputPath, u as diffWorkspaceSettings, v as isDefaultWorkspaceSettings, w as isEmptyWorkspaceSettingsPatch, x as parseWorkspaceSettings, y as parseWorkspaceSettingsPatch, z as parseWorkspaceSettingsText, A as resolveCatalogOutputs, B as resolveFallbackThemeId, F as resolveWorkspaceDefaultThemeId, G as resolveWorkspaceVersioningEnabled, H as serializeWorkspaceSettings, I as tryApplyWorkspaceSettingsPatch, J as validateCatalogOutputPath } from '../settings-HrrCikVX.js';
3
+ import { C as CatalogEntry, W as WorkspaceCatalog } from '../catalog-BQK05tne.js';
4
+ export { a as CATALOG_FORMAT_VERSION, b as CATALOG_GENERATOR, c as CATALOG_LIMITS, d as CatalogDocumentFormat, e as CatalogEntryHints, f as CatalogOutlineEntry, g as CatalogSource, O as OUTSIDE_IN_FORMAT_IDS, h as OutsideInFormatId, i as OutsideInLayout, j as buildCatalogMarkdownDocument, k as catalogEntryForUnreadable, l as catalogEntryFromDocument, m as catalogEntryFromMarkdown, n as chooseOutsideInMarkdownPath, o as createWorkspaceCatalog, p as isGeneratedCatalogHtml, q as isGeneratedCatalogJson, r as readCatalogHtmlDigest, s as relativeCatalogLink, t as relocateOutsideInLayout, u as resolveOutsideInLayout, v as serializeCatalogJson, w as sortCatalogEntries, x as stampCatalogHtml } from '../catalog-BQK05tne.js';
5
+ import { MarkdownDocument } from '@bendyline/squisq/markdown';
6
+ import { u as FileSystemVersion, n as FileSystemProviderV2 } from '../v2-BVnZZyd4.js';
7
+ import { a as WorkspacePath } from '../workspace-path-CWVrcuPL.js';
8
+
9
+ /**
10
+ * JSON Schema (draft-07) for `.docblocks/workspace.json`, used for editor
11
+ * validation and completion (VS Code `contributes.jsonValidation`). The
12
+ * runtime parser in `settings.ts` remains the authority; tests keep the two
13
+ * aligned.
14
+ */
15
+ declare const WORKSPACE_SETTINGS_JSON_SCHEMA: {
16
+ readonly $schema: "http://json-schema.org/draft-07/schema#";
17
+ readonly title: "DocBlocks workspace settings";
18
+ readonly description: "Settings shared by everyone who opens this folder in DocBlocks. Every section is optional.";
19
+ readonly type: "object";
20
+ readonly additionalProperties: false;
21
+ readonly required: readonly ["version"];
22
+ readonly properties: {
23
+ readonly $schema: {
24
+ readonly type: "string";
25
+ readonly maxLength: 2048;
26
+ };
27
+ readonly version: {
28
+ readonly const: 1;
29
+ readonly description: "Settings format version.";
30
+ };
31
+ readonly documents: {
32
+ readonly type: "object";
33
+ readonly additionalProperties: false;
34
+ readonly properties: {
35
+ readonly defaultTheme: {
36
+ readonly description: "Theme for documents whose frontmatter does not name one. A document’s own theme always wins.";
37
+ readonly type: "string";
38
+ readonly pattern: string;
39
+ };
40
+ };
41
+ };
42
+ readonly versionHistory: {
43
+ readonly type: "object";
44
+ readonly additionalProperties: false;
45
+ readonly properties: {
46
+ readonly enabled: {
47
+ readonly type: "boolean";
48
+ readonly description: "Keep prior revisions for documents in this folder. Omit to use the app default.";
49
+ };
50
+ readonly keep: {
51
+ readonly type: "integer";
52
+ readonly minimum: 1;
53
+ readonly maximum: 1000;
54
+ readonly description: "Revisions kept per document.";
55
+ };
56
+ };
57
+ };
58
+ readonly catalog: {
59
+ readonly type: "object";
60
+ readonly additionalProperties: false;
61
+ readonly properties: {
62
+ readonly title: {
63
+ readonly type: "string";
64
+ readonly minLength: 1;
65
+ readonly maxLength: 256;
66
+ readonly description: "Catalog heading. Defaults to \"Documents\".";
67
+ };
68
+ readonly sort: {
69
+ readonly enum: readonly ["title", "path", "date"];
70
+ readonly description: "Catalog order. Defaults to \"title\".";
71
+ };
72
+ readonly exclude: {
73
+ readonly type: "array";
74
+ readonly maxItems: 64;
75
+ readonly items: {
76
+ readonly type: "string";
77
+ readonly minLength: 1;
78
+ readonly maxLength: 1024;
79
+ };
80
+ readonly description: "Workspace-relative folders or files left out of the catalog.";
81
+ };
82
+ readonly html: {
83
+ readonly type: "object";
84
+ readonly additionalProperties: false;
85
+ readonly properties: {
86
+ readonly enabled: {
87
+ readonly type: "boolean";
88
+ readonly description: "Regenerate the catalog page on every save.";
89
+ };
90
+ readonly path: {
91
+ readonly pattern: "\\.html?$";
92
+ readonly description: "Catalog page path. Defaults to \"index.html\".";
93
+ readonly type: "string";
94
+ readonly minLength: 1;
95
+ readonly maxLength: 1024;
96
+ };
97
+ readonly theme: {
98
+ readonly description: "Theme for the catalog page only.";
99
+ readonly type: "string";
100
+ readonly pattern: string;
101
+ };
102
+ };
103
+ };
104
+ readonly json: {
105
+ readonly type: "object";
106
+ readonly additionalProperties: false;
107
+ readonly properties: {
108
+ readonly enabled: {
109
+ readonly type: "boolean";
110
+ readonly description: "Regenerate the catalog data on every save.";
111
+ };
112
+ readonly path: {
113
+ readonly pattern: "\\.json$";
114
+ readonly description: "Catalog data path. Defaults to \"catalog.json\".";
115
+ readonly type: "string";
116
+ readonly minLength: 1;
117
+ readonly maxLength: 1024;
118
+ };
119
+ readonly content: {
120
+ readonly enum: readonly ["metadata", "markdown"];
121
+ readonly description: "\"metadata\" (default) or \"markdown\" to include each document’s source.";
122
+ };
123
+ };
124
+ };
125
+ };
126
+ };
127
+ };
128
+ };
129
+
130
+ /**
131
+ * Regenerate a workspace's catalog outputs (catalog JSON and catalog HTML).
132
+ *
133
+ * One filesystem-agnostic implementation serves every surface: the shell
134
+ * passes its v2 provider, the VS Code extension host and the CLI pass small
135
+ * adapters over `vscode.workspace.fs` and `node:fs`. The HTML renderer is
136
+ * injected so core never depends on `@bendyline/squisq-formats`.
137
+ *
138
+ * Safety rules, all enforced here rather than by callers:
139
+ * - Outputs are written only when enabled in settings.
140
+ * - An existing file is replaced only when it carries the DocBlocks catalog
141
+ * marker; a hand-written `index.html` is never clobbered.
142
+ * - Writes are skipped when bytes (or the HTML inputs digest) are unchanged,
143
+ * so watchers, git, and sync clients see no churn.
144
+ * - The walk is budgeted; over budget nothing is written rather than a
145
+ * truncated catalog.
146
+ */
147
+
148
+ type WorkspaceOutputsIO = Pick<FileSystemProviderV2, 'stat' | 'readFile' | 'readDirectory' | 'writeFile'>;
149
+ interface WorkspaceOutputsRenderer {
150
+ /** Render the catalog AST as a complete, themed, script-free HTML page. */
151
+ renderCatalogHtml(document: MarkdownDocument, options: {
152
+ readonly title: string;
153
+ readonly themeId: string | undefined;
154
+ }): string | Promise<string>;
155
+ /** Parse rendered HTML that has no Markdown companion yet. Optional. */
156
+ importHtml?(html: string): MarkdownDocument | Promise<MarkdownDocument>;
157
+ }
158
+ declare const WORKSPACE_OUTPUT_LIMITS: {
159
+ readonly maxDocuments: 5000;
160
+ readonly maxDirectories: 20000;
161
+ readonly maxDepth: 32;
162
+ readonly maxDocumentBytes: number;
163
+ readonly maxTotalBytes: number;
164
+ readonly maxOutputBytes: number;
165
+ };
166
+ type WorkspaceOutputLimits = {
167
+ readonly [K in keyof typeof WORKSPACE_OUTPUT_LIMITS]: number;
168
+ };
169
+ /** The walk exceeded a budget; nothing was written. */
170
+ declare class WorkspaceOutputsLimitError extends Error {
171
+ constructor(message: string);
172
+ }
173
+ interface CachedEntry {
174
+ readonly readPath: string;
175
+ readonly version: FileSystemVersion;
176
+ readonly includeMarkdown: boolean;
177
+ /** null records a file that is deliberately not listed (a generated catalog page). */
178
+ readonly entry: CatalogEntry | null;
179
+ }
180
+ /** Per-document extraction cache keyed by path + provider version. Reuse it across runs. */
181
+ type WorkspaceCatalogCache = Map<string, CachedEntry>;
182
+ declare function createWorkspaceCatalogCache(): WorkspaceCatalogCache;
183
+ interface RefreshWorkspaceOutputsOptions {
184
+ readonly cache?: WorkspaceCatalogCache;
185
+ readonly signal?: AbortSignal;
186
+ /** Rewrite the HTML page even when its inputs digest is unchanged. */
187
+ readonly force?: boolean;
188
+ /** Compute everything, write nothing. */
189
+ readonly dryRun?: boolean;
190
+ readonly limits?: Partial<WorkspaceOutputLimits>;
191
+ }
192
+ type WorkspaceOutputStatus = 'written' | 'unchanged' | 'blocked' | 'would-write';
193
+ interface WorkspaceOutputResult {
194
+ readonly kind: 'html' | 'json';
195
+ readonly path: WorkspacePath;
196
+ readonly status: WorkspaceOutputStatus;
197
+ readonly message?: string;
198
+ /** True when this run created the file (it did not exist before). */
199
+ readonly created?: true;
200
+ }
201
+ interface WorkspaceOutputsResult {
202
+ readonly documentCount: number;
203
+ readonly outputs: readonly WorkspaceOutputResult[];
204
+ }
205
+ /**
206
+ * Whether a changed path can affect the catalog. Used by schedulers to ignore
207
+ * their own output writes, version snapshots, and other hidden bookkeeping.
208
+ * `.docblocks/` changes are settings changes, handled by the caller.
209
+ */
210
+ declare function isCatalogRelevantPath(path: string, settings: WorkspaceSettings | null | undefined): boolean;
211
+ /** True for the workspace settings directory or anything inside it. */
212
+ declare function isWorkspaceSettingsPath(path: string): boolean;
213
+ /** Walk the workspace and build its catalog without writing anything. */
214
+ declare function collectWorkspaceCatalog(io: WorkspaceOutputsIO, resolved: ResolvedCatalogOutputs, renderer: Pick<WorkspaceOutputsRenderer, 'importHtml'>, options?: Omit<RefreshWorkspaceOutputsOptions, 'force' | 'dryRun'>): Promise<WorkspaceCatalog>;
215
+ /**
216
+ * Regenerate every enabled catalog output for one workspace. Throws
217
+ * {@link WorkspaceOutputsLimitError} when over budget, `FsError('aborted')`
218
+ * when cancelled, and propagates storage errors (including `conflict` when a
219
+ * concurrent writer won, which callers should answer with one re-run).
220
+ */
221
+ declare function refreshWorkspaceOutputs(io: WorkspaceOutputsIO, settings: WorkspaceSettings | null | undefined, renderer: WorkspaceOutputsRenderer, options?: RefreshWorkspaceOutputsOptions): Promise<WorkspaceOutputsResult>;
222
+
223
+ /**
224
+ * Read and write `.docblocks/workspace.json` through a workspace's v2
225
+ * provider (or any adapter with the same read/write contract). Every surface
226
+ * shares these conflict and merge rules.
227
+ */
228
+
229
+ /** The two operations settings persistence needs. */
230
+ type WorkspaceSettingsIO = Pick<FileSystemProviderV2, 'readFile' | 'writeFile'>;
231
+ type WorkspaceSettingsStatus = 'unavailable' | 'loading' | 'missing' | 'ready' | 'invalid' | 'unsupported-version' | 'error';
232
+ interface WorkspaceSettingsState {
233
+ readonly status: WorkspaceSettingsStatus;
234
+ /** Settings in effect; null unless the file is missing (defaults) or valid. */
235
+ readonly settings: WorkspaceSettings | null;
236
+ /** Version of the file that `settings` came from; null when it does not exist. */
237
+ readonly version: FileSystemVersion | null;
238
+ /** Why the file cannot be used or changed, for display. */
239
+ readonly message: string | null;
240
+ }
241
+ declare const UNAVAILABLE_WORKSPACE_SETTINGS: WorkspaceSettingsState;
242
+ declare const LOADING_WORKSPACE_SETTINGS: WorkspaceSettingsState;
243
+ /** Only a missing file or a valid current-version file may be written. */
244
+ declare function isWorkspaceSettingsWritable(state: WorkspaceSettingsState): boolean;
245
+ declare function readWorkspaceSettings(provider: WorkspaceSettingsIO): Promise<WorkspaceSettingsState>;
246
+ /**
247
+ * Apply a field-level patch on top of the file version the caller last
248
+ * observed. When another window or a git pull changed the file meanwhile,
249
+ * re-read it and apply the same patch once more so neither edit is lost.
250
+ * A file that turned invalid or newer is never overwritten, and a missing file
251
+ * is not created when the result would only hold defaults.
252
+ */
253
+ declare function saveWorkspaceSettingsPatch(provider: WorkspaceSettingsIO, observed: WorkspaceSettingsState, patch: WorkspaceSettingsPatch): Promise<WorkspaceSettingsState>;
254
+
255
+ /**
256
+ * Keeps a workspace's catalog outputs (`index.html`, `catalog.json`) current.
257
+ *
258
+ * One scheduler serves one workspace. Document commits and file-tree changes
259
+ * call `notify(path)`; the scheduler debounces them (with a maximum wait so a
260
+ * long typing session still refreshes), runs one refresh at a time, and
261
+ * re-runs once when changes arrived mid-run. Its own output writes, version
262
+ * snapshots, and other hidden bookkeeping never trigger a run. Disposing it
263
+ * (workspace switch) cancels any in-flight walk.
264
+ */
265
+
266
+ interface WorkspaceOutputsStatus {
267
+ readonly state: 'idle' | 'pending' | 'running' | 'done' | 'error';
268
+ readonly result: WorkspaceOutputsResult | null;
269
+ /** A run failure, or the first blocked output's explanation. */
270
+ readonly message: string | null;
271
+ }
272
+ declare const IDLE_WORKSPACE_OUTPUTS_STATUS: WorkspaceOutputsStatus;
273
+ interface WorkspaceOutputsScheduler {
274
+ readonly workspaceId: string;
275
+ /** A document or folder changed. Paths that cannot affect the catalog are ignored. */
276
+ notify(path?: string): void;
277
+ /** Run now if a refresh is pending. */
278
+ flush(): void;
279
+ /** Run now regardless of pending changes. */
280
+ regenerate(options?: {
281
+ readonly force?: boolean;
282
+ }): Promise<WorkspaceOutputsStatus>;
283
+ updateSettings(settings: WorkspaceSettings | null): void;
284
+ getStatus(): WorkspaceOutputsStatus;
285
+ subscribe(listener: () => void): () => void;
286
+ dispose(): void;
287
+ }
288
+ interface WorkspaceOutputsSchedulerOptions {
289
+ readonly workspaceId: string;
290
+ readonly provider: WorkspaceOutputsIO;
291
+ readonly settings: WorkspaceSettings | null;
292
+ /** The renderer, or a loader so rendering code loads only once a catalog is enabled. */
293
+ readonly renderer: WorkspaceOutputsRenderer | (() => Promise<WorkspaceOutputsRenderer>);
294
+ readonly debounceMs?: number;
295
+ readonly maxWaitMs?: number;
296
+ }
297
+ declare const WORKSPACE_OUTPUTS_DEBOUNCE_MS = 2500;
298
+ declare const WORKSPACE_OUTPUTS_MAX_WAIT_MS = 20000;
299
+ declare function createWorkspaceOutputsScheduler(options: WorkspaceOutputsSchedulerOptions): WorkspaceOutputsScheduler;
300
+
301
+ export { CatalogEntry, IDLE_WORKSPACE_OUTPUTS_STATUS, LOADING_WORKSPACE_SETTINGS, type RefreshWorkspaceOutputsOptions, ResolvedCatalogOutputs, UNAVAILABLE_WORKSPACE_SETTINGS, WORKSPACE_OUTPUTS_DEBOUNCE_MS, WORKSPACE_OUTPUTS_MAX_WAIT_MS, WORKSPACE_OUTPUT_LIMITS, WORKSPACE_SETTINGS_JSON_SCHEMA, WorkspaceCatalog, type WorkspaceCatalogCache, type WorkspaceOutputLimits, type WorkspaceOutputResult, type WorkspaceOutputStatus, type WorkspaceOutputsIO, WorkspaceOutputsLimitError, type WorkspaceOutputsRenderer, type WorkspaceOutputsResult, type WorkspaceOutputsScheduler, type WorkspaceOutputsSchedulerOptions, type WorkspaceOutputsStatus, WorkspaceSettings, type WorkspaceSettingsIO, WorkspaceSettingsPatch, type WorkspaceSettingsState, type WorkspaceSettingsStatus, collectWorkspaceCatalog, createWorkspaceCatalogCache, createWorkspaceOutputsScheduler, isCatalogRelevantPath, isWorkspaceSettingsPath, isWorkspaceSettingsWritable, readWorkspaceSettings, refreshWorkspaceOutputs, saveWorkspaceSettingsPatch };