@g0hub/cli 1.0.0 → 1.0.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 (3) hide show
  1. package/README.md +11 -0
  2. package/dist/index.js +152 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -150,6 +150,17 @@ g0 review <task-id>
150
150
  | `g0 conversations:search [query]` | Search across all your messages |
151
151
  | `g0 conversations:read <task-id>` | Mark all messages in a conversation as read |
152
152
 
153
+ ### Notifications
154
+
155
+ | Command | Description |
156
+ |---------|-------------|
157
+ | `g0 notifications` | List your notifications (options: `--unread`, `--limit`) |
158
+ | `g0 notifications:read <id>` | Mark a notification as read |
159
+ | `g0 notifications:read-all` | Mark all notifications as read |
160
+ | `g0 notifications:unread-count` | Show unread notification count |
161
+ | `g0 notifications:preferences` | Show current notification preferences |
162
+ | `g0 notifications:preferences:set <category> <on\|off>` | Toggle a notification category |
163
+
153
164
  ### Agent Management
154
165
 
155
166
  Commands for agent owners ("agentrepreneurs") to manage their listings and fulfill tasks.
package/dist/index.js CHANGED
@@ -2054,6 +2054,128 @@ var init_messages = __esm({
2054
2054
  }
2055
2055
  });
2056
2056
 
2057
+ // src/commands/notifications.ts
2058
+ var notifications_exports = {};
2059
+ __export(notifications_exports, {
2060
+ listNotifications: () => listNotifications,
2061
+ markAllNotificationsRead: () => markAllNotificationsRead,
2062
+ markNotificationRead: () => markNotificationRead,
2063
+ setPreference: () => setPreference,
2064
+ unreadCount: () => unreadCount,
2065
+ viewPreferences: () => viewPreferences
2066
+ });
2067
+ async function listNotifications(opts) {
2068
+ const s = spin("Loading notifications...");
2069
+ try {
2070
+ const query = {
2071
+ limit: opts.limit || "20"
2072
+ };
2073
+ if (opts.unread) query.unread = "true";
2074
+ const res = await api.get("/notifications", query);
2075
+ s.stop();
2076
+ if (res.notifications.length === 0) {
2077
+ console.log(c.warn("\n No notifications.\n"));
2078
+ return;
2079
+ }
2080
+ section(`Notifications (${res.notifications.length})`);
2081
+ const table = createTable(["", "Title", "Message", "Category", "Time"]);
2082
+ for (const n of res.notifications) {
2083
+ const readIcon = n.read ? c.muted("\u25CB") : c.cool("\u25CF");
2084
+ const title = n.read ? c.muted(n.title) : c.bold(n.title);
2085
+ const msg = n.message.length > 40 ? n.message.slice(0, 40) + "..." : n.message;
2086
+ table.push([readIcon, title, msg, c.dim(n.category), formatDate(n.createdAt)]);
2087
+ }
2088
+ console.log(table.toString() + "\n");
2089
+ if (res.cursor) {
2090
+ console.log(c.muted(` More notifications available. Use --limit to load more.
2091
+ `));
2092
+ }
2093
+ } catch (err) {
2094
+ s.fail("Failed to load notifications");
2095
+ showError(err);
2096
+ }
2097
+ }
2098
+ async function markNotificationRead(id) {
2099
+ const s = spin("Marking notification as read...");
2100
+ try {
2101
+ await api.post("/notifications/read", { ids: [id] });
2102
+ s.succeed(c.success("Notification marked as read!"));
2103
+ console.log();
2104
+ } catch (err) {
2105
+ s.fail("Failed to mark notification as read");
2106
+ showError(err);
2107
+ }
2108
+ }
2109
+ async function markAllNotificationsRead() {
2110
+ const s = spin("Marking all notifications as read...");
2111
+ try {
2112
+ const res = await api.post("/notifications/read-all");
2113
+ s.succeed(c.success("All notifications marked as read!"));
2114
+ showSuccess(`${res.marked} notification${res.marked !== 1 ? "s" : ""} marked as read.`);
2115
+ console.log();
2116
+ } catch (err) {
2117
+ s.fail("Failed to mark all notifications as read");
2118
+ showError(err);
2119
+ }
2120
+ }
2121
+ async function unreadCount() {
2122
+ const s = spin("Checking unread notifications...");
2123
+ try {
2124
+ const res = await api.get("/notifications/unread-count");
2125
+ s.stop();
2126
+ if (res.count === 0) {
2127
+ console.log(c.success("\n No unread notifications.\n"));
2128
+ } else {
2129
+ console.log(c.cool(`
2130
+ ${c.bold(String(res.count))} unread notification${res.count !== 1 ? "s" : ""}.
2131
+ `));
2132
+ }
2133
+ } catch (err) {
2134
+ s.fail("Failed to check unread count");
2135
+ showError(err);
2136
+ }
2137
+ }
2138
+ async function viewPreferences() {
2139
+ const s = spin("Loading notification preferences...");
2140
+ try {
2141
+ const res = await api.get("/notifications/preferences");
2142
+ s.stop();
2143
+ section("Notification Preferences");
2144
+ const table = createTable(["Category", "Status"]);
2145
+ for (const [category, enabled] of Object.entries(res.preferences)) {
2146
+ const status = enabled ? c.success("ON") : c.err("OFF");
2147
+ table.push([category, status]);
2148
+ }
2149
+ console.log(table.toString() + "\n");
2150
+ } catch (err) {
2151
+ s.fail("Failed to load notification preferences");
2152
+ showError(err);
2153
+ }
2154
+ }
2155
+ async function setPreference(category, value) {
2156
+ const enabled = value.toLowerCase() === "on";
2157
+ if (value.toLowerCase() !== "on" && value.toLowerCase() !== "off") {
2158
+ console.error(c.err.bold("\n \u2717 Invalid value.") + c.muted(' Use "on" or "off".\n'));
2159
+ process.exit(1);
2160
+ }
2161
+ const s = spin(`Setting ${category} to ${value}...`);
2162
+ try {
2163
+ await api.put("/notifications/preferences", { [category]: enabled });
2164
+ s.succeed(c.success(`${category} notifications turned ${value.toUpperCase()}.`));
2165
+ console.log();
2166
+ } catch (err) {
2167
+ s.fail("Failed to update notification preference");
2168
+ showError(err);
2169
+ }
2170
+ }
2171
+ var init_notifications = __esm({
2172
+ "src/commands/notifications.ts"() {
2173
+ "use strict";
2174
+ init_api();
2175
+ init_ui();
2176
+ }
2177
+ });
2178
+
2057
2179
  // src/commands/agents.ts
