@ambasada/cli 0.8.0 → 0.8.1

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/ambasada.mjs +54 -55
  2. package/package.json +3 -3
package/dist/ambasada.mjs CHANGED
@@ -2119,6 +2119,50 @@ import { createRequire } from "node:module";
2119
2119
  import { dirname as dirname2, isAbsolute, join as join3, resolve as resolvePath2 } from "node:path";
2120
2120
  import { pathToFileURL as pathToFileURL2 } from "node:url";
2121
2121
 
2122
+ // src/manifest.ts
2123
+ var MANIFEST_FILES = {
2124
+ next: "public/.well-known/ambasada.json",
2125
+ spa: "public/.well-known/ambasada.json",
2126
+ worker: "web/.well-known/ambasada.json"
2127
+ };
2128
+ var APP_WEBHOOK_PATH = "/api/ambasada/webhook";
2129
+ var oneLine = (s, max) => {
2130
+ const line = s.replace(/\s+/g, " ").trim();
2131
+ return line.length > max ? `${line.slice(0, max - 1).trimEnd()}\u2026` : line;
2132
+ };
2133
+ function appManifest(company) {
2134
+ return {
2135
+ schema: 2,
2136
+ id: company.id,
2137
+ name: oneLine(company.name, MANIFEST_LIMITS.name),
2138
+ subtitle: oneLine(company.description, MANIFEST_LIMITS.subtitle),
2139
+ description: company.description,
2140
+ icon: "/icon.png",
2141
+ splash: { image: "/icon.png", color: "#FFFFFF" },
2142
+ accent: "#FF002E",
2143
+ entry: "/",
2144
+ kind: "product",
2145
+ category: "other",
2146
+ // Sign in with Ambasada and notifications (docs/MINI-APPS.md §5, §7): the templates ship both routes.
2147
+ scopes: ["identity", "notifications"],
2148
+ notifications: { webhook: APP_WEBHOOK_PATH },
2149
+ privacy_url: "/privacy",
2150
+ visibility: "public"
2151
+ };
2152
+ }
2153
+ var manifestJson = (company) => `${JSON.stringify(appManifest(company), null, 2)}
2154
+ `;
2155
+ function readCompany(configSource) {
2156
+ const str4 = (re) => {
2157
+ const m = re.exec(configSource);
2158
+ return m ? JSON.parse(`"${m[1]}"`) : void 0;
2159
+ };
2160
+ const id = str4(/\bid\s*:\s*"((?:[^"\\]|\\.)*)"/);
2161
+ const name = str4(/\bname\s*:\s*"((?:[^"\\]|\\.)*)"/);
2162
+ const description = str4(/\bdescription\s*:\s*"((?:[^"\\]|\\.)*)"/) ?? str4(/\bidea\s*:\s*\{\s*title\s*:\s*"((?:[^"\\]|\\.)*)"/);
2163
+ return id && name && description !== void 0 ? { id, name, description } : null;
2164
+ }
2165
+
2122
2166
  // src/project.ts
2123
2167
  import { existsSync as existsSync2 } from "node:fs";
2124
2168
  import { readFile as readFile2, rm, writeFile as writeFile2 } from "node:fs/promises";
@@ -2174,10 +2218,14 @@ async function setProductUrl(root, url) {
2174
2218
  await writeFile2(file, next);
2175
2219
  return true;
2176
2220
  }
2221
+ async function loadIdName(root) {
2222
+ const app = readCompany(await readFile2(join2(root, CONFIG_FILE), "utf8"));
2223
+ return app ? { id: app.id, name: app.name } : null;
2224
+ }
2177
2225
 
2178
2226
  // src/plugin.ts
2179
2227
  var PLATFORM_CONFIG_KEYS = ["id", "name", "product", "addons"];
2180
- var VERSION = true ? "0.8.0" : "0.1.0-dev";
2228
+ var VERSION = true ? "0.8.1" : "0.1.0-dev";
2181
2229
  var shortName = (pkg) => pkg.replace(/^@ambasada\//, "").replace(/^ambasada-(addon-)?/, "");
2182
2230
  var KNOWN_ADDONS = { village: "@ambasada/village" };
2183
2231
  function readJson(file) {
@@ -2399,52 +2447,6 @@ function startApp(root, stack, bin2, url, vars, print, prefix) {
2399
2447
  // src/check.ts
2400
2448
  import { existsSync as existsSync5, readdirSync, readFileSync as readFileSync3, statSync } from "node:fs";
2401
2449
  import { dirname as dirname4, join as join5, resolve as resolvePath3 } from "node:path";
2402
-
2403
- // src/manifest.ts
2404
- var MANIFEST_FILES = {
2405
- next: "public/.well-known/ambasada.json",
2406
- spa: "public/.well-known/ambasada.json",
2407
- worker: "web/.well-known/ambasada.json"
2408
- };
2409
- var APP_WEBHOOK_PATH = "/api/ambasada/webhook";
2410
- var oneLine = (s, max) => {
2411
- const line = s.replace(/\s+/g, " ").trim();
2412
- return line.length > max ? `${line.slice(0, max - 1).trimEnd()}\u2026` : line;
2413
- };
2414
- function appManifest(company) {
2415
- return {
2416
- schema: 2,
2417
- id: company.id,
2418
- name: oneLine(company.name, MANIFEST_LIMITS.name),
2419
- subtitle: oneLine(company.description, MANIFEST_LIMITS.subtitle),
2420
- description: company.description,
2421
- icon: "/icon.png",
2422
- splash: { image: "/icon.png", color: "#FFFFFF" },
2423
- accent: "#FF002E",
2424
- entry: "/",
2425
- kind: "product",
2426
- category: "other",
2427
- // Sign in with Ambasada and notifications (docs/MINI-APPS.md §5, §7): the templates ship both routes.
2428
- scopes: ["identity", "notifications"],
2429
- notifications: { webhook: APP_WEBHOOK_PATH },
2430
- privacy_url: "/privacy",
2431
- visibility: "public"
2432
- };
2433
- }
2434
- var manifestJson = (company) => `${JSON.stringify(appManifest(company), null, 2)}
2435
- `;
2436
- function readCompany(configSource) {
2437
- const str4 = (re) => {
2438
- const m = re.exec(configSource);
2439
- return m ? JSON.parse(`"${m[1]}"`) : void 0;
2440
- };
2441
- const id = str4(/\bid\s*:\s*"((?:[^"\\]|\\.)*)"/);
2442
- const name = str4(/\bname\s*:\s*"((?:[^"\\]|\\.)*)"/);
2443
- const description = str4(/\bdescription\s*:\s*"((?:[^"\\]|\\.)*)"/) ?? str4(/\bidea\s*:\s*\{\s*title\s*:\s*"((?:[^"\\]|\\.)*)"/);
2444
- return id && name && description !== void 0 ? { id, name, description } : null;
2445
- }
2446
-
2447
- // src/check.ts
2448
2450
  var merge2 = (into, from) => {
2449
2451
  into.problems.push(...from.problems);
2450
2452
  into.warnings.push(...from.warnings);
@@ -2536,7 +2538,7 @@ import { execFileSync } from "node:child_process";
2536
2538
  import { existsSync as existsSync6, readdirSync as readdirSync3, statSync as statSync3 } from "node:fs";
2537
2539
  import { mkdir as mkdir2, readFile as readFile3, rm as rm2, writeFile as writeFile3 } from "node:fs/promises";
2538
2540
  import { join as join7, relative as relative2 } from "node:path";
2539
- var VERSION2 = true ? "0.8.0" : "0.1.0-dev";
2541
+ var VERSION2 = true ? "0.8.1" : "0.1.0-dev";
2540
2542
  var RELEASE_SPEC = /^\d+\.\d+\.\d+$/.test(VERSION2) ? `^${VERSION2}` : "latest";
2541
2543
  var PROJECT_FILE = join7(".ambasada", "project.json");
2542
2544
  var out = (s = "") => process.stdout.write(`${s}
@@ -2714,8 +2716,9 @@ async function upgrade(_args, flags) {
2714
2716
  deps["@ambasada/village"] = specFor("@ambasada/village");
2715
2717
  changes.push(`package.json: + @ambasada/village ${deps["@ambasada/village"]}`);
2716
2718
  }
2719
+ const idName = await loadIdName(root).catch(() => null) ?? { id: "my-app", name: "My App" };
2717
2720
  const skills = {};
2718
- for (const [path, text] of Object.entries(templateFiles(template))) if (path.startsWith(".claude/skills/ambasada-")) skills[path] = text;
2721
+ for (const [path, text] of Object.entries(templateFiles(template))) if (path.startsWith(".claude/skills/ambasada-")) skills[path] = text.replaceAll("my-app", idName.id).replaceAll("My App", idName.name);
2719
2722
  const stale = [];
2720
2723
  const skillsDir = join7(root, ".claude/skills");
2721
2724
  if (existsSync6(join7(skillsDir, "ambasada-payments"))) stale.push("ambasada-payments");
@@ -3840,7 +3843,7 @@ async function tunnel(_args, flags) {
3840
3843
  }
3841
3844
 
3842
3845
  // src/commands.ts
3843
- var SDK_VERSION = /^\d+\.\d+\.\d+$/.test("0.8.0") ? `^${"0.8.0"}` : "latest";
3846
+ var SDK_VERSION = /^\d+\.\d+\.\d+$/.test("0.8.1") ? `^${"0.8.1"}` : "latest";
3844
3847
  var DEV_PORT = 8788;
3845
3848
  var out5 = (s = "") => process.stdout.write(`${s}
3846
3849
  `);
@@ -4082,10 +4085,6 @@ function readJsonName(dir) {
4082
4085
  return void 0;
4083
4086
  }
4084
4087
  }
4085
- async function loadIdName(root) {
4086
- const app = readCompany(await readFile7(join11(root, CONFIG_FILE), "utf8"));
4087
- return app ? { id: app.id, name: app.name } : null;
4088
- }
4089
4088
  async function add(args, flags) {
4090
4089
  const short = args[0];
4091
4090
  if (!short) throw new CliError(`usage: ambasada add <addon> (one of: ${Object.keys(KNOWN_ADDONS).join(", ")})`);
@@ -4320,7 +4319,7 @@ async function logs(_args, flags) {
4320
4319
  }
4321
4320
 
4322
4321
  // src/main.ts
4323
- var VERSION3 = true ? "0.8.0" : "0.1.0-dev";
4322
+ var VERSION3 = true ? "0.8.1" : "0.1.0-dev";
4324
4323
  var MAJOR_MINOR = VERSION3.split(".").slice(0, 2).join(".");
4325
4324
  var HELP = `${c.bold("ambasada")} ${MAJOR_MINOR}: build and host apps on Ambasada
4326
4325
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ambasada/cli",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "`ambasada`: build and host apps on Ambasada (init, dev, deploy, tunnel, check, storage); add-ons add their own commands.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -22,8 +22,8 @@
22
22
  "vitest": "^4.1.12",
23
23
  "wrangler": "^4.156.0",
24
24
  "@ambasada/protocol": "0.1.0",
25
- "@ambasada/sdk": "0.8.0",
26
- "@ambasada/village": "0.8.0"
25
+ "@ambasada/sdk": "0.8.1",
26
+ "@ambasada/village": "0.8.1"
27
27
  },
28
28
  "author": "CENTYSO (https://centyso.com)",
29
29
  "homepage": "https://ambasada.id",