@mx-space/cli 0.7.6 → 0.7.7

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/README.md CHANGED
@@ -239,6 +239,8 @@ URL follows the admin-vue3 hash-router convention
239
239
  | `--state <state>` | Publication filter. |
240
240
  | `--sort <field>` | Sort field passed as `sortBy`. |
241
241
 
242
+ `mxs note list --output llm` emits one compact metadata block per note and omits full note bodies.
243
+
242
244
  ### Note Write Flags
243
245
 
244
246
  | Flag | Field |
package/dist/bin/mxs.mjs CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import { t as run } from "../mxs-BjEC9s9q.mjs";
2
+ import { t as run } from "../mxs-vbxEu09D.mjs";
3
3
  export { run };
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { a as defaultMessageFor, c as tagToCode, i as codeForTag, l as toErrorEnvelope, n as defaultGlobalFlags, o as exitCodeForError, r as parseGlobalFlags, s as exitCodeForTag, t as run } from "./mxs-BjEC9s9q.mjs";
1
+ import { a as defaultMessageFor, c as tagToCode, i as codeForTag, l as toErrorEnvelope, n as defaultGlobalFlags, o as exitCodeForError, r as parseGlobalFlags, s as exitCodeForTag, t as run } from "./mxs-vbxEu09D.mjs";
2
2
  export { codeForTag, defaultGlobalFlags, defaultMessageFor, exitCodeForError, exitCodeForTag, parseGlobalFlags, run, tagToCode, toErrorEnvelope };
@@ -24,7 +24,7 @@ import * as ChildProcess from "node:child_process";
24
24
  import childProcess, { execFile, spawn } from "node:child_process";
25
25
  import * as readline from "node:readline";
26
26
  import E from "node:readline";
27
- import V, { stdin, stdout } from "node:process";
27
+ import process$1, { stdin, stdout } from "node:process";
28
28
  import "node:tty";
29
29
  //#region ../../node_modules/.pnpm/@effect+platform@0.96.1_effect@3.21.2/node_modules/@effect/platform/dist/esm/Error.js