2058
2180
  var agents_exports = {};
2059
2181
  __export(agents_exports, {
@@ -3204,6 +3326,36 @@ program.command("conversations:search [query]").description("Search across all y
3204
3326
  const { searchMessages: searchMessages2 } = await Promise.resolve().then(() => (init_messages(), messages_exports));
3205
3327
  await searchMessages2(query);
3206
3328
  });
3329
+ program.command("notifications").description("List your notifications").option("-u, --unread", "Show only unread notifications").option("-l, --limit <n>", "Max results", "20").action(async (opts) => {
3330
+ requireAuth2();
3331
+ const { listNotifications: listNotifications2 } = await Promise.resolve().then(() => (init_notifications(), notifications_exports));
3332
+ await listNotifications2(opts);
3333
+ });
3334
+ program.command("notifications:read <id>").description("Mark a notification as read").action(async (id) => {
3335
+ requireAuth2();
3336
+ const { markNotificationRead: markNotificationRead2 } = await Promise.resolve().then(() => (init_notifications(), notifications_exports));
3337
+ await markNotificationRead2(id);
3338
+ });
3339
+ program.command("notifications:read-all").description("Mark all notifications as read").action(async () => {
3340
+ requireAuth2();
3341
+ const { markAllNotificationsRead: markAllNotificationsRead2 } = await Promise.resolve().then(() => (init_notifications(), notifications_exports));
3342
+ await markAllNotificationsRead2();
3343
+ });
3344
+ program.command("notifications:unread-count").description("Show unread notification count").action(async () => {
3345
+ requireAuth2();
3346
+ const { unreadCount: unreadCount2 } = await Promise.resolve().then(() => (init_notifications(), notifications_exports));
3347
+ await unreadCount2();
3348
+ });
3349
+ program.command("notifications:preferences").description("Show current notification preferences").action(async () => {
3350
+ requireAuth2();
3351
+ const { viewPreferences: viewPreferences2 } = await Promise.resolve().then(() => (init_notifications(), notifications_exports));
3352
+ await viewPreferences2();
3353
+ });
3354
+ program.command("notifications:preferences:set <category> <value>").description("Toggle a notification category (on|off)").action(async (category, value) => {
3355
+ requireAuth2();
3356
+ const { setPreference: setPreference2 } = await Promise.resolve().then(() => (init_notifications(), notifications_exports));
3357
+ await setPreference2(category, value);
3358
+ });
3207
3359
  program.command("agents").description("List your registered agent listings").action(async () => {
3208
3360
  requireAuth2();
3209
3361
  const { listMyAgents: listMyAgents2 } = await Promise.resolve().then(() => (init_agents(), agents_exports));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@g0hub/cli",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "CLI for the g0 AI Agent Marketplace — hire agents, manage tasks, deploy services, and earn money from the terminal.",
5
5
  "type": "module",
6
6
  "bin": {