@perceo/perceo 0.3.5 → 0.4.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/index.js +69 -0
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -921,6 +921,7 @@ Persona ${personaIndex}:`));
921
921
  console.log(chalk3.bold("Config: ") + path3.relative(projectDir, perceoConfigPath));
922
922
  console.log(chalk3.bold("Project ID: ") + projectId);
923
923
  console.log(chalk3.bold("Flows discovered: ") + `${flowsDiscovered} (${flowsNew} new)`);
924
+ await renderBootstrapGraph(client, projectId);
924
925
  if (githubAutoConfigured && workflowCreated) {
925
926
  console.log("\n" + chalk3.bold.green("\u2713 GitHub Actions configured automatically!"));
926
927
  console.log(chalk3.gray("\u2500".repeat(50)));
@@ -983,6 +984,74 @@ Persona ${personaIndex}:`));
983
984
  process.exit(1);
984
985
  }
985
986
  });
987
+ async function renderBootstrapGraph(client, projectId) {
988
+ try {
989
+ const [flows, personas] = await Promise.all([
990
+ client.getFlows(projectId),
991
+ client.getPersonas(projectId)
992
+ ]);
993
+ if (flows.length === 0) {
994
+ console.log(chalk3.gray("\n No flows to display in graph.\n"));
995
+ return;
996
+ }
997
+ const personaById = /* @__PURE__ */ new Map();
998
+ for (const p of personas) {
999
+ personaById.set(p.id, p);
1000
+ }
1001
+ const byPersona = /* @__PURE__ */ new Map();
1002
+ const noPersona = [];
1003
+ for (const f of flows) {
1004
+ if (f.persona_id) {
1005
+ const list = byPersona.get(f.persona_id) ?? [];
1006
+ list.push(f);
1007
+ byPersona.set(f.persona_id, list);
1008
+ } else {
1009
+ noPersona.push(f);
1010
+ }
1011
+ }
1012
+ const personaIds = [...byPersona.keys()].sort((a, b) => {
1013
+ const na = personaById.get(a)?.name ?? "";
1014
+ const nb = personaById.get(b)?.name ?? "";
1015
+ return na.localeCompare(nb);
1016
+ });
1017
+ const width = 52;
1018
+ console.log("\n" + chalk3.bold(" Graph (personas \u2192 flows \u2192 pages)"));
1019
+ console.log(chalk3.cyan(" " + "\u2550".repeat(width)));
1020
+ for (const pid of personaIds) {
1021
+ const persona = personaById.get(pid);
1022
+ const name = persona?.name ?? "Unknown";
1023
+ const list = byPersona.get(pid) ?? [];
1024
+ console.log(chalk3.gray(" ") + chalk3.bold(persona ? chalk3.magenta("\u25B8 " + name) : "\u25B8 " + name));
1025
+ for (let i = 0; i < list.length; i++) {
1026
+ const flow = list[i];
1027
+ const isLastFlow = i === list.length - 1;
1028
+ const flowBranch = isLastFlow ? "\u2514" : "\u251C";
1029
+ const flowPrefix = " \u2502 ";
1030
+ const pages = flow.graph_data?.pages ?? [];
1031
+ const pageStr = pages.length > 0 ? pages.join(" \u2192 ") : "(no pages)";
1032
+ console.log(chalk3.gray(flowPrefix + flowBranch + "\u2500 ") + chalk3.cyan(flow.name));
1033
+ console.log(chalk3.gray(flowPrefix + " ") + chalk3.gray(pageStr));
1034
+ }
1035
+ }
1036
+ if (noPersona.length > 0) {
1037
+ console.log(chalk3.gray(" ") + chalk3.bold(chalk3.dim("\u25B8 (no persona)")));
1038
+ for (let i = 0; i < noPersona.length; i++) {
1039
+ const flow = noPersona[i];
1040
+ const isLastFlow = i === noPersona.length - 1;
1041
+ const flowBranch = isLastFlow ? "\u2514" : "\u251C";
1042
+ const pages = flow.graph_data?.pages ?? [];
1043
+ const pageStr = pages.length > 0 ? pages.join(" \u2192 ") : "(no pages)";
1044
+ console.log(chalk3.gray(" \u2502 " + flowBranch + "\u2500 ") + chalk3.cyan(flow.name));
1045
+ console.log(chalk3.gray(" \u2502 ") + chalk3.gray(pageStr));
1046
+ }
1047
+ }
1048
+ console.log(chalk3.cyan(" " + "\u2550".repeat(width)) + "\n");
1049
+ } catch (err) {
1050
+ console.log(
1051
+ chalk3.gray("\n Could not load graph for display: " + (err instanceof Error ? err.message : String(err)) + "\n")
1052
+ );
1053
+ }
1054
+ }
986
1055
  async function readPackageJson(projectDir) {
987
1056
  const pkgPath = path3.join(projectDir, "package.json");
988
1057
  if (!await fileExists2(pkgPath)) return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perceo/perceo",
3
- "version": "0.3.5",
3
+ "version": "0.4.1",
4
4
  "description": "Intelligent regression testing through multi-agent simulation",
5
5
  "keywords": [
6
6
  "testing",
@@ -37,8 +37,8 @@
37
37
  "commander": "^12.0.0",
38
38
  "ora": "^8.0.1",
39
39
  "tweetnacl": "^1.0.3",
40
- "@perceo/observer-engine": "2.0.5",
41
- "@perceo/supabase": "0.2.4"
40
+ "@perceo/observer-engine": "3.0.1",
41
+ "@perceo/supabase": "0.3.1"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@changesets/cli": "^2.29.8",