@app-vitals/agent-admin 1.124.0 → 1.125.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@app-vitals/agent-admin",
3
- "version": "1.124.0",
3
+ "version": "1.125.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/app-vitals/agent.git",
@@ -44,7 +44,7 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "@anthropic-ai/sdk": "0.137.0",
47
- "@app-vitals/agent-lib": "1.124.0",
47
+ "@app-vitals/agent-lib": "1.125.0",
48
48
  "@hono/zod-openapi": "^1.0.0",
49
49
  "@prisma/adapter-pg": "^7.10.0",
50
50
  "@prisma/client": "^7.10.0",
@@ -145,8 +145,8 @@ export interface BuildSettingsNavOptions {
145
145
  }
146
146
 
147
147
  /**
148
- * Base settings nav: Account section (SGL-2.3), Platform section (GitHub
149
- * Enterprise, Templates, admin-only Accounts) plus extension items. Empty
148
+ * Base settings nav: Personal section (Preferences), Account section (Account,
149
+ * admin-only Accounts; SGL-2.3), Platform section (GitHub Enterprise, Templates) plus extension items. Empty
150
150
  * sections are dropped.
151
151
  */
152
152
  export function buildSettingsNav(
@@ -175,28 +175,22 @@ export function buildSettingsNav(
175
175
  ownerOnly: true,
176
176
  });
177
177
  }
178
- if (opts.accounts) {
179
- platform.push({
180
- label: "Accounts",
181
- path: SETTINGS_ACCOUNTS_PATH,
182
- adminOnly: true,
178
+ const sections: SettingsNavSection[] = [];
179
+ if (opts.preferences) {
180
+ sections.push({
181
+ label: "Personal",
182
+ items: [{ label: "Preferences", path: SETTINGS_PREFERENCES_PATH }],
183
183
  });
184
184
  }
185
- const sections: SettingsNavSection[] = [];
186
185
  if (opts.accounts) {
187
186
  sections.push({
188
187
  label: "Account",
189
188
  items: [
190
189
  { label: "Account", path: SETTINGS_ACCOUNT_PATH, ownerOnly: true },
190
+ { label: "Accounts", path: SETTINGS_ACCOUNTS_PATH, adminOnly: true },
191
191
  ],
192
192
  });
193
193
  }
194
- if (opts.preferences) {
195
- const section = sections.find((s) => s.label === "Account");
196
- const item = { label: "Preferences", path: SETTINGS_PREFERENCES_PATH };
197
- if (section) section.items.push(item);
198
- else sections.push({ label: "Account", items: [item] });
199
- }
200
194
  if (platform.length > 0)
201
195
  sections.push({ label: "Platform", items: platform });
202
196
  const base: SettingsNav = { sections };
@@ -225,11 +225,11 @@ describe("filterSettingsNavForRole (ACM-7.2)", () => {
225
225
  test("admin sees every item", () => {
226
226
  expect(labels("admin")).toEqual([
227
227
  "Account",
228
+ "Accounts",
228
229
  "Notifications",
229
230
  "GitHub Enterprise",
230
231
  "Slack config token",
231
232
  "Templates",
232
- "Accounts",
233
233
  "System crons",
234
234
  ]);
235
235
  });
@@ -259,3 +259,44 @@ describe("filterSettingsNavForRole (ACM-7.2)", () => {
259
259
  );
260
260
  });
261
261
  });
262
+
263
+ describe("settings nav reorg: Personal / Account sections", () => {
264
+ const nav = buildSettingsNav({
265
+ preferences: true,
266
+ accounts: true,
267
+ templates: true,
268
+ extraItems: [{ section: "Personal", label: "Profile", path: "/profile" }],
269
+ });
270
+ const section = (n: SettingsNav, label: string) =>
271
+ n.sections.find((s) => s.label === label)?.items.map((i) => i.label);
272
+
273
+ test("Preferences lives under Personal, not Account", () => {
274
+ expect(section(nav, "Personal")).toContain("Preferences");
275
+ expect(section(nav, "Account")).not.toContain("Preferences");
276
+ });
277
+ test("Accounts lives under Account, not Platform", () => {
278
+ expect(section(nav, "Account")).toEqual(["Account", "Accounts"]);
279
+ expect(section(nav, "Platform")).not.toContain("Accounts");
280
+ });
281
+ test("admin sees both Account items; owner sees Account only", () => {
282
+ expect(section(filterSettingsNavForRole(nav, "admin"), "Account")).toEqual([
283
+ "Account",
284
+ "Accounts",
285
+ ]);
286
+ expect(section(filterSettingsNavForRole(nav, "owner"), "Account")).toEqual([
287
+ "Account",
288
+ ]);
289
+ });
290
+ test("a member's resolved nav has no Account section or Accounts item", () => {
291
+ const member = filterSettingsNavForRole(nav, "member");
292
+ expect(member.sections.map((s) => s.label)).not.toContain("Account");
293
+ const labels = member.sections.flatMap((s) => s.items.map((i) => i.label));
294
+ expect(labels).not.toContain("Account");
295
+ expect(labels).not.toContain("Accounts");
296
+ expect(section(member, "Personal")).toContain("Preferences");
297
+ });
298
+ test("an extension item targeting Personal merges into the Preferences section", () => {
299
+ expect(nav.sections.filter((s) => s.label === "Personal")).toHaveLength(1);
300
+ expect(section(nav, "Personal")).toEqual(["Preferences", "Profile"]);
301
+ });
302
+ });
@@ -88,9 +88,9 @@ describe("getSettingsNav in extension adminUiRoutes", () => {
88
88
  );
89
89
  expect(paths(nav)).toEqual([
90
90
  SETTINGS_ACCOUNT_PATH,
91
+ SETTINGS_ACCOUNTS_PATH,
91
92
  SETTINGS_GHE_PATH,
92
93
  SETTINGS_TEMPLATES_PATH,
93
- SETTINGS_ACCOUNTS_PATH,
94
94
  "/admin/ext-page",
95
95
  ]);
96
96
  });
@@ -277,11 +277,11 @@ describe("GET /admin/settings with accounts (SGL-2.3)", () => {
277
277
  expect(res.headers.get("location")).toBe("/admin/notifications");
278
278
  });
279
279
 
280
- it("skips Account for an admin without an account", async () => {
280
+ it("skips Account for an admin without an account, landing on Accounts", async () => {
281
281
  const res = await build(null).request("/admin/settings", {
282
282
  headers: { cookie: await adminCookie() },
283
283
  });
284
284
  expect(res.status).toBe(302);
285
- expect(res.headers.get("location")).toBe("/admin/settings/templates");
285
+ expect(res.headers.get("location")).toBe("/admin/accounts");
286
286
  });
287
287
  });