@bendyline/gezel-cli 1.2.13 → 1.2.14
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/README.md +5 -0
- package/dist/app-author-command.js +2 -0
- package/dist/app-guide.js +128 -0
- package/dist/bin/gezel-main.js +1782 -1636
- package/dist/handboek-export.js +175 -53
- package/dist/tui/index.js +23 -7
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -352,6 +352,11 @@ app already includes it:
|
|
|
352
352
|
npm install -g @huggingface/transformers@^4.3.1
|
|
353
353
|
```
|
|
354
354
|
|
|
355
|
+
npm 12 then reports that the install scripts of `onnxruntime-node` and
|
|
356
|
+
`protobufjs` were blocked. That is expected and harmless: the first only
|
|
357
|
+
downloads CUDA libraries Gezel does not use, and the second only checks
|
|
358
|
+
versions.
|
|
359
|
+
|
|
355
360
|
In a project install, also add the `overrides` from the
|
|
356
361
|
[`@bendyline/gezel-service` README](https://www.npmjs.com/package/@bendyline/gezel-service),
|
|
357
362
|
which keep Kokoro on the same Transformers.js copy as the service.
|
|
@@ -360,6 +360,7 @@ Authoring references:
|
|
|
360
360
|
- [Building Gezel apps](https://github.com/bendyline/gezel/blob/main/docs/building-gezel-apps.md)
|
|
361
361
|
- [Page APIs](https://github.com/bendyline/gezel/blob/main/docs/output-pane-api.md)
|
|
362
362
|
- [Page style guide](https://github.com/bendyline/gezel/blob/main/docs/handboek/technical/gezel-app-page-style-guide.md)
|
|
363
|
+
- [App UX guide](https://github.com/bendyline/gezel/blob/main/docs/handboek/technical/gezel-app-ux-guide.md)
|
|
363
364
|
`
|
|
364
365
|
],
|
|
365
366
|
[
|
|
@@ -742,6 +743,7 @@ async function runAppNew(id, opts = {}) {
|
|
|
742
743
|
}
|
|
743
744
|
console.log(`Scaffolded ${id} (${files.length} files) in ${target}`);
|
|
744
745
|
console.log("Next:");
|
|
746
|
+
console.log(" 0. Read the guide first (or give it to your AI agent): gezel app guide");
|
|
745
747
|
console.log(" 1. Edit items/ \u2014 start with the two about.md files and the version manifest.");
|
|
746
748
|
console.log(` 2. gezel app validate ${id}`);
|
|
747
749
|
console.log(` 3. gezel app pack ${id}`);
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/app-guide.ts
|
|
4
|
+
import { createHandboekEngine, siteDeviceInfo } from "@bendyline/gezel-service/handboek";
|
|
5
|
+
|
|
6
|
+
// src/connection.ts
|
|
7
|
+
import { createHash, randomUUID } from "crypto";
|
|
8
|
+
import { chmod, mkdir, readFile, realpath, rm, writeFile } from "fs/promises";
|
|
9
|
+
import { homedir } from "os";
|
|
10
|
+
import { basename, dirname, join, resolve } from "path";
|
|
11
|
+
import { fileURLToPath } from "url";
|
|
12
|
+
import {
|
|
13
|
+
evaluateApiCompat,
|
|
14
|
+
getLogLevel,
|
|
15
|
+
getLogOutput,
|
|
16
|
+
gezelNamesInUse,
|
|
17
|
+
pickUnusedGezelName,
|
|
18
|
+
projectLeadGezelId,
|
|
19
|
+
roleForMatching,
|
|
20
|
+
setLogLevel,
|
|
21
|
+
setLogOutput
|
|
22
|
+
} from "@bendyline/gezel";
|
|
23
|
+
import {
|
|
24
|
+
GezelSdkError,
|
|
25
|
+
authorizeLocal,
|
|
26
|
+
authorizeLocalOwner
|
|
27
|
+
} from "@bendyline/gezel-app-sdk";
|
|
28
|
+
import {
|
|
29
|
+
DaemonInAnotherNamespaceError,
|
|
30
|
+
GezelApiError,
|
|
31
|
+
GezelClient,
|
|
32
|
+
LiveDaemonUnhealthyError,
|
|
33
|
+
createTrustingFetch,
|
|
34
|
+
discoverOrSpawn,
|
|
35
|
+
electronNativeBinCandidates,
|
|
36
|
+
ensureProjectForFolder as ensureClientProjectForFolder,
|
|
37
|
+
forbiddenProjectFolderName,
|
|
38
|
+
isProcessAlive,
|
|
39
|
+
readRuntime,
|
|
40
|
+
readSystemServiceEndpoint,
|
|
41
|
+
resolveDaemonEntry,
|
|
42
|
+
stopOwnedDaemon,
|
|
43
|
+
systemServiceRuntimeIsStale,
|
|
44
|
+
systemSharedAssetsDir
|
|
45
|
+
} from "@bendyline/gezel-client/node";
|
|
46
|
+
import { gezelHome, gezelPaths, nativePayloadVerificationPath } from "@bendyline/gezel/paths";
|
|
47
|
+
var CliError = class extends Error {
|
|
48
|
+
constructor(message) {
|
|
49
|
+
super(message);
|
|
50
|
+
this.name = "CliError";
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// src/handboek-links.ts
|
|
55
|
+
var PUBLISHED_HANDBOEK = "https://gezel.com/docs/";
|
|
56
|
+
var up = (depth) => "../".repeat(depth);
|
|
57
|
+
function rewriteSiteLinks(markdown, pageId, ids, byStem, hasAsset = () => true, base) {
|
|
58
|
+
const prefix = base ?? up(pageId.split("/").length);
|
|
59
|
+
return markdown.replace(/\]\(([^()\s]+)\)/g, (whole, rawTarget) => {
|
|
60
|
+
if (/^[a-z][a-z0-9+.-]*:/i.test(rawTarget) || rawTarget.startsWith("//") || rawTarget.startsWith("#")) {
|
|
61
|
+
return whole;
|
|
62
|
+
}
|
|
63
|
+
const [path, suffix = ""] = splitLinkSuffix(rawTarget);
|
|
64
|
+
const candidate = path.replace(/^(\.\.?\/)+/, "");
|
|
65
|
+
if (candidate.startsWith("assets/")) {
|
|
66
|
+
return hasAsset(candidate) ? `](${prefix}${candidate}${suffix})` : `](${PUBLISHED_HANDBOEK}${candidate}${suffix})`;
|
|
67
|
+
}
|
|
68
|
+
const article = candidate.replace(/\.md$/, "");
|
|
69
|
+
const target = ids.has(article) ? article : byStem.get(article.split("/").pop() ?? "");
|
|
70
|
+
if (!target) return whole;
|
|
71
|
+
return `](${prefix}${target}/${suffix})`;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
function siteLinkIndex(entryIds) {
|
|
75
|
+
const byStem = /* @__PURE__ */ new Map();
|
|
76
|
+
for (const id of entryIds) {
|
|
77
|
+
const stem = id.split("/").pop();
|
|
78
|
+
if (stem && !byStem.has(stem)) byStem.set(stem, id);
|
|
79
|
+
}
|
|
80
|
+
return { ids: new Set(entryIds), byStem };
|
|
81
|
+
}
|
|
82
|
+
function splitLinkSuffix(raw) {
|
|
83
|
+
const idx = raw.search(/[?#]/);
|
|
84
|
+
return idx === -1 ? [raw, ""] : [raw.slice(0, idx), raw.slice(idx)];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// src/app-guide.ts
|
|
88
|
+
var APP_GUIDE_ARTICLE_ID = "build-a-gezel-app";
|
|
89
|
+
var NO_CATALOG = {
|
|
90
|
+
list: async () => [],
|
|
91
|
+
get: async () => null
|
|
92
|
+
};
|
|
93
|
+
async function renderAppGuide(opts = {}) {
|
|
94
|
+
const engine = createHandboekEngine({
|
|
95
|
+
catalog: NO_CATALOG,
|
|
96
|
+
device: siteDeviceInfo,
|
|
97
|
+
...opts.contentDir ? { contentDir: opts.contentDir } : {}
|
|
98
|
+
});
|
|
99
|
+
const article = await engine.article(APP_GUIDE_ARTICLE_ID, {
|
|
100
|
+
mode: "agent",
|
|
101
|
+
inlineIncludes: true
|
|
102
|
+
});
|
|
103
|
+
if (!article) {
|
|
104
|
+
throw new CliError(
|
|
105
|
+
`this install has no "${APP_GUIDE_ARTICLE_ID}" Handboek article; read ${PUBLISHED_HANDBOEK}${APP_GUIDE_ARTICLE_ID}.md`
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
const { areas } = await engine.toc();
|
|
109
|
+
const { ids, byStem } = siteLinkIndex(areas.flatMap((a) => a.entries.map((e) => e.id)));
|
|
110
|
+
const markdown = rewriteSiteLinks(
|
|
111
|
+
article.markdown,
|
|
112
|
+
article.id,
|
|
113
|
+
ids,
|
|
114
|
+
byStem,
|
|
115
|
+
() => true,
|
|
116
|
+
PUBLISHED_HANDBOEK
|
|
117
|
+
);
|
|
118
|
+
return `${markdown.trimEnd()}
|
|
119
|
+
`;
|
|
120
|
+
}
|
|
121
|
+
async function runAppGuide() {
|
|
122
|
+
process.stdout.write(await renderAppGuide());
|
|
123
|
+
}
|
|
124
|
+
export {
|
|
125
|
+
APP_GUIDE_ARTICLE_ID,
|
|
126
|
+
renderAppGuide,
|
|
127
|
+
runAppGuide
|
|
128
|
+
};
|