flowdular 0.2.1 → 0.2.2

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.
@@ -3405,7 +3405,7 @@ import { dirname as dirname6, join as join6, relative as relative5 } from "node:
3405
3405
  import { createRequire } from "node:module";
3406
3406
  import { readFile as readFile5 } from "node:fs/promises";
3407
3407
  import { dirname as dirname4, join as join3 } from "node:path";
3408
- var SDK_VERSION = "0.2.1";
3408
+ var SDK_VERSION = "0.2.2";
3409
3409
  function npmPackage(specifier) {
3410
3410
  return specifier.startsWith("@") ? specifier.split("/").slice(0, 2).join("/") : specifier.split("/")[0];
3411
3411
  }
package/dist/index.js CHANGED
@@ -1992,13 +1992,15 @@ function stringFlag(arguments_, name) {
1992
1992
  }
1993
1993
 
1994
1994
  // src/output.ts
1995
+ import { styleText } from "node:util";
1995
1996
  function isCapabilityList(values2) {
1996
1997
  return values2.every(
1997
1998
  (value) => typeof value === "object" && value !== null && typeof value.id === "string" && typeof value.risk === "string" && typeof value.summary === "string"
1998
1999
  );
1999
2000
  }
2000
- function renderOutput(envelope, json2) {
2001
+ function renderOutput(envelope, json2, color = false) {
2001
2002
  if (json2) return JSON.stringify(envelope, null, 2);
2003
+ const paint = (text, format) => color ? styleText(format, text, { validateStream: false }) : text;
2002
2004
  if (!envelope.ok) {
2003
2005
  const heading = `ERROR ${envelope.error?.code ?? "UNKNOWN"}
2004
2006
  ${envelope.error?.message ?? "Command failed."}`;
@@ -2021,19 +2023,34 @@ ${envelope.error?.message ?? "Command failed."}`;
2021
2023
  const data2 = envelope.data;
2022
2024
  if (data2?.cancelled === true) return decorate("Setup cancelled.");
2023
2025
  if (data2?.setup === "postgresql")
2024
- return decorate(
2025
- "PostgreSQL settings saved to .env.\nRun pnpm dev, then open http://localhost:4310 to create an account."
2026
- );
2026
+ return [
2027
+ "",
2028
+ ` ${paint("FLOWDULAR", "bold")} ${paint("PostgreSQL configured", "green")}`,
2029
+ "",
2030
+ " PostgreSQL settings saved to .env.",
2031
+ "",
2032
+ ` Start app ${paint("pnpm dev", "bold")}`,
2033
+ ` Local URL ${paint("http://localhost:4310", "cyan")}`,
2034
+ " Open the app to create an account.",
2035
+ "",
2036
+ ...envelope.warnings.map((warning) => ` ${warning}`),
2037
+ ""
2038
+ ].join("\n");
2027
2039
  if (data2?.setup === "local") {
2028
2040
  const admin = data2.accounts?.admin;
2029
- return decorate(
2030
- [
2031
- "Local demo is ready.",
2032
- "Run pnpm dev, then open http://localhost:4310.",
2033
- ...admin?.email ? [`Demo administrator: ${admin.email}`] : [],
2034
- ...admin?.password ? [`Public demo password: ${admin.password}`] : []
2035
- ].join("\n")
2036
- );
2041
+ return [
2042
+ "",
2043
+ ` ${paint("FLOWDULAR", "bold")} ${paint("Local demo is ready.", "green")}`,
2044
+ "",
2045
+ ` Start app ${paint("pnpm dev", "bold")}`,
2046
+ ` Local URL ${paint("http://localhost:4310", "cyan")}`,
2047
+ "",
2048
+ ...admin?.email ? [` Demo login ${admin.email}`] : [],
2049
+ ...admin?.password ? [` Password ${admin.password}`] : [],
2050
+ "",
2051
+ ...envelope.warnings.map((warning) => ` ${warning}`),
2052
+ ""
2053
+ ].join("\n");
2037
2054
  }
2038
2055
  if (data2 && Array.isArray(data2.checks)) {
2039
2056
  return decorate(
@@ -3546,7 +3563,7 @@ import { dirname as dirname6, join as join5, relative as relative5 } from "node:
3546
3563
  import { createRequire } from "node:module";
3547
3564
  import { readFile as readFile4 } from "node:fs/promises";
3548
3565
  import { dirname as dirname4, join as join2 } from "node:path";
3549
- var SDK_VERSION = "0.2.1";
3566
+ var SDK_VERSION = "0.2.2";
3550
3567
  var LIBRARIES = /* @__PURE__ */ new Set([
3551
3568
  "ai-provider",
3552
3569
  "cli-protocol",
@@ -9296,10 +9313,37 @@ async function runCommand(arguments_) {
9296
9313
  const greenfield = extensionCommands.find(
9297
9314
  (entry) => entry.command.capability.id === "auth.greenfield.reset"
9298
9315
  );
9299
- return greenfield ? await runExtensionCommand(workspace, greenfield, arguments_) : failure(
9300
- "AUTH_MODULE_REQUIRED",
9301
- "Quick setup requires the enabled auth.core module."
9316
+ if (!greenfield)
9317
+ return failure(
9318
+ "AUTH_MODULE_REQUIRED",
9319
+ "Quick setup requires the enabled auth.core module."
9320
+ );
9321
+ const result2 = await runExtensionCommand(
9322
+ workspace,
9323
+ greenfield,
9324
+ arguments_
9302
9325
  );
9326
+ if (!result2.ok || !arguments_.flags.has("apply")) return result2;
9327
+ const sync = extensionCommands.find(
9328
+ (entry) => entry.command.capability.id === "auth.scopes.sync"
9329
+ );
9330
+ if (!sync)
9331
+ return failure(
9332
+ "AUTH_SCOPE_SYNC_REQUIRED",
9333
+ "The demo was created but module permissions could not be synchronized."
9334
+ );
9335
+ const enabled = workspace.config.modules.enabled ?? [];
9336
+ for (const moduleId of enabled) {
9337
+ const granted = await runExtensionCommand(workspace, sync, {
9338
+ positionals: ["auth", "sync-scopes"],
9339
+ flags: /* @__PURE__ */ new Map([
9340
+ ["module", moduleId],
9341
+ ["apply", true]
9342
+ ])
9343
+ });
9344
+ if (!granted.ok) return granted;
9345
+ }
9346
+ return result2;
9303
9347
  }
9304
9348
  if (group === "setup" && action === "migrate-state") {
9305
9349
  const descriptor = capability("workspace.state.migrate");
@@ -9910,7 +9954,7 @@ if (invokedAsProgram) {
9910
9954
  const interactive = arguments_.positionals.length === 1 && arguments_.positionals[0] === "setup" && !arguments_.flags.has("json") && !arguments_.flags.has("help") && process.stdin.isTTY && process.stdout.isTTY;
9911
9955
  const envelope = await (interactive ? runSetupWizard(arguments_) : runProgram(arguments_));
9912
9956
  process.stdout.write(
9913
- `${renderOutput(envelope, arguments_.flags.has("json"))}
9957
+ `${renderOutput(envelope, arguments_.flags.has("json"), Boolean(process.stdout.isTTY && process.stdout.hasColors?.() && !("NO_COLOR" in process.env) && !process.env.CI))}
9914
9958
  `
9915
9959
  );
9916
9960
  if (!envelope.ok) process.exitCode = 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowdular",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "flowdular": "./dist/index.js",
@@ -16,7 +16,7 @@
16
16
  "ajv": "8.20.0",
17
17
  "pg": "8.23.0",
18
18
  "yaml": "2.9.0",
19
- "@flowdular/sdk": "0.2.1"
19
+ "@flowdular/sdk": "0.2.2"
20
20
  },
21
21
  "license": "MIT",
22
22
  "repository": {