apiblaze 0.21.41 → 0.21.42
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/dist/index.js +62 -54
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -34,7 +34,7 @@ var __toESM = (mod, isNodeMode, target2) => (target2 = mod != null ? __create(__
|
|
|
34
34
|
var version;
|
|
35
35
|
var init_package = __esm({
|
|
36
36
|
"package.json"() {
|
|
37
|
-
version = "0.21.
|
|
37
|
+
version = "0.21.42";
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
|
|
@@ -7918,7 +7918,7 @@ async function waitTunnel(dir) {
|
|
|
7918
7918
|
}
|
|
7919
7919
|
async function waitThrough(apiUrl, serverKey) {
|
|
7920
7920
|
let last = 0;
|
|
7921
|
-
for (let i = 0; i <
|
|
7921
|
+
for (let i = 0; i < 120; i++) {
|
|
7922
7922
|
try {
|
|
7923
7923
|
const r = await fetch(`${apiUrl}/reservations`, { headers: { "x-api-key": serverKey, "x-end-user-id": "ana" } });
|
|
7924
7924
|
last = r.status;
|
|
@@ -9655,14 +9655,15 @@ function folderReport(f, opts = {}) {
|
|
|
9655
9655
|
function blockedMarkdown() {
|
|
9656
9656
|
return `## If a command is blocked or fails
|
|
9657
9657
|
|
|
9658
|
-
|
|
9659
|
-
- **A step the rest depends on** (the tunnel, creating the proxy, its key):
|
|
9660
|
-
|
|
9661
|
-
(\`! <command>\` in Claude Code).
|
|
9662
|
-
- **An optional step** (groups, admins, widgets, a rule, limits):
|
|
9663
|
-
|
|
9664
|
-
-
|
|
9665
|
-
|
|
9658
|
+
When a permission prompt is declined, a command is denied, or a step needs access you do not have:
|
|
9659
|
+
- **A step the rest depends on** (the tunnel, creating the proxy, its key): nothing after it can
|
|
9660
|
+
work, so the useful move is to stop there, say what it was for, and give the user the exact
|
|
9661
|
+
command to run themselves (\`! <command>\` in Claude Code).
|
|
9662
|
+
- **An optional step** (groups, admins, widgets, a rule, limits): the rest works without it. Skip
|
|
9663
|
+
it and say what is missing because of it.
|
|
9664
|
+
- Working around a blocked step (retrying it in pieces, another route, code written to replace
|
|
9665
|
+
it) leaves a half-built setup that fails in ways nobody can read. And something only works
|
|
9666
|
+
once it has been checked: a call that answered, or a page that loaded.
|
|
9666
9667
|
`;
|
|
9667
9668
|
}
|
|
9668
9669
|
function staleSkillCopies(cwd = process.cwd(), home = import_os2.default.homedir()) {
|
|
@@ -9682,90 +9683,97 @@ function heroMarkdown(found, stale = []) {
|
|
|
9682
9683
|
const run2 = `npx ${B.cli}@latest`;
|
|
9683
9684
|
const report = found ? folderReport(found) : null;
|
|
9684
9685
|
const port = found ? backendPort(found) : void 0;
|
|
9685
|
-
const folder = report ? `## This folder
|
|
9686
|
+
const folder = report ? `## This folder (the CLI checked it just now)
|
|
9686
9687
|
|
|
9687
9688
|
${report.lines.map((l) => `- ${l}`).join("\n")}
|
|
9688
9689
|
` : `## First, the folder
|
|
9689
9690
|
|
|
9690
|
-
Run \`${run2} skills\` in the project folder
|
|
9691
|
-
|
|
9691
|
+
Run \`${run2} skills\` in the project folder: it checks the folder and prints the current version
|
|
9692
|
+
of this guide, with the next step that fits it.
|
|
9692
9693
|
`;
|
|
9693
|
-
const question = report?.question ?? "
|
|
9694
|
+
const question = report?.question ?? "the question it prints for the folder";
|
|
9694
9695
|
const ownApi = report?.ownApi && found ? (() => {
|
|
9695
9696
|
const specArg = found.specFile ? ` --openapi ${found.specFile}` : "";
|
|
9696
|
-
const steps = [
|
|
9697
|
+
const steps = [];
|
|
9697
9698
|
if (!found.listening) {
|
|
9698
9699
|
steps.push(`Start it first as its own detached process${found.start ? `: \`nohup ${found.start} > app.log 2>&1 < /dev/null &\`` : ", with its usual start command"}. Wait until localhost:${port ?? "<port>"} answers.`);
|
|
9699
9700
|
}
|
|
9700
9701
|
if (!found.specFile && !found.specUrl) {
|
|
9701
|
-
steps.push(
|
|
9702
|
+
steps.push("Write `./openapi.yaml` from its route files first: every path and method, and the id each POST returns.");
|
|
9702
9703
|
}
|
|
9703
9704
|
const spec2 = found.specFile ? specArg : !found.specUrl ? " --openapi ./openapi.yaml" : "";
|
|
9704
|
-
steps.push(`Open the tunnel as its own detached process
|
|
9705
|
+
steps.push(`Open the tunnel as its own detached process (a \`cmd &\` inside a shell call that ends is killed with it):
|
|
9705
9706
|
\`nohup ${run2} dev --port ${port ?? "<port>"}${spec2} --auto > ${B.cli}-dev.log 2>&1 < /dev/null &\`
|
|
9706
|
-
|
|
9707
|
-
steps.push(`
|
|
9708
|
-
steps.push(`
|
|
9707
|
+
${B.cli}-dev.log says "is live on the internet" after about 20 seconds. It saves the key to .env.local itself.`);
|
|
9708
|
+
steps.push(`What they have then, with the two addresses it printed: their API on the internet at the API address, and an address AI assistants can use (MCP). API keys, sign-in, rules for who can change what, and rate limits are already on. The key is saved to .env.local and never printed. The tunnel keeps running.`);
|
|
9709
|
+
steps.push(`The natural next step: ready for real customers, with their own API keys, sign-in, and only-the-owner-can-change rules. \`${run2} skills ship\` has that procedure, from "Adopt".`);
|
|
9709
9710
|
return `
|
|
9710
|
-
## Their API
|
|
9711
|
+
## Their API, if they want it behind ${P}
|
|
9711
9712
|
|
|
9712
9713
|
${steps.map((t, i) => `${i + 1}. ${t}`).join("\n")}
|
|
9713
9714
|
`;
|
|
9714
9715
|
})() : "";
|
|
9715
|
-
|
|
9716
|
+
const frontMatter = found ? "" : `---
|
|
9716
9717
|
name: ${SKILL_NAME}
|
|
9717
9718
|
description: Use when the user asks what ${P} (or ${B.cli}) does or can do for them; says yes to a demo or asks to see / try / demo it; wants to ship, share or expose an API; wants API keys, sign-in, per-user data, rate limits or quotas; wants AI agents to use their app safely; or says users can reach each other's records.
|
|
9718
9719
|
---
|
|
9719
9720
|
|
|
9720
|
-
|
|
9721
|
+
`;
|
|
9722
|
+
return `${frontMatter}# ${P}
|
|
9721
9723
|
|
|
9722
|
-
|
|
9724
|
+
What \`${run2} skills\` reports: what ${P} is, what is in this folder, and the next steps you can
|
|
9725
|
+
offer. Nothing here needs to run before the user says so.
|
|
9723
9726
|
${stale.length ? `
|
|
9724
|
-
##
|
|
9727
|
+
## Older copies of this guide are installed
|
|
9725
9728
|
|
|
9726
9729
|
${stale.map((f) => `- \`${f}\``).join("\n")}
|
|
9727
9730
|
|
|
9728
|
-
They
|
|
9729
|
-
|
|
9731
|
+
They were written for an older CLI; this output is the current one. The user can refresh a copy
|
|
9732
|
+
with \`${run2} skills --install --force\` in its folder.
|
|
9730
9733
|
` : ""}
|
|
9731
9734
|
${folder}
|
|
9732
|
-
##
|
|
9735
|
+
## What ${P} is
|
|
9733
9736
|
|
|
9734
|
-
|
|
9737
|
+
${pitchText()}
|
|
9735
9738
|
|
|
9736
|
-
"
|
|
9739
|
+
For a first "what does it do", that is usually enough: the demo shows the rest. The next step to
|
|
9740
|
+
offer: ${question}
|
|
9737
9741
|
|
|
9738
|
-
|
|
9742
|
+
Most people new to it do not know the words proxy, tenant, OpenAPI or header, so plain words work best.
|
|
9739
9743
|
${ownApi}
|
|
9740
|
-
##
|
|
9744
|
+
## The demo, if they want to see it
|
|
9745
|
+
|
|
9746
|
+
\`${run2} demo\` takes about 30 seconds, needs no login and asks nothing. It:
|
|
9747
|
+
- writes a small table-booking app into ./${B.cli}-demo and runs it on this machine (localhost, from
|
|
9748
|
+
port 3000 up, skipping any port another program uses);
|
|
9749
|
+
- puts a temporary ${P} gateway in front of it (anonymous, no account) with a tunnel to the app;
|
|
9750
|
+
- prints the links once the page is live, then exits. It opens nothing and never prints a key
|
|
9751
|
+
(keys are saved in ./${B.cli}-demo/.env.local).
|
|
9741
9752
|
|
|
9742
|
-
|
|
9743
|
-
|
|
9744
|
-
|
|
9745
|
-
|
|
9746
|
-
|
|
9747
|
-
|
|
9748
|
-
|
|
9749
|
-
|
|
9750
|
-
|
|
9751
|
-
4. If it prints \u2717, say its one sentence and run the one command it gives, once.
|
|
9753
|
+
Run it in the foreground. It is self-contained: nothing in its folder needs reading or changing,
|
|
9754
|
+
and its own output says what happened. When it prints \u2713, the links it printed are the thing to
|
|
9755
|
+
show, in plain words:
|
|
9756
|
+
- the booking app runs on their laptop, and ${P} just gave it a public address, plus one for AI
|
|
9757
|
+
assistants;
|
|
9758
|
+
- on the Reservations tab, asking the assistant to book a table makes it appear in the list; the
|
|
9759
|
+
switch at the top shows the same app straight to localhost, unprotected;
|
|
9760
|
+
- the Admin tab is what each pizzeria's admin gets: their own API keys and people, kept apart.
|
|
9761
|
+
The question it leads to: **"Want to put your own app on the internet like this?"**
|
|
9752
9762
|
|
|
9753
|
-
|
|
9754
|
-
files, open logs, run other commands, or write code. Never show a key: the demo saves it
|
|
9755
|
-
in \`.env.local\` and never prints it.
|
|
9763
|
+
If it prints \u2717, its one sentence says what failed and the one command after it is the fix.
|
|
9756
9764
|
|
|
9757
9765
|
${blockedMarkdown()}
|
|
9758
|
-
## Their own app
|
|
9766
|
+
## Their own app, after the demo
|
|
9759
9767
|
|
|
9760
|
-
|
|
9761
|
-
|
|
9768
|
+
On this machine \u2192 \`${run2} dev\`; deployed \u2192 \`${run2} create\`. \`${run2} skills ship\` has the
|
|
9769
|
+
whole procedure.
|
|
9762
9770
|
|
|
9763
|
-
## One thing at a time
|
|
9771
|
+
## One thing at a time
|
|
9764
9772
|
|
|
9765
|
-
|
|
9766
|
-
|
|
9767
|
-
|
|
9768
|
-
their
|
|
9773
|
+
Each topic has its own page: \`${run2} skills keys\` (API keys) \xB7 \`signin\` (OAuth sign-in and the
|
|
9774
|
+
developer portal) \xB7 \`rules\` (who can change what) \xB7 \`limits\` (rate limits and quotas) \xB7 \`mcp\`
|
|
9775
|
+
(AI agents) \xB7 \`widgets\` (keys, users and chat on their site) \xB7 \`ship\` (the whole procedure for
|
|
9776
|
+
their own app).
|
|
9769
9777
|
`;
|
|
9770
9778
|
}
|
|
9771
9779
|
function shipMarkdown() {
|
|
@@ -9930,7 +9938,7 @@ ONLY for what the scan could not find \u2014 one short list of questions, not an
|
|
|
9930
9938
|
of the job: move the call to a server route, delete the public variable, say so in the report.
|
|
9931
9939
|
- **Both** (monorepo): do the backend first, then the frontend.
|
|
9932
9940
|
|
|
9933
|
-
**Ask for what is missing
|
|
9941
|
+
**Ask only for what is missing.**
|
|
9934
9942
|
- Backend found only on localhost \u2192 "Where is it hosted for production?" (a URL, or "not yet").
|
|
9935
9943
|
- Backend protected by a secret whose value is in an env var \u2192 "What is the value of
|
|
9936
9944
|
\`<VAR>\`, or should I keep it where it is?" Never read secrets out of \`.env\` aloud.
|