30
30
  /**
@@ -9042,7 +9042,7 @@ function isInsideContainer() {
9042
9042
  //#endregion
9043
9043
  //#region ../../node_modules/.pnpm/is-wsl@3.1.1/node_modules/is-wsl/index.js
9044
9044
  const isWsl = () => {
9045
- if (V.platform !== "linux") return false;
9045
+ if (process$1.platform !== "linux") return false;
9046
9046
  if (os.release().toLowerCase().includes("microsoft")) {
9047
9047
  if (isInsideContainer()) return false;
9048
9048
  return true;
@@ -9053,11 +9053,11 @@ const isWsl = () => {
9053
9053
  if (fs.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop") || fs.existsSync("/run/WSL")) return !isInsideContainer();
9054
9054
  return false;
9055
9055
  };
9056
- var is_wsl_default = V.env.__IS_WSL_TEST__ ? isWsl : isWsl();
9056
+ var is_wsl_default = process$1.env.__IS_WSL_TEST__ ? isWsl : isWsl();
9057
9057
  //#endregion
9058
9058
  //#region ../../node_modules/.pnpm/powershell-utils@0.1.0/node_modules/powershell-utils/index.js
9059
9059
  const execFile$2 = promisify(childProcess.execFile);
9060
- const powerShellPath$1 = () => `${V.env.SYSTEMROOT || V.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
9060
+ const powerShellPath$1 = () => `${process$1.env.SYSTEMROOT || process$1.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
9061
9061
  const executePowerShell = async (command, options = {}) => {
9062
9062
  const { powerShellPath: psPath, ...execFileOptions } = options;
9063
9063
  const encodedCommand = executePowerShell.encodeCommand(command);
@@ -9164,7 +9164,7 @@ function defineLazyProperty(object, propertyName, valueGetter) {
9164
9164
  //#region ../../node_modules/.pnpm/default-browser-id@5.0.1/node_modules/default-browser-id/index.js
9165
9165
  const execFileAsync$3 = promisify(execFile);
9166
9166
  async function defaultBrowserId() {
9167
- if (V.platform !== "darwin") throw new Error("macOS only");
9167
+ if (process$1.platform !== "darwin") throw new Error("macOS only");
9168
9168
  const { stdout } = await execFileAsync$3("defaults", [
9169
9169
  "read",
9170
9170
  "com.apple.LaunchServices/com.apple.launchservices.secure",
@@ -9178,7 +9178,7 @@ async function defaultBrowserId() {
9178
9178
  //#region ../../node_modules/.pnpm/run-applescript@7.1.0/node_modules/run-applescript/index.js
9179
9179
  const execFileAsync$2 = promisify(execFile);
9180
9180
  async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
9181
- if (V.platform !== "darwin") throw new Error("macOS only");
9181
+ if (process$1.platform !== "darwin") throw new Error("macOS only");
9182
9182
  const outputArguments = humanReadableOutput ? [] : ["-ss"];
9183
9183
  const execOptions = {};
9184
9184
  if (signal) execOptions.signal = signal;
@@ -9289,14 +9289,14 @@ async function defaultBrowser$1(_execFileAsync = execFileAsync$1) {
9289
9289
  const execFileAsync = promisify(execFile);
9290
9290
  const titleize = (string) => string.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x) => x.toUpperCase());
9291
9291
  async function defaultBrowser() {
9292
- if (V.platform === "darwin") {
9292
+ if (process$1.platform === "darwin") {
9293
9293
  const id = await defaultBrowserId();
9294
9294
  return {
9295
9295
  name: await bundleName(id),
9296
9296
  id
9297
9297
  };
9298
9298
  }
9299
- if (V.platform === "linux") {
9299
+ if (process$1.platform === "linux") {
9300
9300
  const { stdout } = await execFileAsync("xdg-mime", [
9301
9301
  "query",
9302
9302
  "default",
@@ -9308,18 +9308,18 @@ async function defaultBrowser() {
9308
9308
  id
9309
9309
  };
9310
9310
  }
9311
- if (V.platform === "win32") return defaultBrowser$1();
9311
+ if (process$1.platform === "win32") return defaultBrowser$1();
9312
9312
  throw new Error("Only macOS, Linux, and Windows are supported");
9313
9313
  }
9314
9314
  //#endregion
9315
9315
  //#region ../../node_modules/.pnpm/is-in-ssh@1.0.0/node_modules/is-in-ssh/index.js
9316
- const isInSsh = Boolean(V.env.SSH_CONNECTION || V.env.SSH_CLIENT || V.env.SSH_TTY);
9316
+ const isInSsh = Boolean(process$1.env.SSH_CONNECTION || process$1.env.SSH_CLIENT || process$1.env.SSH_TTY);
9317
9317
  //#endregion
9318
9318
  //#region ../../node_modules/.pnpm/open@11.0.0/node_modules/open/index.js
9319
9319
  const fallbackAttemptSymbol = Symbol("fallbackAttempt");
9320
9320
  const __dirname = import.meta.url ? path.dirname(fileURLToPath(import.meta.url)) : "";
9321
9321
  const localXdgOpenPath = path.join(__dirname, "xdg-open");
9322
- const { platform: platform$1, arch: arch$1 } = V;
9322
+ const { platform: platform$1, arch: arch$1 } = process$1;
9323
9323
  const tryEachApp = async (apps, opener) => {
9324
9324
  if (apps.length === 0) return;
9325
9325
  const errors = [];
@@ -9432,7 +9432,7 @@ const baseOpen = async (options) => {
9432
9432
  await fs$1.access(localXdgOpenPath, constants.X_OK);
9433
9433
  exeLocalXdgOpen = true;
9434
9434
  } catch {}
9435
- command = V.versions.electron ?? (platform$1 === "android" || isBundled || !exeLocalXdgOpen) ? "xdg-open" : localXdgOpenPath;
9435
+ command = process$1.versions.electron ?? (platform$1 === "android" || isBundled || !exeLocalXdgOpen) ? "xdg-open" : localXdgOpenPath;
9436
9436
  }
9437
9437
  if (appArguments.length > 0) cliArguments.push(...appArguments);
9438
9438
  if (!options.wait) {
@@ -11024,7 +11024,7 @@ var ht$1 = class extends m {
11024
11024
  //#endregion
11025
11025
  //#region ../../node_modules/.pnpm/@clack+prompts@1.4.0/node_modules/@clack/prompts/dist/index.mjs
11026
11026
  function ee() {
11027
- return V.platform !== "win32" ? V.env.TERM !== "linux" : !!V.env.CI || !!V.env.WT_SESSION || !!V.env.TERMINUS_SUBLIME || V.env.ConEmuTask === "{cmd::Cmder}" || V.env.TERM_PROGRAM === "Terminus-Sublime" || V.env.TERM_PROGRAM === "vscode" || V.env.TERM === "xterm-256color" || V.env.TERM === "alacritty" || V.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
11027
+ return process$1.platform !== "win32" ? process$1.env.TERM !== "linux" : !!process$1.env.CI || !!process$1.env.WT_SESSION || !!process$1.env.TERMINUS_SUBLIME || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
11028
11028
  }
11029
11029
  const tt = ee(), w = (t, i) => tt ? t : i, Tt = w("◆", "*"), at = w("■", "x"), ut = w("▲", "x"), H = w("◇", "o");
11030
11030
  const $ = w("│", "|"), x = w("└", "—");
@@ -31123,6 +31123,58 @@ const noteView = {
31123
31123
  });
31124
31124
  }
31125
31125
  };
31126
+ const collectListItemFields$1 = (doc, articleMeta) => {
31127
+ const meta = articleMeta ?? {};
31128
+ return [
31129
+ ["id", first(doc, "id")],
31130
+ ["nid", first(doc, "nid")],
31131
+ ["title", first(doc, "title")],
31132
+ ["slug", first(doc, "slug")],
31133
+ ["state", publishState(doc)],
31134
+ ["topic", relationLabel(first(doc, "topic"))],
31135
+ ["mood", first(doc, "mood")],
31136
+ ["weather", first(doc, "weather")],
31137
+ ["bookmark", first(doc, "bookmark")],
31138
+ ["summary", first(doc, "summary")],
31139
+ ["public_at", first(doc, "public_at", "publicAt")],
31140
+ ["created_at", first(doc, "created_at", "createdAt")],
31141
+ ["modified_at", first(doc, "modified_at", "modifiedAt")],
31142
+ ["source_lang", first(doc, "source_lang", "sourceLang") ?? first(meta, "source_lang", "sourceLang")],
31143
+ ["translated", first(doc, "is_translated", "isTranslated") ?? first(meta, "is_translated", "isTranslated")]
31144
+ ];
31145
+ };
31146
+ const renderNoteListReadable = (data) => {
31147
+ const payload = asRecord(data);
31148
+ const rows = Array.isArray(payload.data) ? payload.data : Array.isArray(data) ? data : [];
31149
+ const pagination = asRecord(first(asRecord(first(payload, "meta")), "pagination"));
31150
+ const lines = ["notes"];
31151
+ if (rows.length > 0) lines.push(`count: ${rows.length}`);
31152
+ else lines.push("count: 0");
31153
+ const page = first(pagination, "page", "currentPage");
31154
+ const size = first(pagination, "size", "pageSize");
31155
+ const total = first(pagination, "total", "totalCount", "total_count");
31156
+ if (page !== void 0) lines.push(`page: ${formatScalar(page)}`);
31157
+ if (size !== void 0) lines.push(`size: ${formatScalar(size)}`);
31158
+ if (total !== void 0) lines.push(`total: ${formatScalar(total)}`);
31159
+ rows.forEach((row, index) => {
31160
+ const doc = asRecord(row);
31161
+ const articleMeta = pickArticleTranslationMeta(data, first(doc, "id"));
31162
+ lines.push("", `note ${index + 1}:`);
31163
+ const fields = collectListItemFields$1(doc, articleMeta);
31164
+ for (const [key, value] of fields) {
31165
+ if (value === void 0 || value === null || value === "") continue;
31166
+ if (key === "translated" && value === false) continue;
31167
+ const rendered = tryFormatTimestamp(value, { style: "rel" }) ?? formatScalar(value);
31168
+ lines.push(`${key}: ${rendered}`);
31169
+ }
31170
+ });
31171
+ return lines.join("\n");
31172
+ };
31173
+ const noteListView = {
31174
+ kind: "note-list",
31175
+ modes: new Set(["readable", "llm"]),
31176
+ readable: (data) => renderNoteListReadable(data)
31177
+ };
31126
31178
  const get$4 = make$13("get", { slugOrId: text$4({ name: "slugOrId" }) }, ({ slugOrId }) => gen(function* () {
31127
31179
  const api = yield* Api;
31128
31180
  const renderer = yield* Renderer;
@@ -31161,7 +31213,7 @@ const list$4 = make$13("list", {
31161
31213
  size: unwrap$2(size),
31162
31214
  sortBy: unwrap$2(sort)
31163
31215
  } });
31164
- yield* renderer.emitSuccess(res);
31216
+ yield* renderer.emit(noteListView, res);
31165
31217
  })).pipe(withDescription("list notes"));
31166
31218
  const publish$1 = make$13("publish", { slugOrId: text$4({ name: "slugOrId" }) }, ({ slugOrId }) => gen(function* () {
31167
31219
  const resolver = yield* Resolver;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mx-space/cli",
3
- "version": "0.7.6",
3
+ "version": "0.7.7",
4
4
  "description": "Command line interface for mx-space (mx-core) — auth, content, configuration",
5
5
  "keywords": [
6
6
  "mx-space",
@@ -64,7 +64,7 @@
64
64
  "minisearch": "^7.2.0",
65
65
  "open": "^11.0.0",
66
66
  "semver": "7.8.0",
67
- "@mx-space/api-client": "5.0.2"
67
+ "@mx-space/api-client": "5.1.1"
68
68
  },
69
69
  "devDependencies": {
70
70
  "@effect/vitest": "0.29.0",