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.
Files changed (2) hide show
  1. package/dist/index.js +62 -54
  2. 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.41";
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 < 60; 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
- A permission prompt declined, a command denied, or a step needing access you do not have:
9659
- - **A step the rest depends on** (the tunnel, creating the proxy, its key): stop there. In one
9660
- line, say what it was for and give the user the exact command to run themselves
9661
- (\`! <command>\` in Claude Code). Then wait. If they would rather not, say it stops here.
9662
- - **An optional step** (groups, admins, widgets, a rule, limits): skip it. Say in one line what
9663
- is missing because of it, and carry on with what does not need it.
9664
- - **Always:** never retry it in pieces, take another route, or write code to replace it. Never
9665
- say something works until you have checked it: a call that answered, or a page you loaded.
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, checked by the CLI just now: read no files to decide what to offer
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 and follow what it prints: it checks the folder
9691
- and gives the exact question to ask.
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 ?? "<the question it prints>";
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 = [`Say one line: "Putting your API behind ${P}, about 30 seconds."`];
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('Write `./openapi.yaml` from its route files first: every path and method, and the id each POST returns. Say "Writing an OpenAPI spec from your code."');
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, never \`cmd &\` inside a shell call that ends:
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
- Then read ${B.cli}-dev.log until it says "is live on the internet" (about 20 seconds). It saves the key to .env.local itself.`);
9707
- steps.push(`Tell them in plain words, with the two addresses it printed: their API is on the internet at the API address, and AI assistants can use it at the MCP address. API keys, sign-in, rules for who can change what, and rate limits are already on. Say "saved your key to .env.local". Leave the tunnel running.`);
9708
- steps.push(`Ask one question: **"Want it ready for real customers: their own API keys, sign-in, and only-the-owner-can-change rules?"** If yes, run \`${run2} skills ship\` and follow it from "Adopt".`);
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: they say yes to putting it behind ${P}
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
- return `---
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
- # ${P}
9721
+ `;
9722
+ return `${frontMatter}# ${P}
9721
9723
 
9722
- This output is current: it replaces any copy of this skill loaded earlier.
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
- ## Outdated copies are installed: ignore them
9727
+ ## Older copies of this guide are installed
9725
9728
 
9726
9729
  ${stale.map((f) => `- \`${f}\``).join("\n")}
9727
9730
 
9728
- They hold an older walkthrough. Follow only what this output says. Tell the user once that the
9729
- file is outdated (re-run \`${run2} skills --install --force\` in that folder to refresh it).
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
- ## Explain: they ask what ${P} does or can do for them
9735
+ ## What ${P} is
9733
9736
 
9734
- Run nothing else. Say exactly this and nothing else: no list of use cases, no commands, no options. Then stop:
9737
+ ${pitchText()}
9735
9738
 
9736
- "${pitchText()} ${question}"
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
- Do not use the words proxy, tenant, OpenAPI or header unless the user does first.
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
- ## Demo: they say yes to the sample app, or ask to see or try it
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
- 1. Say one line: "Starting the demo, about 30 seconds."
9743
- 2. Run exactly this, in the foreground. It needs no login and asks nothing. It sets
9744
- everything up and exits by itself once the page is live. It opens nothing: give the user the App link it prints:
9745
- \`${run2} demo\`
9746
- 3. When it prints \u2713, tell this story in plain words, with the App link it printed:
9747
- - "This booking app runs on your laptop. ${P} just gave it a public address, and one for AI assistants."
9748
- - "On the Reservations tab, ask the assistant to book a table, and it appears in your list. The switch at the top shows the same app straight to localhost, unprotected."
9749
- - "The Admin tab is what each pizzeria's admin gets: their own API keys and people, kept apart."
9750
- Then ask one question: **"Want to put your own app on the internet like this?"**
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
- Rules for the demo: keep each update to one line. Do not narrate steps, read the demo's
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: they say yes after the demo
9766
+ ## Their own app, after the demo
9759
9767
 
9760
- Their app runs on this machine \u2192 it will use \`${run2} dev\`; it is deployed \u2192 \`${run2} create\`.
9761
- Run \`${run2} skills ship\` and follow what it prints.
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, later
9771
+ ## One thing at a time
9764
9772
 
9765
- When they ask about one thing, read only its page: \`${run2} skills keys\` (API keys) \xB7
9766
- \`signin\` (OAuth sign-in and the developer portal) \xB7 \`rules\` (who can change what) \xB7
9767
- \`limits\` (rate limits and quotas) \xB7 \`mcp\` (AI agents) \xB7 \`widgets\` (keys, users and chat on
9768
- their site) \xB7 \`ship\` (the whole procedure for their own app).
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 \u2014 and nothing else.**
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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apiblaze",
3
- "version": "0.21.41",
3
+ "version": "0.21.42",
4
4
  "description": "APIblaze CLI — Chat with your APIs, Manage your API keys, users and groups with the APIblaze serverless proxy",
5
5
  "keywords": [
6
6
  "apiblaze",