@supacortex/cli 0.1.2 → 0.1.4

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 +27 -2
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -188,11 +188,12 @@ var registerWhoamiCommand = (program2) => {
188
188
  // src/commands/bookmarks.ts
189
189
  var registerBookmarksCommand = (program2) => {
190
190
  const bookmarks = program2.command("bookmarks");
191
- bookmarks.command("list").option("-l, --limit <number>", "Max results", "20").option("-o, --offset <number>", "Skip results").option("-s, --search <string>", "Search bookmarks").option("-j, --json", "Output raw JSON").description("List all bookmarks").action(async (option) => {
191
+ bookmarks.command("list").option("-l, --limit <number>", "Max results", "20").option("-o, --offset <number>", "Skip results").option("-s, --search <string>", "Search bookmarks").option("-t, --type <string>", "Filter by type (tweet, link, youtube)").option("-j, --json", "Output raw JSON").description("List all bookmarks").action(async (option) => {
192
192
  const searchParams = new URLSearchParams();
193
193
  if (option.limit) searchParams.append("limit", String(parseInt(option.limit, 10)));
194
194
  if (option.offset) searchParams.append("offset", String(parseInt(option.offset, 10)));
195
195
  if (option.search) searchParams.append("search", option.search);
196
+ if (option.type) searchParams.append("type", option.type);
196
197
  const result = await apiRequest(
197
198
  `bookmarks?${searchParams.toString()}`,
198
199
  "GET"
@@ -220,6 +221,21 @@ var registerBookmarksCommand = (program2) => {
220
221
  }
221
222
  console.log(`Bookmark added: ${result.title || result.url}`);
222
223
  });
224
+ bookmarks.command("get").description("Get a bookmark by ID").argument("<id>", "Bookmark ID").option("-j, --json", "Output raw JSON").action(async (id, option) => {
225
+ const data = await apiRequest(`bookmarks/${id}`, "GET");
226
+ if (option.json) {
227
+ console.log(JSON.stringify(data, null, 2));
228
+ return;
229
+ }
230
+ console.log(`ID: ${data.id}`);
231
+ console.log(`Type: ${data.type}`);
232
+ console.log(`Title: ${data.title || "(none)"}`);
233
+ console.log(`URL: ${data.url}`);
234
+ if (data.author) console.log(`Author: ${data.author}`);
235
+ if (data.content) console.log(`Content: ${data.content.slice(0, 200)}${data.content.length > 200 ? "\u2026" : ""}`);
236
+ console.log(`Read: ${data.isRead ? "yes" : "no"}`);
237
+ console.log(`Created: ${data.createdAt}`);
238
+ });
223
239
  bookmarks.command("delete").description("Delete a bookmark").argument("<id>", "Bookmark ID to delete").option("-j, --json", "Output raw JSON").action(async (id, option) => {
224
240
  const result = await apiRequest(`bookmarks/${id}`, "DELETE");
225
241
  if (option.json) {
@@ -344,10 +360,19 @@ var registerUpdateCommand = (program2, version) => {
344
360
  // src/lib/update-notifier.ts
345
361
  var NPM_REGISTRY_URL2 = "https://registry.npmjs.org/@supacortex/cli/latest";
346
362
  var CHECK_INTERVAL = 24 * 60 * 60 * 1e3;
363
+ var isNewer = (latest, current) => {
364
+ const l = latest.split(".").map(Number);
365
+ const c = current.split(".").map(Number);
366
+ for (let i = 0; i < 3; i++) {
367
+ if (l[i] > c[i]) return true;
368
+ if (l[i] < c[i]) return false;
369
+ }
370
+ return false;
371
+ };
347
372
  var checkForUpdates = (currentVersion) => {
348
373
  const config = getConfig();
349
374
  const now = Date.now();
350
- if (config.latestVersion && config.latestVersion !== currentVersion) {
375
+ if (config.latestVersion && isNewer(config.latestVersion, currentVersion)) {
351
376
  process.on("exit", () => {
352
377
  console.log();
353
378
  console.log(` Update available: ${currentVersion} \u2192 ${config.latestVersion}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supacortex/cli",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Supacortex CLI — your second brain from the terminal",
5
5
  "type": "module",
6
6
  "bin": {
@@ -21,7 +21,7 @@
21
21
  ],
22
22
  "repository": {
23
23
  "type": "git",
24
- "url": "https://github.com/monorepo-labs/supacortex"
24
+ "url": "git+https://github.com/monorepo-labs/supacortex.git"
25
25
  },
26
26
  "license": "MIT",
27
27
  "dependencies": {