@tackup/cli 0.0.0 → 0.1.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.
- package/LICENSE +21 -0
- package/README.md +16 -1
- package/dist/builtins/extensions/docs/guides/day-two.md +3 -0
- package/dist/builtins/extensions/docs/guides/onboarding-2.md +3 -0
- package/dist/builtins/extensions/docs/guides/onboarding-3.md +3 -0
- package/dist/builtins/extensions/docs/skills/use-tack-docs/SKILL.md +67 -0
- package/dist/builtins/extensions/docs/skills/use-tack-docs/references/declare-docs.md +71 -0
- package/dist/builtins/extensions/docs/skills/use-tack-docs/references/docs-in-profiles.md +25 -0
- package/dist/builtins/extensions/docs/skills/use-tack-docs/references/docs-maintenance.md +35 -0
- package/dist/builtins/extensions/docs/skills/use-tack-docs/references/review.md +34 -0
- package/dist/builtins/extensions/docs/skills/write-reader-figures/SKILL.md +66 -0
- package/dist/builtins/extensions/docs/skills/write-reader-figures/references/figure-components.md +20 -0
- package/dist/builtins/extensions/docs/skills/write-reader-figures/references/figures/architecture-map.md +86 -0
- package/dist/builtins/extensions/docs/skills/write-reader-figures/references/figures/chart.md +52 -0
- package/dist/builtins/extensions/docs/skills/write-reader-figures/references/figures/figure.md +79 -0
- package/dist/builtins/extensions/docs/skills/write-reader-figures/references/figures/file-tree.md +74 -0
- package/dist/builtins/extensions/docs/skills/write-reader-figures/references/figures/schema.md +116 -0
- package/dist/builtins/extensions/docs/skills/write-reader-figures/references/figures/system.md +81 -0
- package/dist/builtins/extensions/docs/skills/write-reader-figures/references/figures/walkthrough.md +45 -0
- package/dist/builtins/extensions/docs/skills/write-reader-figures/references/page-components.md +82 -0
- package/dist/builtins/extensions/docs/skills/write-reader-figures/references/rules.md +27 -0
- package/dist/builtins/extensions/docs/tack.yaml +10 -0
- package/dist/builtins/extensions/scripts/guides/day-two.md +3 -0
- package/dist/builtins/extensions/scripts/guides/onboarding-2.md +3 -0
- package/dist/builtins/extensions/scripts/skills/author-tack-scripts/SKILL.md +48 -0
- package/dist/builtins/extensions/scripts/skills/author-tack-scripts/references/run-scripts.md +23 -0
- package/dist/builtins/extensions/scripts/skills/author-tack-scripts/references/script-api.md +76 -0
- package/dist/builtins/extensions/scripts/skills/author-tack-scripts/references/scripts-in-profiles.md +35 -0
- package/dist/builtins/extensions/scripts/skills/author-tack-scripts/references/scripts-in-sources.md +56 -0
- package/dist/builtins/extensions/scripts/tack.yaml +10 -0
- package/dist/builtins/skills/author-tack-profiles/SKILL.md +68 -0
- package/dist/builtins/skills/author-tack-profiles/references/apply.md +33 -0
- package/dist/builtins/skills/author-tack-profiles/references/bundles.md +59 -0
- package/dist/builtins/skills/author-tack-profiles/references/copy-workflows.md +46 -0
- package/dist/builtins/skills/manage-tack-sources/SKILL.md +75 -0
- package/dist/builtins/skills/manage-tack-sources/references/catalog-issues.md +38 -0
- package/dist/builtins/skills/manage-tack-sources/references/metadata.md +35 -0
- package/dist/builtins/skills/manage-tack-sources/references/tack-yaml.md +114 -0
- package/dist/builtins/skills/manage-tack-sources/references/worked-source.md +126 -0
- package/dist/builtins/skills/prepare-tack-checkout/SKILL.md +52 -0
- package/dist/builtins/skills/use-tack/SKILL.md +65 -0
- package/dist/builtins/skills/use-tack/references/agent-instructions.md +38 -0
- package/dist/builtins/skills/use-tack/references/day-two.md +35 -0
- package/dist/builtins/skills/use-tack/references/explore.md +13 -0
- package/dist/builtins/skills/use-tack/references/imports.md +30 -0
- package/dist/builtins/skills/use-tack/references/maintenance.md +51 -0
- package/dist/builtins/skills/use-tack/references/onboarding-2.md +41 -0
- package/dist/builtins/skills/use-tack/references/onboarding-3.md +29 -0
- package/dist/builtins/skills/use-tack/references/onboarding.md +54 -0
- package/dist/builtins/skills/use-tack/references/output.md +15 -0
- package/dist/builtins/skills/use-tack/references/selection.md +61 -0
- package/dist/builtins/skills/use-tack/references/setup.md +69 -0
- package/dist/builtins/tack.yaml +10 -0
- package/dist/bundle-support-ZGTM5CTZ.js +16 -0
- package/dist/chunk-CFUDY2NO.js +1791 -0
- package/dist/chunk-CRQMJGMU.js +225 -0
- package/dist/chunk-DCX5T7CG.js +281 -0
- package/dist/chunk-EZ5C7B2M.js +28 -0
- package/dist/chunk-H4AG4WIV.js +52 -0
- package/dist/chunk-I5RMMV2Y.js +18013 -0
- package/dist/chunk-JL3E32X5.js +92 -0
- package/dist/chunk-MR5PTCYF.js +26 -0
- package/dist/chunk-PHQL7OBB.js +162 -0
- package/dist/chunk-QQBCYPJZ.js +5733 -0
- package/dist/chunk-T6JAU547.js +12401 -0
- package/dist/chunk-W7GHLGII.js +16 -0
- package/dist/chunk-XARHV5M4.js +56 -0
- package/dist/chunk-XZH2XPII.js +1017 -0
- package/dist/chunk-ZT6BO7LG.js +36671 -0
- package/dist/corpus-effects-YWG5VVHJ.js +12069 -0
- package/dist/elk.bundled-EVXDSFFG.js +94125 -0
- package/dist/main-JHULX3QY.js +65517 -0
- package/dist/main.js +17 -0
- package/dist/reader/visuals.tsx +368 -0
- package/dist/script.d.ts +133 -0
- package/dist/script.js +90 -0
- package/dist/server-XF7NSYRQ.js +308 -0
- package/dist/src-DZKPD6VY.js +1871 -0
- package/dist/src-TC3RTKIS.js +1126 -0
- package/dist/tack-env.d.ts +137 -0
- package/dist/third-party-licenses.txt +2467 -0
- package/dist/worker-ZFY6P7X5.js +24246 -0
- package/package.json +29 -3
|
@@ -0,0 +1,1871 @@
|
|
|
1
|
+
import { createRequire as tackCreateRequire } from "node:module"; const require = tackCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
Reader,
|
|
4
|
+
ReaderCorpus
|
|
5
|
+
} from "./chunk-MR5PTCYF.js";
|
|
6
|
+
import {
|
|
7
|
+
docsIconCategories,
|
|
8
|
+
lucideVersion,
|
|
9
|
+
searchDocsIcons
|
|
10
|
+
} from "./chunk-JL3E32X5.js";
|
|
11
|
+
import "./chunk-EZ5C7B2M.js";
|
|
12
|
+
import {
|
|
13
|
+
DocsDestinationSchema,
|
|
14
|
+
DocsHost,
|
|
15
|
+
DocsResourceReferenceSchema,
|
|
16
|
+
ExtensionFailure,
|
|
17
|
+
ReviewBatchSchema,
|
|
18
|
+
SessionStopped,
|
|
19
|
+
SourceRegistrationIdSchema,
|
|
20
|
+
docsAttach,
|
|
21
|
+
docsConfigure,
|
|
22
|
+
docsDetach,
|
|
23
|
+
docsIcons,
|
|
24
|
+
docsList,
|
|
25
|
+
docsReviewWait,
|
|
26
|
+
docsSearch,
|
|
27
|
+
docsServe,
|
|
28
|
+
docsSettingsOf,
|
|
29
|
+
docsSliceOf,
|
|
30
|
+
docsTarget,
|
|
31
|
+
extensionDirectory,
|
|
32
|
+
implementFor,
|
|
33
|
+
maximumSearchLimit,
|
|
34
|
+
plural,
|
|
35
|
+
sha256,
|
|
36
|
+
skippedCheck,
|
|
37
|
+
sorted
|
|
38
|
+
} from "./chunk-T6JAU547.js";
|
|
39
|
+
import {
|
|
40
|
+
Clock_exports,
|
|
41
|
+
Duration_exports,
|
|
42
|
+
Effect_exports,
|
|
43
|
+
Exit_exports,
|
|
44
|
+
FileSystem_exports,
|
|
45
|
+
Match_exports,
|
|
46
|
+
Option_exports,
|
|
47
|
+
Path_exports,
|
|
48
|
+
Predicate_exports,
|
|
49
|
+
Queue_exports,
|
|
50
|
+
Schema_exports,
|
|
51
|
+
Stdio_exports,
|
|
52
|
+
Stream_exports
|
|
53
|
+
} from "./chunk-ZT6BO7LG.js";
|
|
54
|
+
import {
|
|
55
|
+
init_define_TACK_BUILD_INFO
|
|
56
|
+
} from "./chunk-XARHV5M4.js";
|
|
57
|
+
|
|
58
|
+
// packages/extension-docs/src/index.ts
|
|
59
|
+
init_define_TACK_BUILD_INFO();
|
|
60
|
+
|
|
61
|
+
// packages/extension-docs/src/commands.ts
|
|
62
|
+
init_define_TACK_BUILD_INFO();
|
|
63
|
+
|
|
64
|
+
// packages/extension-docs/src/docs.ts
|
|
65
|
+
init_define_TACK_BUILD_INFO();
|
|
66
|
+
|
|
67
|
+
// packages/extension-docs/src/docs-error.ts
|
|
68
|
+
init_define_TACK_BUILD_INFO();
|
|
69
|
+
var DocsError = class extends Schema_exports.TaggedError()("DocsError", {
|
|
70
|
+
code: Schema_exports.String,
|
|
71
|
+
message: Schema_exports.String,
|
|
72
|
+
/** Safe public facts that let an operator repair the input, such as ambiguous candidates. */
|
|
73
|
+
details: Schema_exports.optionalKey(Schema_exports.Record(Schema_exports.String, Schema_exports.Unknown)),
|
|
74
|
+
/** The commands the message names as the fix, as data the envelope's `next` is filled from. */
|
|
75
|
+
next: Schema_exports.optionalKey(Schema_exports.Array(Schema_exports.Array(Schema_exports.String)))
|
|
76
|
+
}) {
|
|
77
|
+
};
|
|
78
|
+
var sameDocsResource = (left, right) => left.sourceRegistrationId === right.sourceRegistrationId && left.name === right.name;
|
|
79
|
+
|
|
80
|
+
// packages/extension-docs/src/docs-selection.ts
|
|
81
|
+
init_define_TACK_BUILD_INFO();
|
|
82
|
+
|
|
83
|
+
// packages/extension-docs/src/docs-resource.ts
|
|
84
|
+
init_define_TACK_BUILD_INFO();
|
|
85
|
+
var defaultDocsDestination = ".tack/docs";
|
|
86
|
+
var inspectCatalog = ["tack", "catalog"];
|
|
87
|
+
var docsMountDirectory = (settings) => settings.destination ?? defaultDocsDestination;
|
|
88
|
+
var docsDestinationPath = (path, root, settings, resource) => path.join(root, docsMountDirectory(settings), resource.sourceRegistrationId, resource.name);
|
|
89
|
+
var findDocsEntry = (catalog, resource) => catalog.entries.find((entry) => sameDocsResource(entry, resource));
|
|
90
|
+
var isRegistrationIdOf = Schema_exports.is(SourceRegistrationIdSchema);
|
|
91
|
+
var resolveDocsResource = Effect_exports.fnUntraced(function* (catalog, reference) {
|
|
92
|
+
const separator = reference.indexOf(":");
|
|
93
|
+
const prefix = separator < 0 ? void 0 : reference.slice(0, separator);
|
|
94
|
+
const matchingLabels = prefix === void 0 ? [] : catalog.labels.filter((source) => source.label === prefix);
|
|
95
|
+
const name = prefix === void 0 ? reference : reference.slice(separator + 1);
|
|
96
|
+
if (matchingLabels.length > 1)
|
|
97
|
+
return yield* new DocsError({
|
|
98
|
+
code: "docs-source-label-ambiguous",
|
|
99
|
+
message: `Source label ${String(prefix)} matches several registrations: ${matchingLabels.map((source) => source.sourceRegistrationId).join(", ")}. Use a registration ID.`,
|
|
100
|
+
details: { candidates: matchingLabels.map((source) => source.sourceRegistrationId) }
|
|
101
|
+
});
|
|
102
|
+
const isRegistrationId = prefix !== void 0 && isRegistrationIdOf(prefix);
|
|
103
|
+
if (prefix !== void 0 && isRegistrationId === false && matchingLabels.length === 0)
|
|
104
|
+
return yield* new DocsError({
|
|
105
|
+
code: "docs-source-not-registered",
|
|
106
|
+
message: `No registered source has label ${String(prefix)}. Run tack source list, then use a source label or registration ID.`,
|
|
107
|
+
details: { source: prefix }
|
|
108
|
+
});
|
|
109
|
+
const sourceRegistrationId = prefix === void 0 ? void 0 : isRegistrationId === true ? prefix : matchingLabels[0]?.sourceRegistrationId;
|
|
110
|
+
if (sourceRegistrationId !== void 0) return { sourceRegistrationId, name };
|
|
111
|
+
const candidates = catalog.entries.filter((entry) => entry.name === name);
|
|
112
|
+
const [only, ...others] = candidates;
|
|
113
|
+
if (only === void 0)
|
|
114
|
+
return yield* new DocsError({
|
|
115
|
+
code: "docs-resource-unavailable",
|
|
116
|
+
message: `No healthy registered source declares docs resource ${name}. Choose one from ${inspectCatalog.join(" ")} or qualify it with a registration ID.`,
|
|
117
|
+
details: { name },
|
|
118
|
+
next: [inspectCatalog]
|
|
119
|
+
});
|
|
120
|
+
if (others.length > 0)
|
|
121
|
+
return yield* new DocsError({
|
|
122
|
+
code: "docs-resource-ambiguous",
|
|
123
|
+
message: `${candidates.length} registered sources declare docs resource ${name}. Use ${candidates.map((entry) => `tack docs attach ${catalog.qualifier(entry.sourceRegistrationId)}:${name}`).join(" or ")}.`,
|
|
124
|
+
details: {
|
|
125
|
+
name,
|
|
126
|
+
candidates: candidates.map((entry) => ({
|
|
127
|
+
name: entry.name,
|
|
128
|
+
sourceRegistrationId: entry.sourceRegistrationId,
|
|
129
|
+
sourcePath: entry.sourcePath
|
|
130
|
+
}))
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
return { sourceRegistrationId: only.sourceRegistrationId, name };
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
// packages/extension-docs/src/docs-selection.ts
|
|
137
|
+
var projectSettings = (reader, projectName, layeredOf) => {
|
|
138
|
+
const [settings] = reader.projects.flatMap(
|
|
139
|
+
(project) => project.name === projectName ? [docsSettingsOf(projectName, project.slice, project.fixed, layeredOf(project))] : []
|
|
140
|
+
);
|
|
141
|
+
return settings ?? { projectName, attachments: [] };
|
|
142
|
+
};
|
|
143
|
+
var settingsFor = (reader, projectName) => projectSettings(reader, projectName, (project) => project.layered);
|
|
144
|
+
var storedSettingsFor = (reader, projectName) => projectSettings(reader, projectName, () => []);
|
|
145
|
+
var docsFromProfiles = (reader, projectName) => {
|
|
146
|
+
const stored = storedSettingsFor(reader, projectName).attachments;
|
|
147
|
+
return settingsFor(reader, projectName).attachments.filter(
|
|
148
|
+
(resource) => stored.some((entry) => sameDocsResource(entry, resource)) === false
|
|
149
|
+
);
|
|
150
|
+
};
|
|
151
|
+
var containingRootOf = (reader, selector) => reader.containingRoot(selector.cwd ?? ".", selector.projectName).pipe(
|
|
152
|
+
Effect_exports.mapError(
|
|
153
|
+
(error) => new DocsError({ code: "docs-project-unavailable", message: error.message })
|
|
154
|
+
)
|
|
155
|
+
);
|
|
156
|
+
var selectDocsProjectName = Effect_exports.fnUntraced(function* (reader, selector) {
|
|
157
|
+
if (selector.projectName !== void 0) {
|
|
158
|
+
const registered = reader.projects.some(
|
|
159
|
+
(project) => project.active === true && project.name === selector.projectName
|
|
160
|
+
);
|
|
161
|
+
if (registered === false)
|
|
162
|
+
return yield* Effect_exports.fail(reader.projectNotFound(selector.projectName, ""));
|
|
163
|
+
return selector.projectName;
|
|
164
|
+
}
|
|
165
|
+
const { canonicalCwd, containing } = yield* containingRootOf(reader, selector);
|
|
166
|
+
if (containing === void 0)
|
|
167
|
+
return yield* Effect_exports.fail(reader.projectNotFound(void 0, canonicalCwd));
|
|
168
|
+
return containing.projectName;
|
|
169
|
+
});
|
|
170
|
+
var selectDocsProject = Effect_exports.fnUntraced(function* (reader, selector) {
|
|
171
|
+
const fs = yield* FileSystem_exports.FileSystem;
|
|
172
|
+
const { canonicalCwd, containing } = yield* containingRootOf(reader, selector);
|
|
173
|
+
const projectName = selector.projectName ?? containing?.projectName;
|
|
174
|
+
const project = reader.projects.find(
|
|
175
|
+
(candidate) => candidate.active === true && candidate.name === projectName
|
|
176
|
+
);
|
|
177
|
+
if (project === void 0)
|
|
178
|
+
return yield* Effect_exports.fail(reader.projectNotFound(selector.projectName, canonicalCwd));
|
|
179
|
+
const root = containing?.root ?? project.roots[0];
|
|
180
|
+
if (root === void 0)
|
|
181
|
+
return yield* new DocsError({
|
|
182
|
+
code: "docs-project-unavailable",
|
|
183
|
+
message: "The registered project has no active root."
|
|
184
|
+
});
|
|
185
|
+
const actual = yield* fs.realPath(root).pipe(
|
|
186
|
+
Effect_exports.mapError(
|
|
187
|
+
(error) => new DocsError({ code: "docs-project-unavailable", message: error.message })
|
|
188
|
+
)
|
|
189
|
+
);
|
|
190
|
+
if (actual !== root)
|
|
191
|
+
return yield* new DocsError({
|
|
192
|
+
code: "docs-project-unavailable",
|
|
193
|
+
message: "The registered root has moved; refresh the project registration."
|
|
194
|
+
});
|
|
195
|
+
return { project, root };
|
|
196
|
+
});
|
|
197
|
+
var docsSetupGap = (input, catalog, unresolved) => {
|
|
198
|
+
if (input.resources.length + input.issues.length > 0) return void 0;
|
|
199
|
+
const project = input.project.name;
|
|
200
|
+
const [broken] = unresolved;
|
|
201
|
+
if (broken !== void 0)
|
|
202
|
+
return {
|
|
203
|
+
code: "no-docs-attached",
|
|
204
|
+
message: `Project ${project} has no attached docs, but its enabled profile ${broken.name} does not fully resolve, so the docs it names can be missing. Repair the profile first.`,
|
|
205
|
+
next: broken.check
|
|
206
|
+
};
|
|
207
|
+
const [candidate] = catalog.entries;
|
|
208
|
+
if (candidate === void 0)
|
|
209
|
+
return {
|
|
210
|
+
code: "no-docs-attached",
|
|
211
|
+
message: `Project ${project} has no attached docs and no registered source declares a docs resource. Add a source that declares docs in its tack.yaml, then attach one.`,
|
|
212
|
+
next: "tack source add <path-to-a-source-that-declares-docs>"
|
|
213
|
+
};
|
|
214
|
+
return {
|
|
215
|
+
code: "no-docs-attached",
|
|
216
|
+
message: `Project ${project} has no attached docs, so there is nothing to search or serve. Attach one of the declared docs resources.`,
|
|
217
|
+
next: `tack docs attach ${catalog.reference(candidate)} --project ${project}`
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
var projectDocsInput = (reader, catalog, projectName, root) => {
|
|
221
|
+
const settings = settingsFor(reader, projectName);
|
|
222
|
+
const resources = [];
|
|
223
|
+
const issues = [];
|
|
224
|
+
for (const resource of settings.attachments) {
|
|
225
|
+
const entry = findDocsEntry(catalog, resource);
|
|
226
|
+
if (entry !== void 0) {
|
|
227
|
+
resources.push({
|
|
228
|
+
...resource,
|
|
229
|
+
sourcePath: entry.sourcePath,
|
|
230
|
+
directoryPath: entry.directoryPath,
|
|
231
|
+
readerConfig: entry.readerConfig
|
|
232
|
+
});
|
|
233
|
+
} else {
|
|
234
|
+
const source = reader.sources.find(
|
|
235
|
+
(candidate) => candidate.id === resource.sourceRegistrationId
|
|
236
|
+
);
|
|
237
|
+
const quarantine = catalog.quarantined.find(
|
|
238
|
+
(item) => item.sourceRegistrationId === resource.sourceRegistrationId && item.name === resource.name
|
|
239
|
+
);
|
|
240
|
+
const unhealthy = catalog.unhealthySourceIds.includes(resource.sourceRegistrationId);
|
|
241
|
+
issues.push({
|
|
242
|
+
resource,
|
|
243
|
+
sourcePath: source?.canonicalPath ?? "",
|
|
244
|
+
code: quarantine?.code ?? "docs-resource-unavailable",
|
|
245
|
+
message: quarantine?.message ?? (unhealthy === false ? "The attached docs resource is no longer declared by its registered source." : "The registered source is unavailable.")
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
return {
|
|
250
|
+
project: { name: projectName, root },
|
|
251
|
+
resources,
|
|
252
|
+
issues,
|
|
253
|
+
...settings.defaultWritingResource === void 0 ? {} : { defaultWritingResource: settings.defaultWritingResource }
|
|
254
|
+
};
|
|
255
|
+
};
|
|
256
|
+
var resolveProjectDocsContextFrom = Effect_exports.fnUntraced(function* (reader, catalog, selector) {
|
|
257
|
+
const { project, root } = yield* selectDocsProject(reader, selector);
|
|
258
|
+
const input = projectDocsInput(reader, catalog, project.name, root);
|
|
259
|
+
const setup = docsSetupGap(input, catalog, project.unresolvedProfiles);
|
|
260
|
+
return { input, ...setup === void 0 ? {} : { setup } };
|
|
261
|
+
});
|
|
262
|
+
var resolveProjectDocsContext = Effect_exports.fnUntraced(function* (state, selector) {
|
|
263
|
+
const reader = yield* (yield* DocsHost).read(state);
|
|
264
|
+
return yield* resolveProjectDocsContextFrom(reader, yield* reader.catalog, selector);
|
|
265
|
+
});
|
|
266
|
+
var resolveProjectDocs = Effect_exports.fn("docs.resolveProjectDocs")(function* (state, selector) {
|
|
267
|
+
return (yield* resolveProjectDocsContext(state, selector)).input;
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
// packages/extension-docs/src/docs-links.ts
|
|
271
|
+
init_define_TACK_BUILD_INFO();
|
|
272
|
+
var ofScopeSource = (scope, resource) => scope.sourceRegistrationId === void 0 || resource.sourceRegistrationId === scope.sourceRegistrationId;
|
|
273
|
+
var sameResource = (left, right) => left.sourceRegistrationId === right.sourceRegistrationId && left.name === right.name;
|
|
274
|
+
var docsMountRequests = (input) => {
|
|
275
|
+
const { scope } = input;
|
|
276
|
+
const wanted = input.projects.flatMap((project) => {
|
|
277
|
+
const settings = docsSettingsOf(project.name, project.slice, project.fixed, project.layered);
|
|
278
|
+
if (settings === void 0) return [];
|
|
279
|
+
if (scope.projectName !== void 0 && project.name !== scope.projectName) return [];
|
|
280
|
+
return settings.attachments.filter((attachment) => ofScopeSource(scope, attachment)).map((resource) => ({
|
|
281
|
+
resource,
|
|
282
|
+
rooted: project.roots.length > 0,
|
|
283
|
+
entry: input.entries.find((entry) => sameResource(entry, resource)),
|
|
284
|
+
requests: (directoryPath) => project.roots.map((root) => ({
|
|
285
|
+
projectName: project.name,
|
|
286
|
+
root,
|
|
287
|
+
resource,
|
|
288
|
+
destination: [
|
|
289
|
+
docsMountDirectory(settings),
|
|
290
|
+
resource.sourceRegistrationId,
|
|
291
|
+
resource.name
|
|
292
|
+
],
|
|
293
|
+
sourceDirectoryPath: directoryPath
|
|
294
|
+
}))
|
|
295
|
+
}));
|
|
296
|
+
});
|
|
297
|
+
const unavailable = wanted.filter(({ entry }) => entry === void 0);
|
|
298
|
+
return {
|
|
299
|
+
requests: wanted.flatMap(
|
|
300
|
+
({ entry, requests }) => entry === void 0 ? [] : requests(entry.directoryPath)
|
|
301
|
+
),
|
|
302
|
+
issues: unavailable.map(({ resource }) => ({
|
|
303
|
+
code: "docs-resource-unavailable",
|
|
304
|
+
message: `${resource.sourceRegistrationId}/${resource.name} is unavailable; its existing links are retained.`,
|
|
305
|
+
subject: { resource }
|
|
306
|
+
})),
|
|
307
|
+
// A project without roots retains nothing, as no mount of it could be planned.
|
|
308
|
+
retained: unavailable.flatMap(({ resource, rooted }) => rooted ? [resource] : [])
|
|
309
|
+
};
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
// packages/extension-docs/src/docs.ts
|
|
313
|
+
var decodeResource = (resource) => Schema_exports.decodeUnknownEffect(DocsResourceReferenceSchema)(resource).pipe(
|
|
314
|
+
Effect_exports.mapError(
|
|
315
|
+
(error) => new DocsError({ code: "docs-resource-invalid", message: error.message })
|
|
316
|
+
)
|
|
317
|
+
);
|
|
318
|
+
var decodeName = (name) => Schema_exports.decodeUnknownEffect(DocsResourceReferenceSchema.fields.name)(name).pipe(
|
|
319
|
+
Effect_exports.mapError(
|
|
320
|
+
(error) => new DocsError({ code: "docs-resource-invalid", message: error.message })
|
|
321
|
+
)
|
|
322
|
+
);
|
|
323
|
+
var resolveRequest = Effect_exports.fnUntraced(function* (catalog, request) {
|
|
324
|
+
yield* decodeName(request.reference.split(":").at(-1) ?? "");
|
|
325
|
+
return yield* decodeResource(yield* resolveDocsResource(catalog, request.reference));
|
|
326
|
+
});
|
|
327
|
+
var isAttached = (settings, resource) => settings.attachments.some((entry) => sameDocsResource(entry, resource));
|
|
328
|
+
var changeSettings = (state, selector, change) => Effect_exports.gen(function* () {
|
|
329
|
+
const host = yield* DocsHost;
|
|
330
|
+
return yield* host.mutate(
|
|
331
|
+
state,
|
|
332
|
+
(reader) => Effect_exports.gen(function* () {
|
|
333
|
+
const projectName = yield* selectDocsProjectName(reader, selector);
|
|
334
|
+
yield* reader.refuseFixed(projectName);
|
|
335
|
+
const next = yield* change(storedSettingsFor(reader, projectName), reader);
|
|
336
|
+
return { projectName, slice: docsSliceOf(next), value: next };
|
|
337
|
+
})
|
|
338
|
+
);
|
|
339
|
+
});
|
|
340
|
+
var attachDocs = Effect_exports.fn("docs.attachDocs")(function* (state, selector, request) {
|
|
341
|
+
return yield* changeSettings(
|
|
342
|
+
state,
|
|
343
|
+
selector,
|
|
344
|
+
(settings, reader) => Effect_exports.gen(function* () {
|
|
345
|
+
const catalog = yield* reader.catalog;
|
|
346
|
+
const resource = yield* resolveRequest(catalog, request);
|
|
347
|
+
if (findDocsEntry(catalog, resource) === void 0)
|
|
348
|
+
return yield* new DocsError({
|
|
349
|
+
code: "docs-resource-unavailable",
|
|
350
|
+
message: `Choose a healthy declared docs resource from ${inspectCatalog.join(" ")}.`,
|
|
351
|
+
details: { resource },
|
|
352
|
+
next: [inspectCatalog]
|
|
353
|
+
});
|
|
354
|
+
return isAttached(settings, resource) === true ? settings : { ...settings, attachments: [...settings.attachments, resource] };
|
|
355
|
+
})
|
|
356
|
+
);
|
|
357
|
+
});
|
|
358
|
+
var detachDocs = Effect_exports.fn("docs.detachDocs")(function* (state, selector, request) {
|
|
359
|
+
return yield* changeSettings(
|
|
360
|
+
state,
|
|
361
|
+
selector,
|
|
362
|
+
(settings, reader) => Effect_exports.gen(function* () {
|
|
363
|
+
const decoded = yield* resolveRequest(yield* reader.catalog, request);
|
|
364
|
+
const { projectName } = settings;
|
|
365
|
+
if (docsFromProfiles(reader, projectName).some((entry) => sameDocsResource(entry, decoded)))
|
|
366
|
+
return yield* new DocsError({
|
|
367
|
+
code: "docs-attached-by-profile",
|
|
368
|
+
message: `An enabled profile attaches ${decoded.name} to project ${projectName}, so there is nothing to detach. Turn the profile off with tack profile disable.`,
|
|
369
|
+
details: { resource: decoded },
|
|
370
|
+
next: [["tack", "status", "--project", projectName]]
|
|
371
|
+
});
|
|
372
|
+
const next = {
|
|
373
|
+
...settings,
|
|
374
|
+
attachments: settings.attachments.filter((entry) => !sameDocsResource(entry, decoded))
|
|
375
|
+
};
|
|
376
|
+
if (next.defaultWritingResource !== void 0 && sameDocsResource(next.defaultWritingResource, decoded)) {
|
|
377
|
+
const { defaultWritingResource: _cleared, ...rest } = next;
|
|
378
|
+
return rest;
|
|
379
|
+
}
|
|
380
|
+
return next;
|
|
381
|
+
})
|
|
382
|
+
);
|
|
383
|
+
});
|
|
384
|
+
var configureDocs = Effect_exports.fn("docs.configureDocs")(function* (state, selector, changes) {
|
|
385
|
+
if (changes.destination !== void 0)
|
|
386
|
+
yield* Schema_exports.decodeUnknownEffect(DocsDestinationSchema)(changes.destination).pipe(
|
|
387
|
+
Effect_exports.mapError(
|
|
388
|
+
(error) => new DocsError({ code: "docs-destination-invalid", message: error.message })
|
|
389
|
+
)
|
|
390
|
+
);
|
|
391
|
+
return yield* changeSettings(
|
|
392
|
+
state,
|
|
393
|
+
selector,
|
|
394
|
+
(settings, reader) => Effect_exports.gen(function* () {
|
|
395
|
+
const { defaultWritingResource: _cleared, ...rest } = settings;
|
|
396
|
+
const next = {
|
|
397
|
+
...changes.clearDefault === true ? rest : settings,
|
|
398
|
+
...changes.destination === void 0 ? {} : { destination: changes.destination }
|
|
399
|
+
};
|
|
400
|
+
if (changes.defaultWritingResource === void 0) return next;
|
|
401
|
+
const resource = yield* resolveRequest(yield* reader.catalog, changes.defaultWritingResource);
|
|
402
|
+
if (isAttached(settings, resource) === false)
|
|
403
|
+
return yield* new DocsError({
|
|
404
|
+
code: "docs-default-not-attached",
|
|
405
|
+
message: "Attach the writing resource before selecting it as the default.",
|
|
406
|
+
details: { resource },
|
|
407
|
+
next: docsFromProfiles(reader, settings.projectName).some(
|
|
408
|
+
(entry) => sameDocsResource(entry, resource)
|
|
409
|
+
) ? [attachCommand(settings.projectName, (yield* reader.catalog).reference(resource))] : []
|
|
410
|
+
});
|
|
411
|
+
return { ...next, defaultWritingResource: resource };
|
|
412
|
+
})
|
|
413
|
+
);
|
|
414
|
+
});
|
|
415
|
+
var attachCommand = (projectName, reference) => [
|
|
416
|
+
"tack",
|
|
417
|
+
"docs",
|
|
418
|
+
"attach",
|
|
419
|
+
reference,
|
|
420
|
+
"--project",
|
|
421
|
+
projectName
|
|
422
|
+
];
|
|
423
|
+
var mountState = {
|
|
424
|
+
conflict: "conflict",
|
|
425
|
+
create: "unmounted",
|
|
426
|
+
keep: "mounted",
|
|
427
|
+
remove: "stale"
|
|
428
|
+
};
|
|
429
|
+
var inspectDocs = Effect_exports.fn("docs.inspectDocs")(function* (state, selector) {
|
|
430
|
+
const reader = yield* (yield* DocsHost).read(state);
|
|
431
|
+
const catalog = yield* reader.catalog;
|
|
432
|
+
const { input, setup } = yield* resolveProjectDocsContextFrom(reader, catalog, selector);
|
|
433
|
+
const { destination, defaultWritingResource } = settingsFor(reader, input.project.name);
|
|
434
|
+
const corpus = yield* (yield* ReaderCorpus).loadProject(input);
|
|
435
|
+
const mounts = yield* reader.mountStatus(input.project.name, docsMountRequests);
|
|
436
|
+
const fromProfiles = docsFromProfiles(reader, input.project.name);
|
|
437
|
+
const docs = {
|
|
438
|
+
project: input.project,
|
|
439
|
+
resources: input.resources,
|
|
440
|
+
issues: corpus.issues,
|
|
441
|
+
documents: corpus.documents.length,
|
|
442
|
+
mounts: mounts.map((mount) => ({
|
|
443
|
+
// The public payload has always named the kind of each mounted resource.
|
|
444
|
+
resource: { kind: "docs", ...mount.resource },
|
|
445
|
+
destinationPath: mount.destinationPath,
|
|
446
|
+
state: mountState[mount.action],
|
|
447
|
+
...mount.message === void 0 ? {} : { message: mount.message }
|
|
448
|
+
})),
|
|
449
|
+
settings: {
|
|
450
|
+
...destination === void 0 ? {} : { destination },
|
|
451
|
+
...defaultWritingResource === void 0 ? {} : { defaultWritingResource }
|
|
452
|
+
},
|
|
453
|
+
...fromProfiles.length === 0 ? {} : { fromProfiles: fromProfiles.map((resource) => ({ kind: "docs", ...resource })) },
|
|
454
|
+
...setup === void 0 ? {} : { setup },
|
|
455
|
+
complete: corpus.complete && setup === void 0
|
|
456
|
+
};
|
|
457
|
+
return docs;
|
|
458
|
+
});
|
|
459
|
+
var mountDocs = (project) => [
|
|
460
|
+
"tack",
|
|
461
|
+
"sync",
|
|
462
|
+
"--no-adapters",
|
|
463
|
+
"--project",
|
|
464
|
+
project,
|
|
465
|
+
"--apply"
|
|
466
|
+
];
|
|
467
|
+
var mostConfigureHints = 3;
|
|
468
|
+
var defaultUnset = (settings, stored, catalog) => {
|
|
469
|
+
const project = settings.projectName;
|
|
470
|
+
if (stored.length === 0 && settings.attachments.length > 0) {
|
|
471
|
+
const attach = settings.attachments.map(
|
|
472
|
+
(resource) => attachCommand(project, catalog.reference(resource))
|
|
473
|
+
);
|
|
474
|
+
return new DocsError({
|
|
475
|
+
code: "docs-default-unset",
|
|
476
|
+
message: `Enabled profiles attach ${settings.attachments.length} docs resources to project ${project}, and no default writing resource is set. Pass --name to docs target, or attach one with ${attach.map((command) => command.join(" ")).join(" or ")} and set it as the default.`,
|
|
477
|
+
details: { projectName: project, candidates: settings.attachments },
|
|
478
|
+
next: attach.slice(0, mostConfigureHints)
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
const configure = stored.map((resource) => [
|
|
482
|
+
"tack",
|
|
483
|
+
"docs",
|
|
484
|
+
"configure",
|
|
485
|
+
"--project",
|
|
486
|
+
project,
|
|
487
|
+
"--default",
|
|
488
|
+
catalog.reference(resource)
|
|
489
|
+
]);
|
|
490
|
+
return new DocsError({
|
|
491
|
+
code: "docs-default-unset",
|
|
492
|
+
message: configure.length === 0 ? `Project ${project} has no attached docs resources. Attach one with tack docs attach <name> --project ${project}, then run ${mountDocs(project).join(" ")}.` : `Project ${project} has ${settings.attachments.length} attached docs resources and no default writing resource. Choose one with ${configure.map((command) => command.join(" ")).join(" or ")}, or pass --name to docs target.`,
|
|
493
|
+
details: { projectName: project, candidates: settings.attachments },
|
|
494
|
+
next: configure.length === 0 ? [mountDocs(project)] : configure.slice(0, mostConfigureHints)
|
|
495
|
+
});
|
|
496
|
+
};
|
|
497
|
+
var resolveDocsTarget = Effect_exports.fn("docs.resolveDocsTarget")(function* (state, selector) {
|
|
498
|
+
const reader = yield* (yield* DocsHost).read(state);
|
|
499
|
+
const { project, root } = yield* selectDocsProject(reader, selector);
|
|
500
|
+
const settings = settingsFor(reader, project.name);
|
|
501
|
+
const catalog = yield* reader.catalog;
|
|
502
|
+
const [onlyAttachment, ...otherAttachments] = settings.attachments;
|
|
503
|
+
const resource = selector.resource === void 0 ? settings.defaultWritingResource ?? (otherAttachments.length === 0 ? onlyAttachment : void 0) : yield* resolveRequest(catalog, selector.resource);
|
|
504
|
+
if (resource === void 0)
|
|
505
|
+
return yield* defaultUnset(
|
|
506
|
+
settings,
|
|
507
|
+
storedSettingsFor(reader, project.name).attachments,
|
|
508
|
+
catalog
|
|
509
|
+
);
|
|
510
|
+
if (isAttached(settings, resource) === false)
|
|
511
|
+
return yield* new DocsError({
|
|
512
|
+
code: "docs-resource-not-attached",
|
|
513
|
+
message: "The selected writing resource is not attached to this project.",
|
|
514
|
+
details: { resource }
|
|
515
|
+
});
|
|
516
|
+
const destinationPath = docsDestinationPath(yield* Path_exports.Path, root, settings, resource);
|
|
517
|
+
const evidence = reader.mounts.find(
|
|
518
|
+
(entry) => entry.destinationPath === destinationPath && sameDocsResource(entry.resource, resource)
|
|
519
|
+
);
|
|
520
|
+
const input = projectDocsInput(reader, catalog, project.name, root);
|
|
521
|
+
const current = input.resources.find((entry) => sameDocsResource(entry, resource));
|
|
522
|
+
if (evidence !== void 0)
|
|
523
|
+
yield* reader.mountParents(evidence).pipe(
|
|
524
|
+
Effect_exports.mapError(
|
|
525
|
+
(error) => new DocsError({ code: "docs-mount-unavailable", message: error.message })
|
|
526
|
+
)
|
|
527
|
+
);
|
|
528
|
+
if (evidence === void 0 || current === void 0 || current.directoryPath !== evidence.sourceDirectoryPath || (yield* reader.mountLinked(evidence)) === false)
|
|
529
|
+
return yield* new DocsError({
|
|
530
|
+
code: "docs-mount-unavailable",
|
|
531
|
+
message: `The writing mount is absent, unhealthy, or not managed. Run ${mountDocs(project.name).join(" ")} and resolve conflicts first.`,
|
|
532
|
+
next: [mountDocs(project.name)]
|
|
533
|
+
});
|
|
534
|
+
const target = {
|
|
535
|
+
projectName: project.name,
|
|
536
|
+
root,
|
|
537
|
+
resource,
|
|
538
|
+
sourceDirectoryPath: evidence.sourceDirectoryPath,
|
|
539
|
+
destinationPath
|
|
540
|
+
};
|
|
541
|
+
return target;
|
|
542
|
+
});
|
|
543
|
+
|
|
544
|
+
// packages/extension-docs/src/reader/icon-lookup.ts
|
|
545
|
+
init_define_TACK_BUILD_INFO();
|
|
546
|
+
function lookUpDocsIcons(word) {
|
|
547
|
+
const matches = word === void 0 ? docsIconCategories.flatMap(
|
|
548
|
+
({ category, names }) => names.map((name) => ({ name, category }))
|
|
549
|
+
) : searchDocsIcons(word);
|
|
550
|
+
const categories = docsIconCategories.flatMap(({ category }) => {
|
|
551
|
+
const icons = matches.filter((match) => match.category === category).map(
|
|
552
|
+
(match) => "alias" in match && match.alias !== void 0 ? { name: match.name, alias: match.alias } : { name: match.name }
|
|
553
|
+
);
|
|
554
|
+
return icons.length === 0 ? [] : [{ category, icons }];
|
|
555
|
+
});
|
|
556
|
+
return {
|
|
557
|
+
...word === void 0 ? {} : { query: word },
|
|
558
|
+
lucideVersion,
|
|
559
|
+
count: matches.length,
|
|
560
|
+
categories
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
// packages/extension-docs/src/reader/reader-cache.ts
|
|
565
|
+
init_define_TACK_BUILD_INFO();
|
|
566
|
+
|
|
567
|
+
// packages/extension-docs/src/reader/posix-path.ts
|
|
568
|
+
init_define_TACK_BUILD_INFO();
|
|
569
|
+
var posixPath = Effect_exports.runSync(
|
|
570
|
+
Effect_exports.gen(function* () {
|
|
571
|
+
return yield* Path_exports.Path;
|
|
572
|
+
}).pipe(Effect_exports.provide(Path_exports.layer))
|
|
573
|
+
);
|
|
574
|
+
|
|
575
|
+
// packages/extension-docs/src/reader/reader-cache.ts
|
|
576
|
+
var readerCacheDirectory = (stateDirectory, project) => posixPath.join(
|
|
577
|
+
stateDirectory,
|
|
578
|
+
"cache",
|
|
579
|
+
"reader",
|
|
580
|
+
`${project.name}-${sha256(project.root).slice(0, 12)}`
|
|
581
|
+
);
|
|
582
|
+
var holdReaderCache = Effect_exports.fnUntraced(function* (stateDirectory, project) {
|
|
583
|
+
const fileSystem = yield* FileSystem_exports.FileSystem;
|
|
584
|
+
const host = yield* DocsHost;
|
|
585
|
+
const directory = readerCacheDirectory(stateDirectory, project);
|
|
586
|
+
const held = yield* Effect_exports.acquireRelease(
|
|
587
|
+
fileSystem.makeDirectory(directory, { recursive: true, mode: 448 }).pipe(Effect_exports.andThen(host.lock(posixPath.join(directory, "session.lock"))), Effect_exports.option),
|
|
588
|
+
(ownership) => Option_exports.isSome(ownership) ? ownership.value.release.pipe(Effect_exports.ignore) : Effect_exports.void
|
|
589
|
+
);
|
|
590
|
+
return Option_exports.isSome(held) ? directory : void 0;
|
|
591
|
+
});
|
|
592
|
+
|
|
593
|
+
// packages/extension-docs/src/reader/reviews.ts
|
|
594
|
+
init_define_TACK_BUILD_INFO();
|
|
595
|
+
var reviewDirectory = (stateDirectory, projectName) => posixPath.join(extensionDirectory(stateDirectory, "docs"), "reviews", projectName);
|
|
596
|
+
var decodeBatch = Schema_exports.decodeUnknownEffect(Schema_exports.fromJsonString(ReviewBatchSchema));
|
|
597
|
+
var isMissing = (error) => error.reason._tag === "NotFound";
|
|
598
|
+
var lookAgainEvery = Duration_exports.seconds(5);
|
|
599
|
+
var claimedName = /^(.+\.json)\.(\d+)$/;
|
|
600
|
+
var isRunning = (processId) => Effect_exports.sync(() => {
|
|
601
|
+
try {
|
|
602
|
+
process.kill(processId, 0);
|
|
603
|
+
return true;
|
|
604
|
+
} catch (error) {
|
|
605
|
+
return error instanceof Error && "code" in error && error.code === "EPERM";
|
|
606
|
+
}
|
|
607
|
+
});
|
|
608
|
+
var pagesOf = Effect_exports.fnUntraced(function* (input) {
|
|
609
|
+
const { documents, issues } = yield* (yield* ReaderCorpus).loadProject(input);
|
|
610
|
+
return [...documents, ...issues].flatMap(({ path }) => path === void 0 ? [] : [path]);
|
|
611
|
+
});
|
|
612
|
+
var pageNamed = Effect_exports.fnUntraced(function* (named, cwd, pages) {
|
|
613
|
+
const fileSystem = yield* FileSystem_exports.FileSystem;
|
|
614
|
+
const full = posixPath.resolve(cwd, named);
|
|
615
|
+
const file = yield* fileSystem.realPath(full).pipe(Effect_exports.orElseSucceed(() => full));
|
|
616
|
+
const suffix = `/${named.replace(/^(?:\.\/)+/, "")}`;
|
|
617
|
+
const exact = pages.filter((page2) => page2 === full || page2 === file);
|
|
618
|
+
const found = named === "" ? [] : exact.length > 0 || posixPath.isAbsolute(named) === true ? exact : pages.filter((page2) => page2.endsWith(suffix));
|
|
619
|
+
const [page] = found;
|
|
620
|
+
if (page !== void 0 && found.length === 1) return page;
|
|
621
|
+
return yield* new DocsError({
|
|
622
|
+
code: "docs-review-page",
|
|
623
|
+
message: page === void 0 ? `No page of this project is named "${named}". Name the page's file.` : `"${named}" names ${found.length} pages. Name one by its file: ${found.toSorted().join(", ")}.`
|
|
624
|
+
});
|
|
625
|
+
});
|
|
626
|
+
var waitForReview = Effect_exports.fn("docs.waitForReview")(
|
|
627
|
+
function* (state, request) {
|
|
628
|
+
const fileSystem = yield* FileSystem_exports.FileSystem;
|
|
629
|
+
const host = yield* DocsHost;
|
|
630
|
+
const input = yield* resolveProjectDocs(state, request);
|
|
631
|
+
const { project } = input;
|
|
632
|
+
const directory = reviewDirectory(yield* host.stateDirectory(state), project.name);
|
|
633
|
+
const pending = posixPath.join(directory, "pending");
|
|
634
|
+
const claimed = posixPath.join(directory, "claimed");
|
|
635
|
+
const received = posixPath.join(directory, "received");
|
|
636
|
+
const unreadable = /* @__PURE__ */ new Set();
|
|
637
|
+
const prepare = Effect_exports.forEach(
|
|
638
|
+
[pending, claimed, received],
|
|
639
|
+
(folder) => fileSystem.makeDirectory(folder, { recursive: true, mode: 448 }),
|
|
640
|
+
{ discard: true }
|
|
641
|
+
);
|
|
642
|
+
const pendingNames = fileSystem.readDirectory(pending).pipe(Effect_exports.map((names) => names.filter((name) => name.endsWith(".json")).toSorted()));
|
|
643
|
+
const read = (name) => fileSystem.readFileString(posixPath.join(pending, name)).pipe(
|
|
644
|
+
Effect_exports.flatMap(decodeBatch),
|
|
645
|
+
Effect_exports.map(Option_exports.some),
|
|
646
|
+
Effect_exports.catch((error) => {
|
|
647
|
+
if (error._tag !== "PlatformError" || isMissing(error) === false)
|
|
648
|
+
unreadable.add(posixPath.join(pending, name));
|
|
649
|
+
return Effect_exports.succeed(Option_exports.none());
|
|
650
|
+
})
|
|
651
|
+
);
|
|
652
|
+
const claim = Effect_exports.fnUntraced(function* (name) {
|
|
653
|
+
const path = posixPath.join(pending, name);
|
|
654
|
+
const mine = posixPath.join(claimed, `${name}.${process.pid}`);
|
|
655
|
+
const now = new Date(yield* Clock_exports.currentTimeMillis);
|
|
656
|
+
return yield* Effect_exports.acquireRelease(
|
|
657
|
+
fileSystem.rename(path, mine).pipe(
|
|
658
|
+
// The stamp dates the receipt: the reader removes a batch received long ago.
|
|
659
|
+
Effect_exports.andThen(fileSystem.utimes(mine, now, now)),
|
|
660
|
+
Effect_exports.as(true),
|
|
661
|
+
Effect_exports.catch(
|
|
662
|
+
(error) => fileSystem.exists(path).pipe(
|
|
663
|
+
Effect_exports.flatMap(
|
|
664
|
+
(there) => there === false && isMissing(error) ? Effect_exports.succeed(false) : Effect_exports.fail(error)
|
|
665
|
+
)
|
|
666
|
+
)
|
|
667
|
+
)
|
|
668
|
+
),
|
|
669
|
+
(isMine, exit) => isMine === false ? Effect_exports.void : Effect_exports.ignore(
|
|
670
|
+
fileSystem.rename(
|
|
671
|
+
mine,
|
|
672
|
+
Exit_exports.isSuccess(exit) === true ? posixPath.join(received, name) : path
|
|
673
|
+
)
|
|
674
|
+
)
|
|
675
|
+
);
|
|
676
|
+
});
|
|
677
|
+
const putBack = fileSystem.readDirectory(claimed).pipe(
|
|
678
|
+
Effect_exports.flatMap(
|
|
679
|
+
Effect_exports.forEach((name) => {
|
|
680
|
+
const [, file, processId] = claimedName.exec(name) ?? [];
|
|
681
|
+
return file === void 0 ? Effect_exports.void : isRunning(Number(processId)).pipe(
|
|
682
|
+
Effect_exports.flatMap(
|
|
683
|
+
(running) => running === true ? Effect_exports.void : Effect_exports.ignore(
|
|
684
|
+
fileSystem.rename(
|
|
685
|
+
posixPath.join(claimed, name),
|
|
686
|
+
posixPath.join(pending, file)
|
|
687
|
+
)
|
|
688
|
+
)
|
|
689
|
+
)
|
|
690
|
+
);
|
|
691
|
+
})
|
|
692
|
+
)
|
|
693
|
+
);
|
|
694
|
+
yield* prepare;
|
|
695
|
+
yield* putBack;
|
|
696
|
+
const named = request.page;
|
|
697
|
+
const page = named === void 0 ? void 0 : yield* pageNamed(named, request.cwd ?? ".", [
|
|
698
|
+
.../* @__PURE__ */ new Set([
|
|
699
|
+
...(yield* Effect_exports.forEach(yield* pendingNames, read)).flatMap(
|
|
700
|
+
(batch2) => Option_exports.isSome(batch2) === true ? [batch2.value.page.path] : []
|
|
701
|
+
),
|
|
702
|
+
...yield* pagesOf(input)
|
|
703
|
+
])
|
|
704
|
+
]);
|
|
705
|
+
const wanted = (batch2) => batch2.project.name === project.name && (page === void 0 || batch2.page.path === page);
|
|
706
|
+
const next = Effect_exports.gen(function* () {
|
|
707
|
+
yield* prepare;
|
|
708
|
+
yield* putBack;
|
|
709
|
+
return yield* Stream_exports.fromIterable(yield* pendingNames).pipe(
|
|
710
|
+
Stream_exports.mapEffect(
|
|
711
|
+
(name) => read(name).pipe(
|
|
712
|
+
Effect_exports.flatMap(
|
|
713
|
+
(batch2) => Option_exports.isSome(batch2) === true && wanted(batch2.value) === true ? claim(name).pipe(Effect_exports.map((mine) => mine === true ? batch2 : Option_exports.none())) : Effect_exports.succeed(Option_exports.none())
|
|
714
|
+
)
|
|
715
|
+
)
|
|
716
|
+
),
|
|
717
|
+
Stream_exports.filter(Option_exports.isSome),
|
|
718
|
+
Stream_exports.runHead,
|
|
719
|
+
Effect_exports.map(Option_exports.flatten)
|
|
720
|
+
);
|
|
721
|
+
});
|
|
722
|
+
const arrival = Effect_exports.gen(function* () {
|
|
723
|
+
const ready = yield* Queue_exports.sliding(1);
|
|
724
|
+
const changes = fileSystem.watch(pending, { onReady: () => Queue_exports.offerUnsafe(ready, void 0) }).pipe(Stream_exports.catchCause(() => Stream_exports.empty));
|
|
725
|
+
const looks = Stream_exports.fromQueue(ready).pipe(
|
|
726
|
+
Stream_exports.merge(changes),
|
|
727
|
+
Stream_exports.merge(Stream_exports.tick(lookAgainEvery)),
|
|
728
|
+
Stream_exports.map(() => false)
|
|
729
|
+
);
|
|
730
|
+
const deadline = request.timeoutSeconds === void 0 ? Stream_exports.empty : Stream_exports.fromEffect(Effect_exports.sleep(Duration_exports.seconds(request.timeoutSeconds))).pipe(
|
|
731
|
+
Stream_exports.map(() => true)
|
|
732
|
+
);
|
|
733
|
+
return yield* Stream_exports.merge(looks, deadline).pipe(
|
|
734
|
+
Stream_exports.mapEffect((last) => next.pipe(Effect_exports.map((batch2) => ({ last, batch: batch2 })))),
|
|
735
|
+
Stream_exports.filter(({ last, batch: batch2 }) => last === true || Option_exports.isSome(batch2)),
|
|
736
|
+
Stream_exports.runHead,
|
|
737
|
+
Effect_exports.map(Option_exports.flatMap(({ batch: batch2 }) => batch2))
|
|
738
|
+
);
|
|
739
|
+
});
|
|
740
|
+
const batch = yield* arrival;
|
|
741
|
+
return { project: project.name, batch, unreadable: [...unreadable].toSorted() };
|
|
742
|
+
},
|
|
743
|
+
(effect) => effect.pipe(
|
|
744
|
+
Effect_exports.catchTag(
|
|
745
|
+
"PlatformError",
|
|
746
|
+
(error) => Effect_exports.fail(
|
|
747
|
+
new DocsError({
|
|
748
|
+
code: "docs-review-folder",
|
|
749
|
+
message: `The folder of this project's reviews cannot be used: ${error.message}`
|
|
750
|
+
})
|
|
751
|
+
)
|
|
752
|
+
)
|
|
753
|
+
)
|
|
754
|
+
);
|
|
755
|
+
|
|
756
|
+
// packages/extension-docs/src/reader/search.ts
|
|
757
|
+
init_define_TACK_BUILD_INFO();
|
|
758
|
+
|
|
759
|
+
// packages/reader/src/search.ts
|
|
760
|
+
init_define_TACK_BUILD_INFO();
|
|
761
|
+
|
|
762
|
+
// packages/reader/src/resource.ts
|
|
763
|
+
init_define_TACK_BUILD_INFO();
|
|
764
|
+
|
|
765
|
+
// packages/reader/src/search.ts
|
|
766
|
+
var defaultSearchLimit = 10;
|
|
767
|
+
var maximumSearchLimit2 = 50;
|
|
768
|
+
var maximumSearchQueryLength = 512;
|
|
769
|
+
function searchTerms(query) {
|
|
770
|
+
return query.toLowerCase().split(/\s+/).map((term) => term.replace(/^\.\//, "")).filter((term) => term.length > 0);
|
|
771
|
+
}
|
|
772
|
+
function filterDocuments(documents, filters) {
|
|
773
|
+
const terms = searchTerms(filters.query);
|
|
774
|
+
return documents.filter((document) => {
|
|
775
|
+
const text = `${document.title} ${document.path} ${document.relativePath} ${document.searchText} ${document.metadata.type ?? ""} ${document.metadata.status ?? ""} ${document.metadata.tags.join(" ")} ${document.resource?.sourceRegistrationId ?? ""} ${document.resource?.name ?? ""} ${document.resource?.sourcePath ?? ""}`.toLowerCase();
|
|
776
|
+
return terms.every((term) => text.includes(term)) && (filters.type === "" || document.metadata.type === filters.type) && (filters.status === "" || document.metadata.status === filters.status) && (filters.tag === "" || document.metadata.tags.includes(filters.tag));
|
|
777
|
+
});
|
|
778
|
+
}
|
|
779
|
+
function uniqueBlocks(blocks) {
|
|
780
|
+
return blocks.filter(
|
|
781
|
+
(block, index) => blocks.findIndex((other) => other.id === block.id && other.version === block.version) === index
|
|
782
|
+
).map((block) => {
|
|
783
|
+
const contributors = blocks.filter((other) => other.id === block.id && other.version === block.version).flatMap((other) => other.contributors);
|
|
784
|
+
return {
|
|
785
|
+
...block,
|
|
786
|
+
contributors: contributors.filter(
|
|
787
|
+
(reference, index) => contributors.findIndex(
|
|
788
|
+
(other) => other.path === reference.path && other.startLine === reference.startLine && other.endLine === reference.endLine && other.kind === reference.kind
|
|
789
|
+
) === index
|
|
790
|
+
)
|
|
791
|
+
};
|
|
792
|
+
});
|
|
793
|
+
}
|
|
794
|
+
function blockScore(block, terms) {
|
|
795
|
+
const text = block.readable.toLowerCase();
|
|
796
|
+
return terms.filter((term) => text.includes(term)).length * (block.kind === "heading" ? 20 : 1);
|
|
797
|
+
}
|
|
798
|
+
function documentScore(document, terms) {
|
|
799
|
+
const title = document.title.toLowerCase();
|
|
800
|
+
const headings = document.blocks.filter((block) => block.kind === "heading").map((block) => block.readable.toLowerCase());
|
|
801
|
+
const body = document.blocks.filter((block) => block.kind !== "heading").map((block) => block.readable.toLowerCase());
|
|
802
|
+
return terms.reduce(
|
|
803
|
+
(score, term) => score + (title.includes(term) === true ? 100 : 0) + (headings.some((text) => text.includes(term)) === true ? 20 : 0) + (body.some((text) => text.includes(term)) === true ? 1 : 0),
|
|
804
|
+
0
|
|
805
|
+
);
|
|
806
|
+
}
|
|
807
|
+
function sourceOffset(text, normalizedOffset) {
|
|
808
|
+
let offset = 0;
|
|
809
|
+
let normalized = 0;
|
|
810
|
+
for (const character of text) {
|
|
811
|
+
normalized += character.toLowerCase().length;
|
|
812
|
+
if (normalized > normalizedOffset) return offset;
|
|
813
|
+
offset += character.length;
|
|
814
|
+
}
|
|
815
|
+
return offset;
|
|
816
|
+
}
|
|
817
|
+
function excerpt(text, terms) {
|
|
818
|
+
if (text.length <= 400) return text;
|
|
819
|
+
const normalized = text.toLowerCase();
|
|
820
|
+
const firstMatch = Math.min(
|
|
821
|
+
...terms.map((term) => normalized.indexOf(term)).filter((index) => index >= 0)
|
|
822
|
+
);
|
|
823
|
+
const position = sourceOffset(text, firstMatch);
|
|
824
|
+
const start = Math.max(0, Math.min(position - 80, text.length - 398));
|
|
825
|
+
const end = start + 398;
|
|
826
|
+
return `${start > 0 ? "\u2026" : ""}${text.slice(start, end)}${end < text.length ? "\u2026" : ""}`;
|
|
827
|
+
}
|
|
828
|
+
function searchHit(document, terms) {
|
|
829
|
+
return {
|
|
830
|
+
document: {
|
|
831
|
+
path: document.path,
|
|
832
|
+
relativePath: document.relativePath,
|
|
833
|
+
title: document.title,
|
|
834
|
+
route: document.route,
|
|
835
|
+
metadata: document.metadata,
|
|
836
|
+
...document.resource === void 0 ? {} : { resource: document.resource }
|
|
837
|
+
},
|
|
838
|
+
score: documentScore(document, terms),
|
|
839
|
+
matches: uniqueBlocks(document.blocks).map((block, index) => ({ block, index, score: blockScore(block, terms) })).filter((entry) => entry.score > 0).sort((left, right) => right.score - left.score || left.index - right.index).slice(0, 3).map(({ block }) => ({
|
|
840
|
+
id: block.id,
|
|
841
|
+
version: block.version,
|
|
842
|
+
source: block.source,
|
|
843
|
+
contributors: block.contributors,
|
|
844
|
+
excerpt: excerpt(block.readable, terms)
|
|
845
|
+
}))
|
|
846
|
+
};
|
|
847
|
+
}
|
|
848
|
+
function searchDocuments(documents, request) {
|
|
849
|
+
if (typeof request.query !== "string" || request.query.trim().length === 0 || request.query.trim().length > maximumSearchQueryLength) {
|
|
850
|
+
throw new Error(
|
|
851
|
+
`Reader search query must contain 1\u2013${maximumSearchQueryLength} characters after trimming.`
|
|
852
|
+
);
|
|
853
|
+
}
|
|
854
|
+
const limit = request.limit ?? defaultSearchLimit;
|
|
855
|
+
if (Number.isInteger(limit) === false || limit < 1 || limit > maximumSearchLimit2) {
|
|
856
|
+
throw new Error(`Reader search limit must be an integer from 1\u2013${maximumSearchLimit2}.`);
|
|
857
|
+
}
|
|
858
|
+
const query = request.query.trim();
|
|
859
|
+
const terms = searchTerms(query);
|
|
860
|
+
const hits = filterDocuments(documents, {
|
|
861
|
+
query,
|
|
862
|
+
type: request.type ?? "",
|
|
863
|
+
status: request.status ?? "",
|
|
864
|
+
tag: request.tag ?? ""
|
|
865
|
+
}).map((document) => searchHit(document, terms)).sort(
|
|
866
|
+
(left, right) => right.score - left.score || (left.document.relativePath < right.document.relativePath ? -1 : left.document.relativePath > right.document.relativePath ? 1 : `${left.document.resource?.sourceRegistrationId ?? ""}/${left.document.resource?.name ?? ""}`.localeCompare(
|
|
867
|
+
`${right.document.resource?.sourceRegistrationId ?? ""}/${right.document.resource?.name ?? ""}`
|
|
868
|
+
))
|
|
869
|
+
);
|
|
870
|
+
return {
|
|
871
|
+
query,
|
|
872
|
+
limit,
|
|
873
|
+
total: hits.length,
|
|
874
|
+
truncated: hits.length > limit,
|
|
875
|
+
hits: hits.slice(0, limit)
|
|
876
|
+
};
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
// packages/extension-docs/src/reader/search.ts
|
|
880
|
+
var searchReader = Effect_exports.fn("reader.searchReader")(function* (state, request) {
|
|
881
|
+
const { input, setup } = yield* resolveProjectDocsContext(state, request);
|
|
882
|
+
const corpus = yield* (yield* ReaderCorpus).loadProject(input);
|
|
883
|
+
const search = {
|
|
884
|
+
project: input.project,
|
|
885
|
+
// An empty setup has nothing to search, which is never complete coverage.
|
|
886
|
+
complete: corpus.complete && setup === void 0,
|
|
887
|
+
issues: corpus.issues,
|
|
888
|
+
...setup === void 0 ? {} : { setup },
|
|
889
|
+
...searchDocuments(corpus.documents, request)
|
|
890
|
+
};
|
|
891
|
+
return search;
|
|
892
|
+
});
|
|
893
|
+
|
|
894
|
+
// packages/extension-docs/src/views/mutation-views.ts
|
|
895
|
+
init_define_TACK_BUILD_INFO();
|
|
896
|
+
var docsMutationViews = (kit) => {
|
|
897
|
+
const { commandLine, mutationView, plural: plural2 } = kit;
|
|
898
|
+
const resourceText = (resource, style) => style.reference({ ...resource, kind: "docs" });
|
|
899
|
+
const docsFacts = (settings, style) => [
|
|
900
|
+
[
|
|
901
|
+
"attached",
|
|
902
|
+
settings.attachments.length === 0 ? ["none"] : settings.attachments.map((resource) => resourceText(resource, style))
|
|
903
|
+
],
|
|
904
|
+
["destination", settings.destination === void 0 ? [] : [settings.destination]],
|
|
905
|
+
[
|
|
906
|
+
"default",
|
|
907
|
+
settings.defaultWritingResource === void 0 ? [] : [resourceText(settings.defaultWritingResource, style)]
|
|
908
|
+
]
|
|
909
|
+
];
|
|
910
|
+
const docsReconcileHint = (projectName) => commandLine("sync", "--no-adapters", "--project", projectName);
|
|
911
|
+
const docsAttachView = mutationView((settings, style) => ({
|
|
912
|
+
scope: settings.projectName,
|
|
913
|
+
confirmation: `Docs attach saved for project ${settings.projectName}; it has ${plural2(settings.attachments.length, "attached resource")}.`,
|
|
914
|
+
facts: docsFacts(settings, style),
|
|
915
|
+
hints: [docsReconcileHint(settings.projectName)]
|
|
916
|
+
}));
|
|
917
|
+
const docsDetachView = mutationView((settings, style) => ({
|
|
918
|
+
scope: settings.projectName,
|
|
919
|
+
confirmation: `Docs detach saved for project ${settings.projectName}; ${settings.attachments.length === 0 ? "the project itself attaches no resources" : `${plural2(settings.attachments.length, "attached resource")} remain${settings.attachments.length === 1 ? "s" : ""}`}.`,
|
|
920
|
+
facts: docsFacts(settings, style),
|
|
921
|
+
hints: [docsReconcileHint(settings.projectName)]
|
|
922
|
+
}));
|
|
923
|
+
const docsConfigureView = mutationView(
|
|
924
|
+
(settings, style) => ({
|
|
925
|
+
scope: settings.projectName,
|
|
926
|
+
confirmation: `Docs settings saved for project ${settings.projectName}.`,
|
|
927
|
+
facts: docsFacts(settings, style)
|
|
928
|
+
})
|
|
929
|
+
);
|
|
930
|
+
return { docsAttachView, docsDetachView, docsConfigureView };
|
|
931
|
+
};
|
|
932
|
+
|
|
933
|
+
// packages/extension-docs/src/views/inspection-views.ts
|
|
934
|
+
init_define_TACK_BUILD_INFO();
|
|
935
|
+
var docsInspectionViews = (kit) => {
|
|
936
|
+
const {
|
|
937
|
+
cell,
|
|
938
|
+
commandLine,
|
|
939
|
+
entryLines,
|
|
940
|
+
factRows,
|
|
941
|
+
facts,
|
|
942
|
+
headingLines,
|
|
943
|
+
indented,
|
|
944
|
+
paragraph,
|
|
945
|
+
plural: plural2,
|
|
946
|
+
resultView
|
|
947
|
+
} = kit;
|
|
948
|
+
const referenceText = (resource, style) => style.reference({ ...resource, kind: "docs" });
|
|
949
|
+
const sameResource2 = (left, right) => right !== void 0 && left.sourceRegistrationId === right.sourceRegistrationId && left.name === right.name;
|
|
950
|
+
const docsListHints = ({ project, resources, issues, settings, setup, mounts, fromProfiles = [] }, style) => {
|
|
951
|
+
const [only, ...others] = resources;
|
|
952
|
+
const own = resources.find(
|
|
953
|
+
(resource) => fromProfiles.some((layered) => sameResource2(resource, layered)) === false
|
|
954
|
+
);
|
|
955
|
+
const unmounted = mounts.some((mount) => mount.state !== "mounted");
|
|
956
|
+
return [
|
|
957
|
+
...setup === void 0 ? [] : [setup.next],
|
|
958
|
+
...issues.length === 0 && !unmounted ? [] : [commandLine("sync", "--project", project.name)],
|
|
959
|
+
...only === void 0 ? [] : settings.defaultWritingResource !== void 0 || others.length === 0 ? [commandLine("docs-target", "--project", project.name)] : [
|
|
960
|
+
own === void 0 ? commandLine("docs-attach", referenceText(only, style), "--project", project.name) : commandLine(
|
|
961
|
+
"docs-configure",
|
|
962
|
+
"--project",
|
|
963
|
+
project.name,
|
|
964
|
+
"--default",
|
|
965
|
+
referenceText(own, style)
|
|
966
|
+
)
|
|
967
|
+
]
|
|
968
|
+
];
|
|
969
|
+
};
|
|
970
|
+
const writingMark = (resource, writing, style) => sameResource2(resource, writing) ? [` ${style.cyan("default writing resource")}`] : [];
|
|
971
|
+
const docsListView = resultView((docs, _envelope, style) => {
|
|
972
|
+
const { project, resources, issues, settings, fromProfiles = [] } = docs;
|
|
973
|
+
const writing = settings.defaultWritingResource;
|
|
974
|
+
const resourceEntries = resources.map((resource) => ({
|
|
975
|
+
head: [cell("\u2713 available", style.green), cell(referenceText(resource, style), style.bold)],
|
|
976
|
+
details: [
|
|
977
|
+
...writingMark(resource, writing, style),
|
|
978
|
+
...facts(
|
|
979
|
+
[
|
|
980
|
+
...fromProfiles.some((layered) => sameResource2(resource, layered)) ? [["attached by", "an enabled profile"]] : [],
|
|
981
|
+
["source", style.source(resource.sourceRegistrationId)],
|
|
982
|
+
["source path", style.path(resource.sourcePath)],
|
|
983
|
+
["docs", style.path(resource.directoryPath)],
|
|
984
|
+
...resource.readerConfig === void 0 ? [] : [
|
|
985
|
+
[
|
|
986
|
+
`reader config (${resource.readerConfig.kind})`,
|
|
987
|
+
style.path(resource.readerConfig.path)
|
|
988
|
+
]
|
|
989
|
+
]
|
|
990
|
+
],
|
|
991
|
+
4,
|
|
992
|
+
style
|
|
993
|
+
)
|
|
994
|
+
]
|
|
995
|
+
}));
|
|
996
|
+
const unavailable = issues.filter((issue) => issue.path === void 0);
|
|
997
|
+
const documentIssues = issues.filter((issue) => issue.path !== void 0);
|
|
998
|
+
const issueEntries = unavailable.map((issue) => ({
|
|
999
|
+
head: [
|
|
1000
|
+
cell("! unavailable", style.yellow),
|
|
1001
|
+
cell(referenceText(issue.resource, style), style.bold)
|
|
1002
|
+
],
|
|
1003
|
+
details: [
|
|
1004
|
+
...writingMark(issue.resource, writing, style),
|
|
1005
|
+
...facts(
|
|
1006
|
+
[
|
|
1007
|
+
["source", style.source(issue.resource.sourceRegistrationId)],
|
|
1008
|
+
...issue.sourcePath === "" ? [] : [["source path", style.path(issue.sourcePath)]]
|
|
1009
|
+
],
|
|
1010
|
+
4,
|
|
1011
|
+
style
|
|
1012
|
+
),
|
|
1013
|
+
...indented(`${issue.code}: ${issue.message}`, 4, style)
|
|
1014
|
+
]
|
|
1015
|
+
}));
|
|
1016
|
+
return {
|
|
1017
|
+
scope: `project ${project.name}`,
|
|
1018
|
+
body: [
|
|
1019
|
+
factRows(
|
|
1020
|
+
[
|
|
1021
|
+
["root", [cell(style.path(project.root))]],
|
|
1022
|
+
["destination", [cell(settings.destination ?? "default")]],
|
|
1023
|
+
[
|
|
1024
|
+
"default writing",
|
|
1025
|
+
[cell(writing === void 0 ? "none set" : referenceText(writing, style))]
|
|
1026
|
+
],
|
|
1027
|
+
...writing === void 0 ? [] : [["writing source", [cell(style.source(writing.sourceRegistrationId))]]]
|
|
1028
|
+
],
|
|
1029
|
+
style
|
|
1030
|
+
),
|
|
1031
|
+
resources.length + issues.length === 0 ? [
|
|
1032
|
+
...paragraph("No docs resources are attached.", { width: style.width }),
|
|
1033
|
+
...docs.setup === void 0 ? [] : [
|
|
1034
|
+
...paragraph(docs.setup.message, { width: style.width }),
|
|
1035
|
+
...paragraph(`Next: ${docs.setup.next}`, { width: style.width })
|
|
1036
|
+
]
|
|
1037
|
+
] : [
|
|
1038
|
+
...headingLines(
|
|
1039
|
+
"Attached docs",
|
|
1040
|
+
unavailable.length === 0 ? plural2(resources.length, "resource") : `${resources.length} available \xB7 ${unavailable.length} unavailable`,
|
|
1041
|
+
style
|
|
1042
|
+
),
|
|
1043
|
+
...entryLines([...resourceEntries, ...issueEntries], style)
|
|
1044
|
+
],
|
|
1045
|
+
factRows(
|
|
1046
|
+
[
|
|
1047
|
+
["documents", [cell(String(docs.documents))]],
|
|
1048
|
+
[
|
|
1049
|
+
"coverage",
|
|
1050
|
+
[cell(issues.length === 0 && docs.setup === void 0 ? "complete" : "incomplete")]
|
|
1051
|
+
]
|
|
1052
|
+
],
|
|
1053
|
+
style
|
|
1054
|
+
),
|
|
1055
|
+
documentIssues.length === 0 ? void 0 : [
|
|
1056
|
+
...headingLines(
|
|
1057
|
+
"Documents that failed to load",
|
|
1058
|
+
plural2(documentIssues.length, "document"),
|
|
1059
|
+
style
|
|
1060
|
+
),
|
|
1061
|
+
...documentIssues.flatMap((issue) => [
|
|
1062
|
+
...indented(`! ${referenceText(issue.resource, style)}`, 2, style),
|
|
1063
|
+
...indented(issue.message, 4, style)
|
|
1064
|
+
])
|
|
1065
|
+
],
|
|
1066
|
+
docs.mounts.length === 0 ? void 0 : [
|
|
1067
|
+
...headingLines("Mounts", "managed writing links", style),
|
|
1068
|
+
...entryLines(
|
|
1069
|
+
docs.mounts.map((mount) => ({
|
|
1070
|
+
head: [
|
|
1071
|
+
mount.state === "mounted" ? cell("\u2713 mounted", style.green) : cell(`! ${mount.state}`, style.yellow),
|
|
1072
|
+
cell(referenceText(mount.resource, style))
|
|
1073
|
+
],
|
|
1074
|
+
details: [
|
|
1075
|
+
...facts([["path", style.path(mount.destinationPath)]], 4, style),
|
|
1076
|
+
...mount.message === void 0 ? [] : indented(mount.message, 4, style)
|
|
1077
|
+
]
|
|
1078
|
+
})),
|
|
1079
|
+
style
|
|
1080
|
+
)
|
|
1081
|
+
]
|
|
1082
|
+
],
|
|
1083
|
+
hints: docsListHints(docs, style)
|
|
1084
|
+
};
|
|
1085
|
+
});
|
|
1086
|
+
const docsTargetView = resultView(
|
|
1087
|
+
(target, _envelope, style) => ({
|
|
1088
|
+
scope: `project ${target.projectName}`,
|
|
1089
|
+
body: [
|
|
1090
|
+
[
|
|
1091
|
+
style.bold("Verified writing target"),
|
|
1092
|
+
...factRows(
|
|
1093
|
+
[
|
|
1094
|
+
["mount", [cell(style.path(target.destinationPath))]],
|
|
1095
|
+
["resource", [cell(referenceText(target.resource, style))]],
|
|
1096
|
+
["source", [cell(style.source(target.resource.sourceRegistrationId))]],
|
|
1097
|
+
["docs directory", [cell(style.path(target.sourceDirectoryPath))]],
|
|
1098
|
+
["project root", [cell(style.path(target.root))]]
|
|
1099
|
+
],
|
|
1100
|
+
style
|
|
1101
|
+
)
|
|
1102
|
+
]
|
|
1103
|
+
]
|
|
1104
|
+
})
|
|
1105
|
+
);
|
|
1106
|
+
return { docsListView, docsTargetView };
|
|
1107
|
+
};
|
|
1108
|
+
|
|
1109
|
+
// packages/extension-docs/src/views/icons-view.ts
|
|
1110
|
+
init_define_TACK_BUILD_INFO();
|
|
1111
|
+
var docsIconsViews = (kit) => {
|
|
1112
|
+
const { cell, factRows, frameView, withoutPayload } = kit;
|
|
1113
|
+
const docsIconsView = (envelope, { result }, style) => {
|
|
1114
|
+
if (envelope.result === null) return withoutPayload(envelope, style);
|
|
1115
|
+
if (Option_exports.isNone(result) === true) return void 0;
|
|
1116
|
+
const lookup = result.value;
|
|
1117
|
+
return frameView(envelope, style, {
|
|
1118
|
+
body: [
|
|
1119
|
+
factRows(
|
|
1120
|
+
[
|
|
1121
|
+
["Lucide", [cell(lookup.lucideVersion)]],
|
|
1122
|
+
["Matches", [cell(String(lookup.count))]]
|
|
1123
|
+
],
|
|
1124
|
+
style
|
|
1125
|
+
),
|
|
1126
|
+
lookup.categories.flatMap(({ category, icons }) => [
|
|
1127
|
+
category,
|
|
1128
|
+
...icons.map(
|
|
1129
|
+
({ name, alias }) => ` ${name}${alias === void 0 ? "" : ` (was ${alias})`}`
|
|
1130
|
+
)
|
|
1131
|
+
])
|
|
1132
|
+
]
|
|
1133
|
+
});
|
|
1134
|
+
};
|
|
1135
|
+
return { docsIconsView };
|
|
1136
|
+
};
|
|
1137
|
+
|
|
1138
|
+
// packages/extension-docs/src/views/review-views.ts
|
|
1139
|
+
init_define_TACK_BUILD_INFO();
|
|
1140
|
+
var reviewViews = (kit) => {
|
|
1141
|
+
const { cell, commandLine, factRows, frameView, oneLine, paragraph, withoutPayload } = kit;
|
|
1142
|
+
const authoredLine = (line, width) => paragraph(line, { width, indent: Math.min(line.length - line.trimStart().length, 24) });
|
|
1143
|
+
const words = (text, indent, style) => text.split("\n").flatMap(
|
|
1144
|
+
(line) => line.trim() === "" ? [] : authoredLine(line, style.width - indent - 2).map(
|
|
1145
|
+
(shown) => `${" ".repeat(indent)}> ${shown}`
|
|
1146
|
+
)
|
|
1147
|
+
);
|
|
1148
|
+
const placeOf = ({ source }, style) => {
|
|
1149
|
+
const lines = source.startLine === source.endLine ? `${source.startLine}` : `${source.startLine}-${source.endLine}`;
|
|
1150
|
+
return `${style.path(source.path)}:${lines}`;
|
|
1151
|
+
};
|
|
1152
|
+
const figureLines = (figure, style) => figure === void 0 ? [] : [
|
|
1153
|
+
...paragraph(
|
|
1154
|
+
oneLine(
|
|
1155
|
+
["figure", figure.id, figure.title === void 0 ? void 0 : `"${figure.title}"`].filter((part) => part !== void 0).join(" ")
|
|
1156
|
+
),
|
|
1157
|
+
{ width: style.width, indent: 5 }
|
|
1158
|
+
),
|
|
1159
|
+
...figure.nodes.length === 0 ? [] : paragraph(`nodes ${figure.nodes.join(", ")}`, { width: style.width, indent: 5 }),
|
|
1160
|
+
...Object.keys(figure.state).length === 0 ? [] : paragraph(`state ${JSON.stringify(figure.state)}`, {
|
|
1161
|
+
width: style.width,
|
|
1162
|
+
indent: 5
|
|
1163
|
+
}),
|
|
1164
|
+
...(figure.source === void 0 ? [] : figure.source.split("\n")).flatMap(
|
|
1165
|
+
(line) => line.trim() === "" ? [""] : authoredLine(line, style.width - 7).map(
|
|
1166
|
+
(shown) => `${" ".repeat(7)}${style.dim(shown)}`
|
|
1167
|
+
)
|
|
1168
|
+
)
|
|
1169
|
+
];
|
|
1170
|
+
const commentLines = (comment, index, style) => [
|
|
1171
|
+
...paragraph(`${index + 1}. ${comment.target} at ${placeOf(comment, style)}`, {
|
|
1172
|
+
width: style.width,
|
|
1173
|
+
indent: 2
|
|
1174
|
+
}),
|
|
1175
|
+
...comment.quote === void 0 ? [] : paragraph(`on "${oneLine(comment.quote.exact)}"`, {
|
|
1176
|
+
width: style.width,
|
|
1177
|
+
indent: 5
|
|
1178
|
+
}),
|
|
1179
|
+
...figureLines(comment.figure, style),
|
|
1180
|
+
...words(comment.body, 5, style)
|
|
1181
|
+
];
|
|
1182
|
+
const questionLines = (question, style) => [
|
|
1183
|
+
...paragraph(
|
|
1184
|
+
`#${question.number} ${oneLine(question.title)}${question.answered === true || question.lostPicks !== void 0 ? "" : " (not answered)"}${question.changed === true ? " (changed after it was answered)" : ""}`,
|
|
1185
|
+
{ width: style.width, indent: 2 }
|
|
1186
|
+
),
|
|
1187
|
+
...question.options.flatMap(
|
|
1188
|
+
(option) => paragraph(
|
|
1189
|
+
`[${option.selected === true ? "x" : " "}] ${option.letter}. ${oneLine(option.label)}${option.recommended === true ? " (recommended)" : ""}`,
|
|
1190
|
+
{ width: style.width, indent: 5 }
|
|
1191
|
+
)
|
|
1192
|
+
),
|
|
1193
|
+
...(question.lostPicks ?? []).flatMap(
|
|
1194
|
+
({ value, label }) => paragraph(`[x] ${oneLine(label ?? value)} (no longer offered)`, {
|
|
1195
|
+
width: style.width,
|
|
1196
|
+
indent: 5
|
|
1197
|
+
})
|
|
1198
|
+
),
|
|
1199
|
+
...words(question.comment, 5, style)
|
|
1200
|
+
];
|
|
1201
|
+
const docsReviewWaitView = (envelope, { applied }, style) => {
|
|
1202
|
+
if (envelope.applied === null) return withoutPayload(envelope, style);
|
|
1203
|
+
if (Option_exports.isNone(applied) === true) return void 0;
|
|
1204
|
+
const delivery = applied.value;
|
|
1205
|
+
const { batch } = delivery;
|
|
1206
|
+
if (batch === void 0)
|
|
1207
|
+
return frameView(envelope, style, {
|
|
1208
|
+
scope: delivery.project,
|
|
1209
|
+
body: [
|
|
1210
|
+
paragraph(
|
|
1211
|
+
"No review arrived before the deadline. Wait again: a review sent meanwhile is kept.",
|
|
1212
|
+
{ width: style.width }
|
|
1213
|
+
)
|
|
1214
|
+
],
|
|
1215
|
+
hints: [
|
|
1216
|
+
commandLine(
|
|
1217
|
+
"docs-review-wait",
|
|
1218
|
+
"--project",
|
|
1219
|
+
delivery.project,
|
|
1220
|
+
...delivery.cwd === void 0 ? [] : ["--cwd", delivery.cwd],
|
|
1221
|
+
...delivery.page === void 0 ? [] : ["--page", delivery.page],
|
|
1222
|
+
...delivery.timeout === void 0 ? [] : ["--timeout", `${delivery.timeout}`]
|
|
1223
|
+
)
|
|
1224
|
+
]
|
|
1225
|
+
});
|
|
1226
|
+
const answered = batch.questions.filter((question) => question.answered === true);
|
|
1227
|
+
return frameView(envelope, style, {
|
|
1228
|
+
scope: delivery.project,
|
|
1229
|
+
body: [
|
|
1230
|
+
factRows(
|
|
1231
|
+
[
|
|
1232
|
+
["Review", [cell(batch.id)]],
|
|
1233
|
+
["Page", [cell(style.path(batch.page.path))]]
|
|
1234
|
+
],
|
|
1235
|
+
style
|
|
1236
|
+
),
|
|
1237
|
+
batch.comments.length === 0 ? void 0 : [
|
|
1238
|
+
style.bold(`Comments (${batch.comments.length})`),
|
|
1239
|
+
...batch.comments.flatMap((comment, index) => commentLines(comment, index, style))
|
|
1240
|
+
],
|
|
1241
|
+
batch.questions.length === 0 ? void 0 : [
|
|
1242
|
+
style.bold(`Questions (${answered.length} of ${batch.questions.length} answered)`),
|
|
1243
|
+
...batch.questions.flatMap((question) => questionLines(question, style))
|
|
1244
|
+
],
|
|
1245
|
+
batch.lostAnswers === void 0 ? void 0 : [
|
|
1246
|
+
style.bold(
|
|
1247
|
+
`Answers to questions no longer on the page (${batch.lostAnswers.length})`
|
|
1248
|
+
),
|
|
1249
|
+
...batch.lostAnswers.flatMap((lost) => [
|
|
1250
|
+
...paragraph(
|
|
1251
|
+
oneLine([lost.title, ...lost.selected.map((value) => `[${value}]`)].join(" ")),
|
|
1252
|
+
{ width: style.width, indent: 2 }
|
|
1253
|
+
),
|
|
1254
|
+
...words(lost.comment, 5, style)
|
|
1255
|
+
])
|
|
1256
|
+
],
|
|
1257
|
+
batch.note === void 0 ? void 0 : [style.bold("Note"), ...words(batch.note, 2, style)]
|
|
1258
|
+
]
|
|
1259
|
+
});
|
|
1260
|
+
};
|
|
1261
|
+
return { docsReviewWaitView };
|
|
1262
|
+
};
|
|
1263
|
+
|
|
1264
|
+
// packages/extension-docs/src/views/reader-views.ts
|
|
1265
|
+
init_define_TACK_BUILD_INFO();
|
|
1266
|
+
var readerViews = (kit) => {
|
|
1267
|
+
const {
|
|
1268
|
+
cell,
|
|
1269
|
+
commandLine,
|
|
1270
|
+
factRows,
|
|
1271
|
+
flow,
|
|
1272
|
+
frameView,
|
|
1273
|
+
oneLine,
|
|
1274
|
+
paragraph,
|
|
1275
|
+
plural: plural2,
|
|
1276
|
+
truncate,
|
|
1277
|
+
withoutPayload,
|
|
1278
|
+
wrapText
|
|
1279
|
+
} = kit;
|
|
1280
|
+
const readerView = (envelope, { result }, style) => {
|
|
1281
|
+
if (envelope.result === null) return withoutPayload(envelope, style);
|
|
1282
|
+
if (Option_exports.isNone(result) === true) return void 0;
|
|
1283
|
+
const started = result.value;
|
|
1284
|
+
return frameView(envelope, style, {
|
|
1285
|
+
scope: started.project.name,
|
|
1286
|
+
body: [
|
|
1287
|
+
[
|
|
1288
|
+
style.bold("Reader ready"),
|
|
1289
|
+
...factRows(
|
|
1290
|
+
[
|
|
1291
|
+
["URL", [cell(started.url)]],
|
|
1292
|
+
["Project", [cell(started.project.name)]],
|
|
1293
|
+
["Root", [cell(style.path(started.project.root))]]
|
|
1294
|
+
],
|
|
1295
|
+
style
|
|
1296
|
+
)
|
|
1297
|
+
],
|
|
1298
|
+
paragraph("Serving the attached docs in the foreground until interrupted.", {
|
|
1299
|
+
width: style.width
|
|
1300
|
+
})
|
|
1301
|
+
]
|
|
1302
|
+
});
|
|
1303
|
+
};
|
|
1304
|
+
const reviewSavedLine = (saved, projectName) => `Review ${saved.batch} saved for ${saved.page}: ${plural2(saved.comments, "comment")}, ${plural2(saved.answers, "answer")}. An agent receives it with: ${commandLine("docs-review-wait", "--project", projectName, "--page", saved.page)}
|
|
1305
|
+
`;
|
|
1306
|
+
const resourceText = (resource, style) => style.reference({
|
|
1307
|
+
sourceRegistrationId: resource.sourceRegistrationId,
|
|
1308
|
+
name: resource.name,
|
|
1309
|
+
kind: "docs"
|
|
1310
|
+
});
|
|
1311
|
+
const referenceText = (reference, style) => `${style.path(reference.path)}:${reference.startLine}${reference.endLine === reference.startLine ? "" : `-${reference.endLine}`}`;
|
|
1312
|
+
const readerSearchView = (envelope, { result }, style) => {
|
|
1313
|
+
if (envelope.result === null) return withoutPayload(envelope, style);
|
|
1314
|
+
if (Option_exports.isNone(result) === true) return void 0;
|
|
1315
|
+
const search = result.value;
|
|
1316
|
+
const { hits } = search;
|
|
1317
|
+
const resultsText = search.total === 0 ? "no documents match" : search.truncated ? `${hits.length} of ${search.total} hits shown, truncated at the limit of ${search.limit}` : `${plural2(search.total, "hit")}, within the limit of ${search.limit}`;
|
|
1318
|
+
const rows = [
|
|
1319
|
+
["Query", [cell(search.query)]],
|
|
1320
|
+
["Project", [cell(`${search.project.name} \xB7 ${style.path(search.project.root)}`)]],
|
|
1321
|
+
["Results", [cell(resultsText, search.truncated ? style.yellow : void 0)]],
|
|
1322
|
+
[
|
|
1323
|
+
"Coverage",
|
|
1324
|
+
[
|
|
1325
|
+
cell(
|
|
1326
|
+
search.complete ? "complete" : search.setup !== void 0 ? "incomplete, no docs are attached" : `incomplete, ${plural2(search.issues.length, "issue")} found; hits come from everything that loaded`,
|
|
1327
|
+
search.complete ? void 0 : style.yellow
|
|
1328
|
+
)
|
|
1329
|
+
]
|
|
1330
|
+
]
|
|
1331
|
+
];
|
|
1332
|
+
const digits = String(hits.length).length;
|
|
1333
|
+
const bullet = " ".repeat(digits + 4);
|
|
1334
|
+
const lineRoom = Math.max(10, style.width - bullet.length);
|
|
1335
|
+
const hitLines = hits.flatMap((hit, index) => {
|
|
1336
|
+
const { document } = hit;
|
|
1337
|
+
const metadata = [
|
|
1338
|
+
document.metadata.type === void 0 ? void 0 : `type ${document.metadata.type}`,
|
|
1339
|
+
document.metadata.status === void 0 ? void 0 : `status ${document.metadata.status}`,
|
|
1340
|
+
document.metadata.tags.length === 0 ? void 0 : `tags ${document.metadata.tags.join(", ")}`
|
|
1341
|
+
].filter((part) => part !== void 0);
|
|
1342
|
+
return [
|
|
1343
|
+
` ${String(index + 1).padStart(digits)}. ${style.bold(truncate(oneLine(document.title), Math.max(10, style.width - digits - 4)))}`,
|
|
1344
|
+
...wrapText(
|
|
1345
|
+
`${document.relativePath}${document.resource === void 0 ? "" : ` \xB7 ${resourceText(document.resource, style)}`}`,
|
|
1346
|
+
lineRoom
|
|
1347
|
+
).map((line) => `${bullet}${line}`),
|
|
1348
|
+
...metadata.length === 0 ? [] : paragraph(metadata.join(" \xB7 "), {
|
|
1349
|
+
width: style.width,
|
|
1350
|
+
indent: bullet.length,
|
|
1351
|
+
paint: style.dim
|
|
1352
|
+
}),
|
|
1353
|
+
...hit.matches.length === 0 ? [`${bullet}${style.dim(`no matching text; whole file ${style.path(document.path)}`)}`] : hit.matches.flatMap((match) => [
|
|
1354
|
+
...paragraph(referenceText(match.source, style), {
|
|
1355
|
+
width: style.width,
|
|
1356
|
+
indent: bullet.length
|
|
1357
|
+
}),
|
|
1358
|
+
`${bullet} ${truncate(oneLine(match.excerpt), Math.max(10, lineRoom - 2))}`,
|
|
1359
|
+
...match.contributors.flatMap(
|
|
1360
|
+
(contributor) => paragraph(
|
|
1361
|
+
`via ${referenceText(contributor, style)}${contributor.kind === void 0 ? "" : ` (${contributor.kind})`}`,
|
|
1362
|
+
{ width: style.width, indent: bullet.length + 2, paint: style.dim }
|
|
1363
|
+
)
|
|
1364
|
+
)
|
|
1365
|
+
])
|
|
1366
|
+
];
|
|
1367
|
+
});
|
|
1368
|
+
const unavailable = [
|
|
1369
|
+
...search.setup === void 0 ? [] : [
|
|
1370
|
+
` ${style.yellow("!")} ${search.setup.code}`,
|
|
1371
|
+
...paragraph(search.setup.message, { width: style.width, indent: 4 })
|
|
1372
|
+
],
|
|
1373
|
+
...search.issues.flatMap((issue) => [
|
|
1374
|
+
...flow(
|
|
1375
|
+
[
|
|
1376
|
+
cell("!", style.yellow),
|
|
1377
|
+
cell(resourceText(issue.resource, style)),
|
|
1378
|
+
cell("\xB7"),
|
|
1379
|
+
cell(issue.code)
|
|
1380
|
+
],
|
|
1381
|
+
{ width: style.width, indent: 2, hang: 4 }
|
|
1382
|
+
),
|
|
1383
|
+
...paragraph(issue.message, { width: style.width, indent: 4 }),
|
|
1384
|
+
// A document issue's message already names its file, so only resource issues add a path.
|
|
1385
|
+
...issue.path === void 0 ? paragraph(style.path(issue.sourcePath), {
|
|
1386
|
+
width: style.width,
|
|
1387
|
+
indent: 4,
|
|
1388
|
+
paint: style.dim
|
|
1389
|
+
}) : []
|
|
1390
|
+
])
|
|
1391
|
+
];
|
|
1392
|
+
const limitAdvice = !search.truncated ? void 0 : search.limit < maximumSearchLimit ? `Raise --limit (up to ${maximumSearchLimit}) or refine the query to see the other ${search.total - hits.length}.` : `The limit is at its maximum of ${maximumSearchLimit}; refine the query or add --type, --status or --tag.`;
|
|
1393
|
+
return frameView(envelope, style, {
|
|
1394
|
+
scope: search.project.name,
|
|
1395
|
+
body: [
|
|
1396
|
+
factRows(rows, style),
|
|
1397
|
+
hitLines.length === 0 ? void 0 : [style.bold("Hits"), ...hitLines],
|
|
1398
|
+
limitAdvice === void 0 ? void 0 : paragraph(limitAdvice, { width: style.width }),
|
|
1399
|
+
unavailable.length === 0 ? void 0 : [style.bold("Coverage issues"), ...unavailable]
|
|
1400
|
+
],
|
|
1401
|
+
hints: search.complete ? [] : [search.setup?.next ?? commandLine("docs-list", "--project", search.project.name)]
|
|
1402
|
+
});
|
|
1403
|
+
};
|
|
1404
|
+
return { readerView, readerSearchView, reviewSavedLine };
|
|
1405
|
+
};
|
|
1406
|
+
|
|
1407
|
+
// packages/extension-docs/src/failure.ts
|
|
1408
|
+
init_define_TACK_BUILD_INFO();
|
|
1409
|
+
var docsRunErrorTags = ["DocsError", "ReaderEngineStartError", "ReaderSearchError"];
|
|
1410
|
+
var isDocsRunError = (error) => docsRunErrorTags.some((tag) => Predicate_exports.isTagged(error, tag));
|
|
1411
|
+
var docsClassifications = {
|
|
1412
|
+
"docs-attached-by-profile": "invalid-configuration",
|
|
1413
|
+
"docs-default-not-attached": "invalid-configuration",
|
|
1414
|
+
"docs-default-unset": "invalid-configuration",
|
|
1415
|
+
"docs-destination-escape": "invalid-configuration",
|
|
1416
|
+
"docs-destination-invalid": "invalid-configuration",
|
|
1417
|
+
"docs-resource-ambiguous": "invalid-configuration",
|
|
1418
|
+
"docs-resource-invalid": "invalid-configuration",
|
|
1419
|
+
"docs-resource-not-attached": "invalid-configuration",
|
|
1420
|
+
"docs-destination-changed": "domain",
|
|
1421
|
+
"docs-mount-unavailable": "domain",
|
|
1422
|
+
"docs-parent-not-directory": "domain",
|
|
1423
|
+
"docs-parent-redirected": "domain",
|
|
1424
|
+
"docs-project-unavailable": "domain",
|
|
1425
|
+
"docs-resource-unavailable": "domain",
|
|
1426
|
+
"docs-review-folder": "domain",
|
|
1427
|
+
"docs-review-page": "invalid-configuration",
|
|
1428
|
+
"docs-root-moved": "domain",
|
|
1429
|
+
"docs-source-not-registered": "invalid-configuration",
|
|
1430
|
+
"docs-source-changed": "domain",
|
|
1431
|
+
"docs-verification-failed": "domain"
|
|
1432
|
+
};
|
|
1433
|
+
var isJson = Schema_exports.is(Schema_exports.Json);
|
|
1434
|
+
var publicFacts = (details) => Object.fromEntries(
|
|
1435
|
+
Object.entries(details).filter(
|
|
1436
|
+
(entry) => entry[0] !== "_tag" && entry[0] !== "code" && entry[1] !== void 0 && isJson(entry[1])
|
|
1437
|
+
)
|
|
1438
|
+
);
|
|
1439
|
+
var docsFailure = (error) => Match_exports.valueTags(error, {
|
|
1440
|
+
DocsError: (docs) => new ExtensionFailure({
|
|
1441
|
+
classification: docsClassifications[docs.code] ?? "invalid-configuration",
|
|
1442
|
+
code: docs.code,
|
|
1443
|
+
message: docs.message,
|
|
1444
|
+
details: publicFacts(docs.details ?? {}),
|
|
1445
|
+
...docs.next === void 0 ? {} : { next: docs.next }
|
|
1446
|
+
}),
|
|
1447
|
+
ReaderSearchError: (search) => new ExtensionFailure({
|
|
1448
|
+
classification: search.kind === "configuration" ? "invalid-configuration" : "internal",
|
|
1449
|
+
code: search.kind === "configuration" ? "reader-configuration" : "reader-search-read",
|
|
1450
|
+
message: search.message
|
|
1451
|
+
}),
|
|
1452
|
+
ReaderEngineStartError: (start) => new ExtensionFailure({
|
|
1453
|
+
classification: start.kind === "configuration" ? "invalid-configuration" : "domain",
|
|
1454
|
+
code: start.kind === "configuration" ? "reader-configuration" : start.kind === "port-in-use" ? "reader-port-in-use" : "reader-startup",
|
|
1455
|
+
message: start.message
|
|
1456
|
+
})
|
|
1457
|
+
});
|
|
1458
|
+
var withDocsFailures = (run) => run.pipe(Effect_exports.mapError((error) => isDocsRunError(error) ? docsFailure(error) : error));
|
|
1459
|
+
var readerUnavailable = ({ code, message, command, installer }) => new ExtensionFailure({
|
|
1460
|
+
classification: "invalid-configuration",
|
|
1461
|
+
code: code === "extension-package-version-mismatch" ? "reader-version-mismatch" : "reader-not-installed",
|
|
1462
|
+
message,
|
|
1463
|
+
details: { command: [...command], ...installer === void 0 ? {} : { installer } },
|
|
1464
|
+
next: [command]
|
|
1465
|
+
});
|
|
1466
|
+
|
|
1467
|
+
// packages/extension-docs/src/commands.ts
|
|
1468
|
+
var implement = implementFor();
|
|
1469
|
+
var docsSelector = (input) => ({
|
|
1470
|
+
...input.projectName === void 0 ? {} : { projectName: input.projectName },
|
|
1471
|
+
...input.cwd === void 0 ? {} : { cwd: input.cwd }
|
|
1472
|
+
});
|
|
1473
|
+
var setupWarning = (setup) => ({
|
|
1474
|
+
code: "docs-setup-incomplete",
|
|
1475
|
+
details: { next: setup.next },
|
|
1476
|
+
message: `${setup.message} Next: ${setup.next}`
|
|
1477
|
+
});
|
|
1478
|
+
var docsListOutcome = (outcome, docs) => outcome.result(docs, {
|
|
1479
|
+
warnings: [
|
|
1480
|
+
...docs.setup === void 0 ? [] : [setupWarning(docs.setup)],
|
|
1481
|
+
...docs.issues.length === 0 ? [] : [
|
|
1482
|
+
{
|
|
1483
|
+
code: "docs-partial",
|
|
1484
|
+
details: { issues: docs.issues.length },
|
|
1485
|
+
message: "Some attached docs resources or documents are unavailable."
|
|
1486
|
+
}
|
|
1487
|
+
]
|
|
1488
|
+
]
|
|
1489
|
+
});
|
|
1490
|
+
var docsSearchOutcome = (outcome, search) => outcome.result(search, {
|
|
1491
|
+
warnings: search.complete === true ? [] : search.setup === void 0 ? [
|
|
1492
|
+
{
|
|
1493
|
+
code: "reader-incomplete",
|
|
1494
|
+
message: "Some attached docs resources or documents are unavailable; search covers everything that loaded."
|
|
1495
|
+
}
|
|
1496
|
+
] : [setupWarning(search.setup)]
|
|
1497
|
+
});
|
|
1498
|
+
var docsIconsOutcome = (outcome, lookup) => outcome.result(lookup, {
|
|
1499
|
+
warnings: lookup.count === 0 && lookup.query !== void 0 ? [
|
|
1500
|
+
{
|
|
1501
|
+
code: "docs-icons-none",
|
|
1502
|
+
message: `No docs icon matches "${lookup.query}". Names say what an icon draws, so search for that (flask, not research), or run \`tack docs icons\` without a word to list them all.`
|
|
1503
|
+
}
|
|
1504
|
+
] : [],
|
|
1505
|
+
partial: false
|
|
1506
|
+
});
|
|
1507
|
+
var docsCommands = (kit) => {
|
|
1508
|
+
const { docsListView, docsTargetView } = docsInspectionViews(kit);
|
|
1509
|
+
const { docsAttachView, docsConfigureView, docsDetachView } = docsMutationViews(kit);
|
|
1510
|
+
const { docsIconsView } = docsIconsViews(kit);
|
|
1511
|
+
const { readerSearchView, readerView, reviewSavedLine } = readerViews(kit);
|
|
1512
|
+
const { docsReviewWaitView } = reviewViews(kit);
|
|
1513
|
+
const listCommand = implement(docsList, {
|
|
1514
|
+
run: (input, { stateOptions, outcome }) => withDocsFailures(
|
|
1515
|
+
inspectDocs(stateOptions, docsSelector(input)).pipe(
|
|
1516
|
+
Effect_exports.map((docs) => docsListOutcome(outcome, docs))
|
|
1517
|
+
)
|
|
1518
|
+
),
|
|
1519
|
+
view: docsListView
|
|
1520
|
+
});
|
|
1521
|
+
const attachCommand2 = implement(docsAttach, {
|
|
1522
|
+
run: (input, { stateOptions, outcome }) => withDocsFailures(
|
|
1523
|
+
attachDocs(stateOptions, docsSelector(input), input.resource).pipe(
|
|
1524
|
+
Effect_exports.map((settings) => outcome.applied(settings))
|
|
1525
|
+
)
|
|
1526
|
+
),
|
|
1527
|
+
view: docsAttachView
|
|
1528
|
+
});
|
|
1529
|
+
const detachCommand = implement(docsDetach, {
|
|
1530
|
+
run: (input, { stateOptions, outcome }) => withDocsFailures(
|
|
1531
|
+
detachDocs(stateOptions, docsSelector(input), input.resource).pipe(
|
|
1532
|
+
Effect_exports.map((settings) => outcome.applied(settings))
|
|
1533
|
+
)
|
|
1534
|
+
),
|
|
1535
|
+
view: docsDetachView
|
|
1536
|
+
});
|
|
1537
|
+
const searchCommand = implement(docsSearch, {
|
|
1538
|
+
run: (input, { stateOptions, outcome }) => withDocsFailures(
|
|
1539
|
+
searchReader(stateOptions, input).pipe(
|
|
1540
|
+
Effect_exports.map((search) => docsSearchOutcome(outcome, search))
|
|
1541
|
+
)
|
|
1542
|
+
),
|
|
1543
|
+
view: readerSearchView
|
|
1544
|
+
});
|
|
1545
|
+
const iconsCommand = implement(docsIcons, {
|
|
1546
|
+
stateless: true,
|
|
1547
|
+
run: (input, { outcome }) => Effect_exports.sync(() => docsIconsOutcome(outcome, lookUpDocsIcons(input.word))),
|
|
1548
|
+
view: docsIconsView
|
|
1549
|
+
});
|
|
1550
|
+
const serveCommand = implement(docsServe, {
|
|
1551
|
+
run: (input, { stateOptions, outcome }) => withDocsFailures(
|
|
1552
|
+
Effect_exports.gen(function* () {
|
|
1553
|
+
const host = yield* DocsHost;
|
|
1554
|
+
const project = yield* resolveProjectDocs(stateOptions, input);
|
|
1555
|
+
const refusal = yield* host.payloadRefusal("tack docs serve");
|
|
1556
|
+
if (refusal !== void 0) return yield* readerUnavailable(refusal);
|
|
1557
|
+
const stateDirectory = yield* host.stateDirectory(stateOptions);
|
|
1558
|
+
const cacheDirectory = yield* holdReaderCache(stateDirectory, project.project);
|
|
1559
|
+
const reader = yield* Reader;
|
|
1560
|
+
const session = yield* reader.start({
|
|
1561
|
+
input: project,
|
|
1562
|
+
...cacheDirectory === void 0 ? {} : { cacheDirectory },
|
|
1563
|
+
reviewDirectory: reviewDirectory(stateDirectory, project.project.name),
|
|
1564
|
+
open: input.open ?? (yield* host.interactive()),
|
|
1565
|
+
...input.port === void 0 ? {} : { port: input.port }
|
|
1566
|
+
});
|
|
1567
|
+
const stdio = yield* Stdio_exports.Stdio;
|
|
1568
|
+
yield* session.reviews.pipe(
|
|
1569
|
+
Stream_exports.map((saved) => reviewSavedLine(saved, project.project.name)),
|
|
1570
|
+
Stream_exports.run(stdio.stderr()),
|
|
1571
|
+
Effect_exports.ignore,
|
|
1572
|
+
Effect_exports.forkScoped
|
|
1573
|
+
);
|
|
1574
|
+
return {
|
|
1575
|
+
outcome: outcome.result({ url: session.url, project: project.project }),
|
|
1576
|
+
// Startup success reports readiness; a later engine failure uses stderr and the exit.
|
|
1577
|
+
serve: session.closed.pipe(
|
|
1578
|
+
Effect_exports.catch((error) => Effect_exports.fail(new SessionStopped({ message: error.message })))
|
|
1579
|
+
)
|
|
1580
|
+
};
|
|
1581
|
+
})
|
|
1582
|
+
),
|
|
1583
|
+
view: readerView
|
|
1584
|
+
});
|
|
1585
|
+
const configureCommand = implement(docsConfigure, {
|
|
1586
|
+
run: (input, { stateOptions, outcome }) => withDocsFailures(
|
|
1587
|
+
configureDocs(stateOptions, docsSelector(input), {
|
|
1588
|
+
...input.destination === void 0 ? {} : { destination: input.destination },
|
|
1589
|
+
...input.defaultWritingResource === void 0 ? {} : { defaultWritingResource: input.defaultWritingResource },
|
|
1590
|
+
clearDefault: input.clearDefault
|
|
1591
|
+
}).pipe(Effect_exports.map((settings) => outcome.applied(settings)))
|
|
1592
|
+
),
|
|
1593
|
+
view: docsConfigureView
|
|
1594
|
+
});
|
|
1595
|
+
const targetCommand = implement(docsTarget, {
|
|
1596
|
+
run: (input, { stateOptions, outcome }) => withDocsFailures(
|
|
1597
|
+
resolveDocsTarget(stateOptions, {
|
|
1598
|
+
...docsSelector(input),
|
|
1599
|
+
...input.resource === void 0 ? {} : { resource: input.resource }
|
|
1600
|
+
}).pipe(Effect_exports.map((target) => outcome.result(target)))
|
|
1601
|
+
),
|
|
1602
|
+
view: docsTargetView
|
|
1603
|
+
});
|
|
1604
|
+
const reviewWaitCommand = implement(docsReviewWait, {
|
|
1605
|
+
run: (input, { stateOptions, outcome }) => withDocsFailures(
|
|
1606
|
+
waitForReview(stateOptions, input).pipe(
|
|
1607
|
+
Effect_exports.map(
|
|
1608
|
+
({ project, batch, unreadable }) => outcome.applied(
|
|
1609
|
+
{
|
|
1610
|
+
status: Option_exports.isSome(batch) ? "received" : "timed-out",
|
|
1611
|
+
project,
|
|
1612
|
+
...input.page === void 0 ? {} : { page: input.page },
|
|
1613
|
+
...input.cwd === void 0 ? {} : { cwd: input.cwd },
|
|
1614
|
+
...input.timeoutSeconds === void 0 ? {} : { timeout: input.timeoutSeconds },
|
|
1615
|
+
...Option_exports.isSome(batch) ? { batch: batch.value } : {}
|
|
1616
|
+
},
|
|
1617
|
+
{
|
|
1618
|
+
partial: false,
|
|
1619
|
+
warnings: unreadable.map((path) => ({
|
|
1620
|
+
code: "docs-review-unreadable",
|
|
1621
|
+
message: `${path} is not a review this Tack can read, and was left: another Tack version wrote it, or it changed. Move it away, or upgrade Tack.`
|
|
1622
|
+
}))
|
|
1623
|
+
}
|
|
1624
|
+
)
|
|
1625
|
+
)
|
|
1626
|
+
)
|
|
1627
|
+
),
|
|
1628
|
+
view: docsReviewWaitView
|
|
1629
|
+
});
|
|
1630
|
+
return [
|
|
1631
|
+
listCommand,
|
|
1632
|
+
attachCommand2,
|
|
1633
|
+
detachCommand,
|
|
1634
|
+
searchCommand,
|
|
1635
|
+
iconsCommand,
|
|
1636
|
+
serveCommand,
|
|
1637
|
+
configureCommand,
|
|
1638
|
+
targetCommand,
|
|
1639
|
+
reviewWaitCommand
|
|
1640
|
+
];
|
|
1641
|
+
};
|
|
1642
|
+
|
|
1643
|
+
// packages/extension-docs/src/slots.ts
|
|
1644
|
+
init_define_TACK_BUILD_INFO();
|
|
1645
|
+
|
|
1646
|
+
// packages/extension-docs/src/reader/page-rules.ts
|
|
1647
|
+
init_define_TACK_BUILD_INFO();
|
|
1648
|
+
|
|
1649
|
+
// packages/extension-docs/src/reader/figure-check.ts
|
|
1650
|
+
init_define_TACK_BUILD_INFO();
|
|
1651
|
+
var checkDocsFigures = Effect_exports.fn("reader.checkDocsFigures")(function* (paths) {
|
|
1652
|
+
return yield* (yield* ReaderCorpus).checkFigures(paths);
|
|
1653
|
+
});
|
|
1654
|
+
|
|
1655
|
+
// packages/extension-docs/src/reader/page-rules.ts
|
|
1656
|
+
var figureDetector = {
|
|
1657
|
+
name: "figures",
|
|
1658
|
+
inspect: (file) => checkDocsFigures([file]).pipe(
|
|
1659
|
+
Effect_exports.map((report) => ({
|
|
1660
|
+
details: [
|
|
1661
|
+
`Figures (${report.figures})`,
|
|
1662
|
+
`Icons (${report.icons})`,
|
|
1663
|
+
`Author components (${report.components})`
|
|
1664
|
+
],
|
|
1665
|
+
findings: report.documents.flatMap((document) => [
|
|
1666
|
+
...document.figures.flatMap(
|
|
1667
|
+
(figure) => figure.status === "issues" ? [
|
|
1668
|
+
{
|
|
1669
|
+
code: "figure-issues",
|
|
1670
|
+
severity: "error",
|
|
1671
|
+
file: document.path,
|
|
1672
|
+
line: Math.max(1, figure.line),
|
|
1673
|
+
message: `${figure.id}: ${figure.issues.join("; ")}`
|
|
1674
|
+
}
|
|
1675
|
+
] : figure.status === "not-checked" ? [
|
|
1676
|
+
{
|
|
1677
|
+
code: "figure-not-checked",
|
|
1678
|
+
severity: "warning",
|
|
1679
|
+
file: document.path,
|
|
1680
|
+
line: Math.max(1, figure.line),
|
|
1681
|
+
message: `${figure.id}: ${figure.reason}`
|
|
1682
|
+
}
|
|
1683
|
+
] : (figure.unchecked ?? []).map((message) => ({
|
|
1684
|
+
code: "figure-partly-checked",
|
|
1685
|
+
severity: "warning",
|
|
1686
|
+
file: document.path,
|
|
1687
|
+
line: Math.max(1, figure.line),
|
|
1688
|
+
message: `${figure.id}: ${message}`
|
|
1689
|
+
}))
|
|
1690
|
+
),
|
|
1691
|
+
...document.iconIssues.map((issue) => ({
|
|
1692
|
+
code: "icon-unknown",
|
|
1693
|
+
severity: "error",
|
|
1694
|
+
file: document.path,
|
|
1695
|
+
line: Math.max(1, issue.line),
|
|
1696
|
+
message: issue.message
|
|
1697
|
+
})),
|
|
1698
|
+
...document.componentIssues.map((issue) => ({
|
|
1699
|
+
code: "component-issue",
|
|
1700
|
+
severity: "error",
|
|
1701
|
+
file: document.path,
|
|
1702
|
+
line: Math.max(1, issue.line),
|
|
1703
|
+
message: issue.message
|
|
1704
|
+
}))
|
|
1705
|
+
])
|
|
1706
|
+
})),
|
|
1707
|
+
Effect_exports.catch(
|
|
1708
|
+
(error) => Effect_exports.succeed({
|
|
1709
|
+
details: [],
|
|
1710
|
+
findings: [
|
|
1711
|
+
{
|
|
1712
|
+
code: "check-docs-read",
|
|
1713
|
+
severity: "error",
|
|
1714
|
+
file,
|
|
1715
|
+
line: 1,
|
|
1716
|
+
message: error.message
|
|
1717
|
+
}
|
|
1718
|
+
]
|
|
1719
|
+
})
|
|
1720
|
+
)
|
|
1721
|
+
)
|
|
1722
|
+
};
|
|
1723
|
+
|
|
1724
|
+
// packages/extension-docs/src/explorer.ts
|
|
1725
|
+
init_define_TACK_BUILD_INFO();
|
|
1726
|
+
var docsExplorer = {
|
|
1727
|
+
attached: (project) => docsSettingsOf(project.name, project.slice, project.fixed, project.layered)?.attachments ?? [],
|
|
1728
|
+
staged: (project, changes) => {
|
|
1729
|
+
const settings = docsSettingsOf(
|
|
1730
|
+
project.name,
|
|
1731
|
+
project.slice,
|
|
1732
|
+
project.fixed,
|
|
1733
|
+
[]
|
|
1734
|
+
) ?? {
|
|
1735
|
+
projectName: project.name,
|
|
1736
|
+
attachments: []
|
|
1737
|
+
};
|
|
1738
|
+
return docsSliceOf(
|
|
1739
|
+
changes.reduce((latest, { resource, attached }) => {
|
|
1740
|
+
const others = latest.attachments.filter((entry) => !sameDocsResource(entry, resource));
|
|
1741
|
+
const { defaultWritingResource, ...rest } = latest;
|
|
1742
|
+
return {
|
|
1743
|
+
...rest,
|
|
1744
|
+
attachments: attached ? [...others, resource] : others,
|
|
1745
|
+
// A detached resource is no longer where the project writes.
|
|
1746
|
+
...defaultWritingResource !== void 0 && (attached || !sameDocsResource(defaultWritingResource, resource)) ? { defaultWritingResource } : {}
|
|
1747
|
+
};
|
|
1748
|
+
}, settings)
|
|
1749
|
+
);
|
|
1750
|
+
},
|
|
1751
|
+
attach: (state, projectName, reference) => attachDocs(state, { projectName }, { reference }).pipe(Effect_exports.asVoid),
|
|
1752
|
+
detach: (state, projectName, reference) => detachDocs(state, { projectName }, { reference }).pipe(Effect_exports.asVoid),
|
|
1753
|
+
preview: Effect_exports.fnUntraced(function* (resource) {
|
|
1754
|
+
const reader = yield* ReaderCorpus;
|
|
1755
|
+
const corpus = yield* reader.loadProject({
|
|
1756
|
+
project: { name: "explore", root: resource.sourcePath },
|
|
1757
|
+
resources: [
|
|
1758
|
+
{
|
|
1759
|
+
name: resource.name,
|
|
1760
|
+
sourceRegistrationId: resource.sourceRegistrationId,
|
|
1761
|
+
sourcePath: resource.sourcePath,
|
|
1762
|
+
directoryPath: resource.directoryPath,
|
|
1763
|
+
...resource.readerConfig === void 0 ? {} : { readerConfig: resource.readerConfig }
|
|
1764
|
+
}
|
|
1765
|
+
],
|
|
1766
|
+
issues: []
|
|
1767
|
+
}).pipe(
|
|
1768
|
+
Effect_exports.catch(
|
|
1769
|
+
(error) => Effect_exports.succeed({ documents: [], issues: [{ message: error.message }] })
|
|
1770
|
+
)
|
|
1771
|
+
);
|
|
1772
|
+
const lines = [
|
|
1773
|
+
...corpus.documents.map((document) => document.relativePath),
|
|
1774
|
+
...corpus.issues.map((issue) => `Cannot load docs: ${issue.message}`)
|
|
1775
|
+
];
|
|
1776
|
+
return lines.length === 0 ? ["No Markdown files in the reader corpus."] : lines;
|
|
1777
|
+
})
|
|
1778
|
+
};
|
|
1779
|
+
|
|
1780
|
+
// packages/extension-docs/src/docs-doctor.ts
|
|
1781
|
+
init_define_TACK_BUILD_INFO();
|
|
1782
|
+
var docsCheck = Effect_exports.fnUntraced(function* (state, status, next) {
|
|
1783
|
+
const reader = yield* (yield* DocsHost).read(state);
|
|
1784
|
+
const attached = reader.projects.flatMap((project) => {
|
|
1785
|
+
const settings = docsSettingsOf(project.name, project.slice, project.fixed, project.layered);
|
|
1786
|
+
return settings !== void 0 && settings.attachments.length > 0 && status.projects.some((reported) => reported.name === project.name) ? [settings] : [];
|
|
1787
|
+
});
|
|
1788
|
+
if (attached.length === 0)
|
|
1789
|
+
return skippedCheck("docs", "No docs resource is attached to a project.");
|
|
1790
|
+
const findings = yield* Effect_exports.forEach(
|
|
1791
|
+
attached,
|
|
1792
|
+
({ projectName }) => inspectDocs(state, { projectName }).pipe(
|
|
1793
|
+
Effect_exports.map((docs) => ({
|
|
1794
|
+
projectName,
|
|
1795
|
+
unloadable: docs.issues.length > 0,
|
|
1796
|
+
conflict: docs.mounts.some((mount) => mount.state === "conflict"),
|
|
1797
|
+
pending: docs.mounts.some((mount) => mount.state !== "mounted")
|
|
1798
|
+
})),
|
|
1799
|
+
Effect_exports.map((finding) => ({ ...finding, failure: void 0 })),
|
|
1800
|
+
Effect_exports.catch(
|
|
1801
|
+
(error) => Effect_exports.succeed({
|
|
1802
|
+
projectName,
|
|
1803
|
+
unloadable: false,
|
|
1804
|
+
conflict: false,
|
|
1805
|
+
pending: false,
|
|
1806
|
+
// Only the root-ineligible case belongs to the `projects` check; anything else did not
|
|
1807
|
+
// observe the docs, so it cannot be a pass.
|
|
1808
|
+
failure: error instanceof DocsError && error.code === "docs-project-unavailable" ? void 0 : error.message
|
|
1809
|
+
})
|
|
1810
|
+
)
|
|
1811
|
+
)
|
|
1812
|
+
);
|
|
1813
|
+
const unobserved = findings.filter(({ failure }) => failure !== void 0);
|
|
1814
|
+
const [firstUnobserved] = unobserved;
|
|
1815
|
+
if (firstUnobserved !== void 0)
|
|
1816
|
+
return {
|
|
1817
|
+
id: "docs",
|
|
1818
|
+
outcome: "failed",
|
|
1819
|
+
message: `${plural(unobserved.length, "project")} whose docs could not be observed: ${firstUnobserved.failure}`,
|
|
1820
|
+
subjects: sorted(unobserved.map(({ projectName }) => projectName)),
|
|
1821
|
+
next: next(["tack", "docs", "--project", firstUnobserved.projectName])
|
|
1822
|
+
};
|
|
1823
|
+
const problems = findings.filter(({ unloadable, pending }) => unloadable || pending).map((finding) => ({ ...finding, failing: finding.unloadable || finding.conflict }));
|
|
1824
|
+
const first = problems.find(({ failing }) => failing) ?? problems[0];
|
|
1825
|
+
if (first === void 0)
|
|
1826
|
+
return {
|
|
1827
|
+
id: "docs",
|
|
1828
|
+
outcome: "ok",
|
|
1829
|
+
message: `${plural(attached.length, "project")} with attached docs, all mounted and loading.`
|
|
1830
|
+
};
|
|
1831
|
+
return {
|
|
1832
|
+
id: "docs",
|
|
1833
|
+
outcome: first.failing ? "failed" : "warning",
|
|
1834
|
+
message: first.failing ? `${plural(problems.length, "project")} with a docs resource or document that fails to load, or a conflicting mount.` : `${plural(problems.length, "project")} with an attached docs resource that is not mounted.`,
|
|
1835
|
+
subjects: sorted(problems.map(({ projectName }) => projectName)),
|
|
1836
|
+
// Mounts are repaired by reconciling; a document or resource that fails to load is inspected.
|
|
1837
|
+
next: next(
|
|
1838
|
+
first.unloadable && !first.conflict && !first.pending ? ["tack", "docs", "--project", first.projectName] : ["tack", "sync", "--project", first.projectName]
|
|
1839
|
+
)
|
|
1840
|
+
};
|
|
1841
|
+
});
|
|
1842
|
+
|
|
1843
|
+
// packages/extension-docs/src/slots.ts
|
|
1844
|
+
var docsSlots = {
|
|
1845
|
+
id: "docs",
|
|
1846
|
+
mountRequests: docsMountRequests,
|
|
1847
|
+
sourceMounts: (project) => {
|
|
1848
|
+
const settings = docsSettingsOf(project.name, project.slice, project.fixed, project.layered);
|
|
1849
|
+
return settings === void 0 ? [] : settings.attachments.map((attachment) => ({
|
|
1850
|
+
sourceRegistrationId: attachment.sourceRegistrationId,
|
|
1851
|
+
name: attachment.name,
|
|
1852
|
+
path: `${docsMountDirectory(settings)}/${attachment.sourceRegistrationId}/${attachment.name}`
|
|
1853
|
+
}));
|
|
1854
|
+
},
|
|
1855
|
+
statusProject: ({ slice, layered }) => (slice?.attachments ?? []).length + layered.length === 0 ? {} : { docsDestination: docsMountDirectory(slice ?? {}) },
|
|
1856
|
+
checkRules: [figureDetector],
|
|
1857
|
+
explorer: docsExplorer,
|
|
1858
|
+
doctorChecks: (stateOptions, status, next) => Effect_exports.map(docsCheck(stateOptions, status, next), (check) => [check])
|
|
1859
|
+
};
|
|
1860
|
+
|
|
1861
|
+
// packages/extension-docs/src/index.ts
|
|
1862
|
+
var docsExtension = {
|
|
1863
|
+
id: "docs",
|
|
1864
|
+
commands: docsCommands,
|
|
1865
|
+
slots: docsSlots
|
|
1866
|
+
};
|
|
1867
|
+
var src_default = docsExtension;
|
|
1868
|
+
export {
|
|
1869
|
+
src_default as default
|
|
1870
|
+
};
|
|
1871
|
+
/* v8 ignore next -- @preserve */
|