@bonginkan/maria 4.2.6 → 4.2.8

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/dist/cli.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
  'use strict';
3
3
 
4
4
  var fs = require('fs');
5
- var path8 = require('path');
5
+ var path10 = require('path');
6
6
  var dotenv = require('dotenv');
7
7
  var chalk17 = require('chalk');
8
8
  var os = require('os');
@@ -20,6 +20,7 @@ var net = require('net');
20
20
  var https = require('https');
21
21
  var zlib = require('zlib');
22
22
  var readline = require('readline');
23
+ var fs8 = require('fs-extra');
23
24
  var zod = require('zod');
24
25
  require('strip-ansi');
25
26
  require('string-width');
@@ -50,7 +51,7 @@ function _interopNamespace(e) {
50
51
  }
51
52
 
52
53
  var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
53
- var path8__namespace = /*#__PURE__*/_interopNamespace(path8);
54
+ var path10__namespace = /*#__PURE__*/_interopNamespace(path10);
54
55
  var dotenv__namespace = /*#__PURE__*/_interopNamespace(dotenv);
55
56
  var chalk17__default = /*#__PURE__*/_interopDefault(chalk17);
56
57
  var os__namespace = /*#__PURE__*/_interopNamespace(os);
@@ -62,6 +63,7 @@ var Stream__default = /*#__PURE__*/_interopDefault(Stream);
62
63
  var https__default = /*#__PURE__*/_interopDefault(https);
63
64
  var zlib__default = /*#__PURE__*/_interopDefault(zlib);
64
65
  var readline__namespace = /*#__PURE__*/_interopNamespace(readline);
66
+ var fs8__namespace = /*#__PURE__*/_interopNamespace(fs8);
65
67
  var ora__default = /*#__PURE__*/_interopDefault(ora);
66
68
  var readline5__namespace = /*#__PURE__*/_interopNamespace(readline5);
67
69
 
@@ -104,14 +106,14 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
104
106
  mod
105
107
  ));
106
108
  function loadEnvironmentVariables() {
107
- const _envPath = path8__namespace.join(process.cwd(), ".env");
109
+ const _envPath = path10__namespace.join(process.cwd(), ".env");
108
110
  if (fs__namespace.existsSync(_envPath)) {
109
111
  const _result = dotenv__namespace.config({ path: _envPath });
110
112
  if (_result.error) {
111
113
  console.warn("Error loading .env:", _result.error);
112
114
  }
113
115
  }
114
- const _lmstudioEnvPath = path8__namespace.join(process.cwd(), ".env.lmstudio");
116
+ const _lmstudioEnvPath = path10__namespace.join(process.cwd(), ".env.lmstudio");
115
117
  if (fs__namespace.existsSync(_lmstudioEnvPath)) {
116
118
  const _result = dotenv__namespace.config({ path: _lmstudioEnvPath, override: false });
117
119
  if (_result.error) {
@@ -143,25 +145,25 @@ function getPackageJson() {
143
145
  try {
144
146
  const possiblePaths = [
145
147
  // When running from built dist/
146
- path8.join(__dirname, "../../package.json"),
148
+ path10.join(__dirname, "../../package.json"),
147
149
  // When running from source
148
- path8.join(__dirname, "../../../package.json"),
150
+ path10.join(__dirname, "../../../package.json"),
149
151
  // Current working directory
150
- path8.join(process.cwd(), "package.json"),
152
+ path10.join(process.cwd(), "package.json"),
151
153
  // One level up from current working directory
152
- path8.join(process.cwd(), "../package.json"),
154
+ path10.join(process.cwd(), "../package.json"),
153
155
  // For globally installed packages
154
- path8.join(__dirname, "../../../../package.json"),
155
- path8.join(__dirname, "../../../../../package.json"),
156
+ path10.join(__dirname, "../../../../package.json"),
157
+ path10.join(__dirname, "../../../../../package.json"),
156
158
  // npm global install locations
157
159
  "/usr/local/lib/node_modules/@bonginkan/maria/package.json",
158
160
  "/usr/lib/node_modules/@bonginkan/maria/package.json",
159
161
  // User home npm global
160
- path8.join(
162
+ path10.join(
161
163
  process.env.HOME || "",
162
164
  ".npm-global/lib/node_modules/@bonginkan/maria/package.json"
163
165
  ),
164
- path8.join(
166
+ path10.join(
165
167
  process.env.HOME || "",
166
168
  ".nvm/versions/node",
167
169
  process.version,
@@ -169,13 +171,13 @@ function getPackageJson() {
169
171
  )
170
172
  ];
171
173
  let packageJsonPath = null;
172
- for (const path12 of possiblePaths) {
173
- if (fs.existsSync(path12)) {
174
+ for (const path14 of possiblePaths) {
175
+ if (fs.existsSync(path14)) {
174
176
  try {
175
- const content = fs.readFileSync(path12, "utf-8");
177
+ const content = fs.readFileSync(path14, "utf-8");
176
178
  const parsed = JSON.parse(content);
177
179
  if (parsed.name === "@bonginkan/maria") {
178
- packageJsonPath = path12;
180
+ packageJsonPath = path14;
179
181
  break;
180
182
  }
181
183
  } catch {
@@ -546,8 +548,8 @@ var init_TokenStorage = __esm({
546
548
  TokenStorage = class {
547
549
  SERVICE_NAME = "maria-cli";
548
550
  ACCOUNT_NAME = "default";
549
- CONFIG_DIR = path8__namespace.default.join(os__namespace.default.homedir(), ".maria");
550
- TOKEN_FILE = path8__namespace.default.join(this.CONFIG_DIR, "auth-tokens.json");
551
+ CONFIG_DIR = path10__namespace.default.join(os__namespace.default.homedir(), ".maria");
552
+ TOKEN_FILE = path10__namespace.default.join(this.CONFIG_DIR, "auth-tokens.json");
551
553
  /**
552
554
  * Save tokens securely
553
555
  */
@@ -689,15 +691,34 @@ var AuthSecretManager;
689
691
  var init_AuthSecretManager = __esm({
690
692
  "src/services/cli-auth/AuthSecretManager.ts"() {
691
693
  AuthSecretManager = class {
692
- client;
694
+ client = null;
693
695
  cache = /* @__PURE__ */ new Map();
694
696
  cacheExpiry = /* @__PURE__ */ new Map();
695
697
  CACHE_TTL = 36e5;
696
698
  // 1 hour
697
699
  projectId;
700
+ useGsm;
698
701
  constructor() {
699
702
  this.projectId = process.env.GCLOUD_PROJECT || "maria-code-470602";
700
- this.client = new secretManager.SecretManagerServiceClient();
703
+ this.useGsm = this.shouldUseGsm();
704
+ if (this.useGsm) {
705
+ try {
706
+ this.client = new secretManager.SecretManagerServiceClient();
707
+ } catch {
708
+ this.client = null;
709
+ }
710
+ }
711
+ }
712
+ /**
713
+ * Determine whether to use Google Secret Manager in this environment
714
+ */
715
+ shouldUseGsm() {
716
+ if (process.env.MARIA_DISABLE_GSM === "true") return false;
717
+ if (process.env.GOOGLE_APPLICATION_CREDENTIALS) return true;
718
+ if (process.env.GOOGLE_CLOUD_PROJECT || process.env.GCLOUD_PROJECT) return true;
719
+ if (process.env.CLOUD_RUN_SERVICE || process.env.K_SERVICE) return true;
720
+ if (process.env.GCE_METADATA_HOST) return true;
721
+ return false;
701
722
  }
702
723
  /**
703
724
  * Get authentication configuration from Secret Manager
@@ -718,6 +739,9 @@ var init_AuthSecretManager = __esm({
718
739
  * Get a specific secret from Secret Manager
719
740
  */
720
741
  async getSecret(secretName) {
742
+ if (!this.useGsm || !this.client) {
743
+ return null;
744
+ }
721
745
  const cached = this.getCachedSecret(secretName);
722
746
  if (cached) {
723
747
  return cached;
@@ -798,7 +822,7 @@ var init_AuthSecretManager = __esm({
798
822
  if (process.env.MARIA_AUTH_BASE) {
799
823
  return process.env.MARIA_AUTH_BASE;
800
824
  }
801
- const cloudRunUrl = "https://auth-server-i227ftjidq-uc.a.run.app";
825
+ const cloudRunUrl = "https://auth.maria-code.ai";
802
826
  return cloudRunUrl;
803
827
  }
804
828
  /**
@@ -811,7 +835,7 @@ var init_AuthSecretManager = __esm({
811
835
  if (process.env.MARIA_API_BASE) {
812
836
  return process.env.MARIA_API_BASE;
813
837
  }
814
- const cloudRunApiUrl = "https://maria-code-i227ftjidq-uc.a.run.app";
838
+ const cloudRunApiUrl = "https://api.maria-code.ai";
815
839
  return cloudRunApiUrl;
816
840
  }
817
841
  };
@@ -870,7 +894,7 @@ var init_AuthenticationManager = __esm({
870
894
  if (process.env.MARIA_AUTH_MODE === "local") {
871
895
  return "http://localhost:3001";
872
896
  }
873
- const cloudRunUrl = "https://auth-server-i227ftjidq-uc.a.run.app";
897
+ const cloudRunUrl = "https://auth.maria-code.ai";
874
898
  if (process.env.MARIA_USE_CUSTOM_DOMAIN === "true") {
875
899
  return "https://auth.maria-code.ai";
876
900
  }
@@ -880,7 +904,7 @@ var init_AuthenticationManager = __esm({
880
904
  if (process.env.MARIA_AUTH_MODE === "local") {
881
905
  return "http://localhost:3000/api";
882
906
  }
883
- const cloudRunApiUrl = "https://maria-code-i227ftjidq-uc.a.run.app";
907
+ const cloudRunApiUrl = "https://api.maria-code.ai";
884
908
  if (process.env.MARIA_USE_CUSTOM_DOMAIN === "true") {
885
909
  return "https://api.maria-code.ai";
886
910
  }
@@ -1615,7 +1639,7 @@ var init_chat_context_service = __esm({
1615
1639
  maxTokens: config2?.maxTokens || 128e3,
1616
1640
  compressionThreshold: config2?.compressionThreshold || 0.8,
1617
1641
  summaryTokenLimit: config2?.summaryTokenLimit || 2e3,
1618
- persistPath: config2?.persistPath || path8__namespace.join(process.env["HOME"] || "", ".maria", "context")
1642
+ persistPath: config2?.persistPath || path10__namespace.join(process.env["HOME"] || "", ".maria", "context")
1619
1643
  };
1620
1644
  this.sessionId = this.generateSessionId();
1621
1645
  }
@@ -1735,7 +1759,7 @@ var init_chat_context_service = __esm({
1735
1759
  if (!this.config.persistPath) return;
1736
1760
  try {
1737
1761
  await fsp__namespace.mkdir(this.config.persistPath, { recursive: true });
1738
- const sessionFile = path8__namespace.join(
1762
+ const sessionFile = path10__namespace.join(
1739
1763
  this.config.persistPath,
1740
1764
  `${this.sessionId}.json`
1741
1765
  );
@@ -1794,8 +1818,8 @@ var init_conversation_persistence = __esm({
1794
1818
  autoSaveInterval = null;
1795
1819
  pendingWrites = [];
1796
1820
  constructor(maxHistorySize = 100) {
1797
- const configDir = path8__namespace.join(os__namespace.homedir(), ".maria");
1798
- this.sessionFile = path8__namespace.join(configDir, "conversation-history.json");
1821
+ const configDir = path10__namespace.join(os__namespace.homedir(), ".maria");
1822
+ this.sessionFile = path10__namespace.join(configDir, "conversation-history.json");
1799
1823
  this.maxHistorySize = maxHistorySize;
1800
1824
  this.ensureConfigDir();
1801
1825
  this.startAutoSave();
@@ -1805,7 +1829,7 @@ var init_conversation_persistence = __esm({
1805
1829
  */
1806
1830
  async ensureConfigDir() {
1807
1831
  try {
1808
- const configDir = path8__namespace.dirname(this.sessionFile);
1832
+ const configDir = path10__namespace.dirname(this.sessionFile);
1809
1833
  await fs.promises.mkdir(configDir, { recursive: true });
1810
1834
  } catch (error2) {
1811
1835
  console.warn("Failed to create config directory:", error2);
@@ -2836,22 +2860,22 @@ function dataUriToBuffer(uri) {
2836
2860
  if (firstComma === -1 || firstComma <= 4) {
2837
2861
  throw new TypeError("malformed data: URI");
2838
2862
  }
2839
- const meta5 = uri.substring(5, firstComma).split(";");
2863
+ const meta4 = uri.substring(5, firstComma).split(";");
2840
2864
  let charset = "";
2841
2865
  let base64 = false;
2842
- const type = meta5[0] || "text/plain";
2866
+ const type = meta4[0] || "text/plain";
2843
2867
  let typeFull = type;
2844
- for (let i2 = 1; i2 < meta5.length; i2++) {
2845
- if (meta5[i2] === "base64") {
2868
+ for (let i2 = 1; i2 < meta4.length; i2++) {
2869
+ if (meta4[i2] === "base64") {
2846
2870
  base64 = true;
2847
- } else if (meta5[i2]) {
2848
- typeFull += `;${meta5[i2]}`;
2849
- if (meta5[i2].indexOf("charset=") === 0) {
2850
- charset = meta5[i2].substring(8);
2871
+ } else if (meta4[i2]) {
2872
+ typeFull += `;${meta4[i2]}`;
2873
+ if (meta4[i2].indexOf("charset=") === 0) {
2874
+ charset = meta4[i2].substring(8);
2851
2875
  }
2852
2876
  }
2853
2877
  }
2854
- if (!meta5[0] && !charset.length) {
2878
+ if (!meta4[0] && !charset.length) {
2855
2879
  typeFull += ";charset=US-ASCII";
2856
2880
  charset = "US-ASCII";
2857
2881
  }
@@ -7625,22 +7649,22 @@ var init_from = __esm({
7625
7649
  init_file();
7626
7650
  init_fetch_blob();
7627
7651
  ({ stat } = fs.promises);
7628
- blobFromSync = (path12, type) => fromBlob(fs.statSync(path12), path12, type);
7629
- blobFrom = (path12, type) => stat(path12).then((stat2) => fromBlob(stat2, path12, type));
7630
- fileFrom = (path12, type) => stat(path12).then((stat2) => fromFile(stat2, path12, type));
7631
- fileFromSync = (path12, type) => fromFile(fs.statSync(path12), path12, type);
7632
- fromBlob = (stat2, path12, type = "") => new fetch_blob_default([new BlobDataItem({
7633
- path: path12,
7652
+ blobFromSync = (path14, type) => fromBlob(fs.statSync(path14), path14, type);
7653
+ blobFrom = (path14, type) => stat(path14).then((stat2) => fromBlob(stat2, path14, type));
7654
+ fileFrom = (path14, type) => stat(path14).then((stat2) => fromFile(stat2, path14, type));
7655
+ fileFromSync = (path14, type) => fromFile(fs.statSync(path14), path14, type);
7656
+ fromBlob = (stat2, path14, type = "") => new fetch_blob_default([new BlobDataItem({
7657
+ path: path14,
7634
7658
  size: stat2.size,
7635
7659
  lastModified: stat2.mtimeMs,
7636
7660
  start: 0
7637
7661
  })], { type });
7638
- fromFile = (stat2, path12, type = "") => new file_default([new BlobDataItem({
7639
- path: path12,
7662
+ fromFile = (stat2, path14, type = "") => new file_default([new BlobDataItem({
7663
+ path: path14,
7640
7664
  size: stat2.size,
7641
7665
  lastModified: stat2.mtimeMs,
7642
7666
  start: 0
7643
- })], path8.basename(path12), { type, lastModified: stat2.mtimeMs });
7667
+ })], path10.basename(path14), { type, lastModified: stat2.mtimeMs });
7644
7668
  BlobDataItem = class _BlobDataItem {
7645
7669
  #path;
7646
7670
  #start;
@@ -9445,15 +9469,36 @@ var SecretManagerIntegration;
9445
9469
  var init_SecretManagerIntegration = __esm({
9446
9470
  "src/services/intelligent-model-selector/SecretManagerIntegration.ts"() {
9447
9471
  SecretManagerIntegration = class {
9448
- // 1 hour
9449
9472
  constructor(config2) {
9450
9473
  this.config = config2;
9451
- this.client = new secretManager.SecretManagerServiceClient();
9474
+ this.useGsm = this.shouldUseGsm();
9452
9475
  }
9453
- client;
9476
+ client = null;
9454
9477
  cache = /* @__PURE__ */ new Map();
9455
9478
  cacheExpiry = /* @__PURE__ */ new Map();
9456
9479
  CACHE_TTL = 36e5;
9480
+ // 1 hour
9481
+ useGsm;
9482
+ /** Determine whether GSM should be used in this environment */
9483
+ shouldUseGsm() {
9484
+ if (process.env.MARIA_DISABLE_GSM === "true") return false;
9485
+ if (process.env.GOOGLE_APPLICATION_CREDENTIALS) return true;
9486
+ if (process.env.GOOGLE_CLOUD_PROJECT || process.env.GCLOUD_PROJECT) return true;
9487
+ if (process.env.CLOUD_RUN_SERVICE || process.env.K_SERVICE) return true;
9488
+ if (process.env.GCE_METADATA_HOST) return true;
9489
+ return false;
9490
+ }
9491
+ /** Lazily create Secret Manager client only when permitted */
9492
+ ensureClient() {
9493
+ if (!this.useGsm) return null;
9494
+ if (this.client) return this.client;
9495
+ try {
9496
+ this.client = new secretManager.SecretManagerServiceClient();
9497
+ } catch {
9498
+ this.client = null;
9499
+ }
9500
+ return this.client;
9501
+ }
9457
9502
  /**
9458
9503
  * Get API key from Secret Manager with caching
9459
9504
  */
@@ -9462,13 +9507,17 @@ var init_SecretManagerIntegration = __esm({
9462
9507
  if (!secretName) {
9463
9508
  return void 0;
9464
9509
  }
9510
+ const client = this.ensureClient();
9511
+ if (!client) {
9512
+ return this.getFallbackFromEnv(provider);
9513
+ }
9465
9514
  const cached = this.getCachedSecret(secretName);
9466
9515
  if (cached) {
9467
9516
  return cached;
9468
9517
  }
9469
9518
  try {
9470
9519
  const name2 = `projects/${this.config.projectId}/secrets/${secretName}/versions/latest`;
9471
- const [version] = await this.client.accessSecretVersion({ name: name2 });
9520
+ const [version] = await client.accessSecretVersion({ name: name2 });
9472
9521
  const payload = version.payload?.data;
9473
9522
  if (!payload) {
9474
9523
  return void 0;
@@ -9501,6 +9550,10 @@ var init_SecretManagerIntegration = __esm({
9501
9550
  * Verify that required secrets exist
9502
9551
  */
9503
9552
  async verifySecrets() {
9553
+ const client = this.ensureClient();
9554
+ if (!client) {
9555
+ return { available: [], missing: [] };
9556
+ }
9504
9557
  const available = [];
9505
9558
  const missing = [];
9506
9559
  const providers = ["google", "openai", "anthropic", "groq"];
@@ -9509,7 +9562,7 @@ var init_SecretManagerIntegration = __esm({
9509
9562
  if (!secretName) continue;
9510
9563
  try {
9511
9564
  const name2 = `projects/${this.config.projectId}/secrets/${secretName}`;
9512
- await this.client.getSecret({ name: name2 });
9565
+ await client.getSecret({ name: name2 });
9513
9566
  available.push(provider);
9514
9567
  } catch (error2) {
9515
9568
  missing.push(provider);
@@ -9525,17 +9578,21 @@ var init_SecretManagerIntegration = __esm({
9525
9578
  if (!secretName) {
9526
9579
  return false;
9527
9580
  }
9581
+ const client = this.ensureClient();
9582
+ if (!client) {
9583
+ return false;
9584
+ }
9528
9585
  const secretId = `projects/${this.config.projectId}/secrets/${secretName}`;
9529
9586
  try {
9530
9587
  let secretExists = false;
9531
9588
  try {
9532
- await this.client.getSecret({ name: secretId });
9589
+ await client.getSecret({ name: secretId });
9533
9590
  secretExists = true;
9534
9591
  } catch {
9535
9592
  secretExists = false;
9536
9593
  }
9537
9594
  if (!secretExists) {
9538
- await this.client.createSecret({
9595
+ await client.createSecret({
9539
9596
  parent: `projects/${this.config.projectId}`,
9540
9597
  secretId: secretName,
9541
9598
  secret: {
@@ -9549,7 +9606,7 @@ var init_SecretManagerIntegration = __esm({
9549
9606
  }
9550
9607
  });
9551
9608
  }
9552
- await this.client.addSecretVersion({
9609
+ await client.addSecretVersion({
9553
9610
  parent: secretId,
9554
9611
  payload: {
9555
9612
  data: Buffer.from(apiKey, "utf8")
@@ -9901,6 +9958,7 @@ var init_groq_provider = __esm({
9901
9958
  const _modelPricing = _pricing[_model] || _pricing["mixtral-8x7b-32768"];
9902
9959
  return _tokens * 0.75 * _modelPricing.input + _tokens * 0.25 * _modelPricing.output;
9903
9960
  }
9961
+ // Note: complete() and stream() methods are already implemented above (lines 105-200)
9904
9962
  };
9905
9963
  }
9906
9964
  });
@@ -10950,11 +11008,11 @@ export async function DELETE(
10950
11008
  runCommands: isJapanese ? [
10951
11009
  "Next.js \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306B\u914D\u7F6E",
10952
11010
  "pnpm dev \u3067\u30B5\u30FC\u30D0\u30FC\u8D77\u52D5",
10953
- "curl http://localhost:3000/api/users \u3067\u30C6\u30B9\u30C8"
11011
+ "curl https://maria-code.ai/api/users \u3067\u30C6\u30B9\u30C8"
10954
11012
  ] : [
10955
11013
  "Place in Next.js project",
10956
11014
  "Run server with npm run dev",
10957
- "Test with curl http://localhost:3000/api/users"
11015
+ "Test with curl https://maria-code.ai/api/users"
10958
11016
  ],
10959
11017
  notes: isJapanese ? [
10960
11018
  "App Router (Next.js 13+) \u3092\u4F7F\u7528",
@@ -11677,1033 +11735,85 @@ ${options.map((opt, i2) => `${i2 + 1}) ${opt}`).join("\n")}`;
11677
11735
  });
11678
11736
 
11679
11737
  // src/lib/command-groups.ts
11680
- function assertRegistry() {
11681
- for (const [key2, info] of Object.entries(commandInfo)) {
11682
- if (key2 !== info.name) {
11683
- throw new Error(`key/name mismatch: ${key2} !== ${info.name}`);
11684
- }
11685
- }
11686
- const brain = commandInfo["/brain"];
11687
- if (!brain?.deprecated) {
11688
- throw new Error("/brain must be deprecated");
11689
- }
11690
- for (const [alias, _info] of _ALIAS_MAP) {
11691
- if (_NAME_MAP.has(alias)) {
11692
- throw new Error(`alias conflicts with command name: ${alias}`);
11693
- }
11738
+ function getCommandInfo(command) {
11739
+ const normalizedCommand = command.startsWith("/") ? command.slice(1) : command;
11740
+ if (commandInfo[normalizedCommand]) {
11741
+ return {
11742
+ name: `/${normalizedCommand}`,
11743
+ ...commandInfo[normalizedCommand]
11744
+ };
11694
11745
  }
11695
- for (const [cat, list] of _CATEGORY_MAP) {
11696
- if (list.length === 0) {
11697
- console.warn(`category defined but unused: ${cat}`);
11746
+ for (const [key2, info] of Object.entries(commandInfo)) {
11747
+ if (info.aliases?.includes(normalizedCommand)) {
11748
+ return {
11749
+ name: `/${key2}`,
11750
+ ...info
11751
+ };
11698
11752
  }
11699
11753
  }
11754
+ return void 0;
11700
11755
  }
11701
- function getCommandInfo(commandName) {
11702
- const key2 = _keyOf(commandName.trim());
11703
- return _NAME_MAP.get(key2) ?? _ALIAS_MAP.get(key2);
11704
- }
11705
- var commandInfo, _normToken, _withSlash, _keyOf, _NAME_MAP, _ALIAS_MAP, _CATEGORY_MAP;
11756
+ var commandGroups, commandInfo;
11706
11757
  var init_command_groups = __esm({
11707
11758
  "src/lib/command-groups.ts"() {
11708
- commandInfo = {
11709
- // Core commands
11710
- "/help": {
11711
- name: "/help",
11712
- description: "Show help information and command list",
11713
- category: "core",
11714
- usage: "/help [category|command]",
11715
- examples: ["/help", "/help generation", "/help /code"]
11716
- },
11717
- "/clear": {
11718
- name: "/clear",
11719
- description: "Clear screen and conversation context",
11720
- category: "core",
11721
- usage: "/clear",
11722
- examples: ["/clear"]
11723
- },
11724
- "/exit": {
11725
- name: "/exit",
11726
- description: "Exit the application",
11727
- category: "core",
11728
- usage: "/exit",
11729
- examples: ["/exit"]
11730
- },
11731
- "/version": {
11732
- name: "/version",
11733
- description: "Show version information",
11734
- category: "core",
11735
- usage: "/version",
11736
- examples: ["/version"]
11737
- },
11738
- // Content Generation
11739
- "/code": {
11740
- name: "/code",
11741
- description: "Intelligent code operations - create, modify, fix, refactor",
11742
- category: "generation",
11743
- usage: "/code <intent> [options]",
11744
- examples: [
11745
- "/code fix errors in src/index.ts",
11746
- "/code create new service AuthService",
11747
- "/code refactor function calculateTotal to use async",
11748
- "/code add validation to user input"
11749
- ]
11750
- },
11751
- "/test": {
11752
- name: "/test",
11753
- description: "Generate tests for code",
11754
- category: "generation",
11755
- usage: "/test [file|function]",
11756
- examples: ["/test src/utils.ts", "/test calculateTotal function"]
11757
- },
11758
- "/paper": {
11759
- name: "/paper",
11760
- description: "Process research papers and generate code",
11761
- category: "generation",
11762
- usage: "/paper [content] [--source type] [--language lang]",
11763
- examples: ['/paper "Implement QuickSort algorithm"', "/paper --source pdf paper.pdf"]
11764
- },
11765
- // Multimodal Generation (Cloud-Ready)
11766
- "/image": {
11767
- name: "/image",
11768
- description: "Generate images using AI (cloud-only, FREE tier)",
11769
- category: "multimodal",
11770
- usage: "/image <prompt> [--style=realistic|artistic|cartoon] [--size=1024x1024]",
11771
- examples: ["/image sunset over mountains --style=realistic", "/image Logo design for tech company --style=artistic", "/image Abstract art --size=512x512"]
11772
- },
11773
- "/video": {
11774
- name: "/video",
11775
- description: "Generate videos using AI (cloud-only, PRO+ required)",
11776
- category: "multimodal",
11777
- usage: "/video <prompt> [--duration=5|10|15] [--style=cinematic|documentary|cartoon]",
11778
- examples: ['/video "A cat playing piano" --duration=10', '/video "Sunset timelapse" --style=cinematic']
11779
- },
11780
- "/voice": {
11781
- name: "/voice",
11782
- description: "Generate speech from text (cloud-only, STARTER+ required)",
11783
- category: "multimodal",
11784
- usage: "/voice <text> [--voice=alloy|echo|fable|nova] [--speed=0.5-2.0]",
11785
- examples: ['/voice "Hello world" --voice=nova', '/voice "Welcome to MARIA" --speed=1.2']
11786
- },
11787
- "/avatar": {
11788
- name: "/avatar",
11789
- description: "Interactive ASCII avatar",
11790
- category: "media",
11791
- usage: "/avatar",
11792
- examples: ["/avatar"]
11793
- },
11794
- // Analysis & Review
11795
- "/review": {
11796
- name: "/review",
11797
- description: "Review code or pull requests",
11798
- category: "analysis",
11799
- usage: "/review [file|url]",
11800
- examples: ["/review src/app.ts", "/review https://github.com/user/repo/pull/123"]
11801
- },
11802
- "/pr-comments": {
11803
- name: "/pr-comments",
11804
- description: "Generate PR comments",
11805
- category: "analysis",
11806
- usage: "/pr-comments [pr-url]",
11807
- examples: ["/pr-comments https://github.com/user/repo/pull/123"]
11808
- },
11809
- // Code Quality
11810
- "/bug": {
11811
- name: "/bug",
11812
- description: "AI-powered error analysis and solution recommendation system (Enhanced POC #4)",
11813
- category: "quality",
11814
- usage: '/bug "<error message>" [--from-output] [--solution-id <id>] [--dry-run] [--verbose]',
11815
- examples: [
11816
- `/bug "Property 'name' does not exist on type 'User'"`,
11817
- `/bug "Cannot read property 'id' of undefined" --file src/user.ts`,
11818
- "/bug --from-output --verbose",
11819
- "/bug --solution-id typescript-fix-0 --dry-run"
11820
- ]
11821
- },
11822
- "/lint": {
11823
- name: "/lint",
11824
- description: "ESLint analysis and auto-fix",
11825
- category: "quality",
11826
- usage: "/lint [file]",
11827
- examples: ["/lint src/app.ts", "/lint"]
11828
- },
11829
- "/typecheck": {
11830
- name: "/typecheck",
11831
- description: "TypeScript type safety analysis",
11832
- category: "quality",
11833
- usage: "/typecheck [file]",
11834
- examples: ["/typecheck src/app.ts", "/typecheck"]
11835
- },
11836
- "/security-review": {
11837
- name: "/security-review",
11838
- description: "Security vulnerability assessment",
11839
- category: "quality",
11840
- usage: "/security-review [file]",
11841
- examples: ["/security-review src/auth.ts"]
11842
- },
11843
- // Configuration & Setup
11844
- "/config": {
11845
- name: "/config",
11846
- description: "Show configuration settings",
11847
- category: "configuration",
11848
- usage: "/config [key] [value]",
11849
- examples: ["/config", "/config model gpt-4"]
11850
- },
11851
- "/init": {
11852
- name: "/init",
11853
- description: "Initialize MARIA configuration and analyze project",
11854
- category: "configuration",
11855
- usage: "/init [--force] [--scan] [--graph-rag]",
11856
- examples: ["/init", "/init --force", "/init --scan"]
11857
- },
11858
- "/setup": {
11859
- name: "/setup",
11860
- description: "First-time environment setup wizard",
11861
- category: "configuration",
11862
- usage: "/setup",
11863
- examples: ["/setup"]
11864
- },
11865
- "/settings": {
11866
- name: "/settings",
11867
- description: "Environment variable setup",
11868
- category: "configuration",
11869
- usage: "/settings",
11870
- examples: ["/settings"]
11871
- },
11872
- "/brain": {
11873
- name: "/brain",
11874
- description: "Switch between cognitive & operation modes",
11875
- category: "configuration",
11876
- usage: "/brain [mode-name]",
11877
- examples: ["/brain", "/brain creative", "/brain analytical"],
11878
- deprecated: {
11879
- since: "v2.5.0",
11880
- replacedBy: "/mode",
11881
- message: "Use /mode for switching AI modes"
11882
- },
11883
- hidden: true
11884
- // Hidden from help display
11885
- },
11886
- "/model": {
11887
- name: "/model",
11888
- description: "Interactive AI model selector",
11889
- category: "configuration",
11890
- aliases: ["/m", "/models"],
11891
- usage: "/model [list|set|info|test|benchmark|cost|current] [model-id] [options]",
11892
- examples: [
11893
- "/model",
11894
- "/model list",
11895
- "/model set claude-3-sonnet",
11896
- "/model info gpt-4"
11897
- ]
11898
- },
11899
- "/add-dir": {
11900
- name: "/add-dir",
11901
- description: "Add directory to project",
11902
- category: "configuration",
11903
- usage: "/add-dir [path]",
11904
- examples: ["/add-dir src", "/add-dir lib/utils"]
11905
- },
11906
- // Authentication
11907
- "/login": {
11908
- name: "/login",
11909
- description: "Login to services",
11910
- category: "auth",
11911
- usage: "/login [service]",
11912
- examples: ["/login", "/login github"]
11913
- },
11914
- "/logout": {
11915
- name: "/logout",
11916
- description: "Logout from services",
11917
- category: "auth",
11918
- usage: "/logout [service]",
11919
- examples: ["/logout", "/logout github"]
11920
- },
11921
- "/permissions": {
11922
- name: "/permissions",
11923
- description: "Manage permissions",
11924
- category: "auth",
11925
- usage: "/permissions [permission] [value]",
11926
- examples: ["/permissions", "/permissions fileAccess true"]
11927
- },
11928
- "/auth": {
11929
- name: "/auth",
11930
- description: "Authentication management hub",
11931
- category: "auth",
11932
- usage: "/auth [action]",
11933
- examples: ["/auth", "/auth status"]
11934
- },
11935
- "/signin": {
11936
- name: "/signin",
11937
- description: "Sign in to services (alias for /login)",
11938
- category: "auth",
11939
- usage: "/signin [service]",
11940
- examples: ["/signin", "/signin github"]
11941
- },
11942
- "/signout": {
11943
- name: "/signout",
11944
- description: "Sign out from services (alias for /logout)",
11945
- category: "auth",
11946
- usage: "/signout [service]",
11947
- examples: ["/signout", "/signout github"]
11948
- },
11949
- // Workflow Automation
11950
- "/nl": {
11951
- name: "/nl",
11952
- description: "Natural language command translation - Convert plain English to executable commands (POC)",
11953
- category: "workflow",
11954
- usage: '/nl "<natural language description>" [options]',
11955
- examples: [
11956
- '/nl "commit my changes and run tests"',
11957
- '/nl "fix typescript errors" --dry-run',
11958
- '/nl "show system status" --explain'
11959
- ]
11960
- },
11961
- "/chain": {
11962
- name: "/chain",
11963
- description: "Execute command chains",
11964
- category: "workflow",
11965
- usage: "/chain [chain-name] [--interactive]",
11966
- examples: ["/chain projectSetup", "/chain analysis --interactive"]
11967
- },
11968
- "/suggest": {
11969
- name: "/suggest",
11970
- description: "Get intelligent command suggestions",
11971
- category: "workflow",
11972
- usage: "/suggest",
11973
- examples: ["/suggest"]
11974
- },
11975
- "/alias": {
11976
- name: "/alias",
11977
- description: "Manage command aliases",
11978
- category: "workflow",
11979
- usage: "/alias [add|remove|list] [alias] [command]",
11980
- examples: ['/alias add /gs "/git status"', "/alias list"]
11981
- },
11982
- "/template": {
11983
- name: "/template",
11984
- description: "Command templates management",
11985
- category: "workflow",
11986
- usage: "/template [run|save|list] [name] [commands]",
11987
- examples: ["/template list", "/template run myTemplate"]
11988
- },
11989
- "/batch": {
11990
- name: "/batch",
11991
- description: "Execute multiple commands",
11992
- category: "workflow",
11993
- usage: "/batch [commands...]",
11994
- examples: ["/batch /status /model /config"]
11995
- },
11996
- "/hotkey": {
11997
- name: "/hotkey",
11998
- description: "Manage keyboard shortcuts",
11999
- category: "workflow",
12000
- usage: "/hotkey [add|remove|list] [key] [command]",
12001
- examples: ["/hotkey add ctrl+s /status", "/hotkey list"]
12002
- },
12003
- "/compact": {
12004
- name: "/compact",
12005
- description: "Compact session data",
12006
- category: "workflow",
12007
- usage: "/compact",
12008
- examples: ["/compact"]
12009
- },
12010
- "/resume": {
12011
- name: "/resume",
12012
- description: "Resume previous session",
12013
- category: "workflow",
12014
- usage: "/resume [session-id]",
12015
- examples: ["/resume", "/resume last"]
12016
- },
12017
- // Development Tools
12018
- "/memory": {
12019
- name: "/memory",
12020
- description: "Show memory usage statistics and health",
12021
- category: "development",
12022
- usage: "/memory",
12023
- examples: ["/memory"]
12024
- },
12025
- "/remember": {
12026
- name: "/remember",
12027
- description: "Store important information in persistent memory",
12028
- category: "memory",
12029
- usage: "/remember <content> [--tag=<tag>] [--importance=<level>]",
12030
- examples: ['/remember "API endpoint is /api/v1/users"', '/remember "Database password is in .env" --importance=high --tag=security']
12031
- },
12032
- "/recall": {
12033
- name: "/recall",
12034
- description: "Retrieve stored memories from persistent storage",
12035
- category: "memory",
12036
- usage: "/recall [query] [--tag=<tag>] [--limit=<n>]",
12037
- examples: ["/recall API", "/recall --tag=security", "/recall database --limit=5"]
12038
- },
12039
- "/forget": {
12040
- name: "/forget",
12041
- description: "Remove memories from persistent storage",
12042
- category: "memory",
12043
- usage: "/forget <pattern> [--tag=<tag>] [--older-than=<days>] [--confirm]",
12044
- examples: ['/forget "old data"', "/forget --tag=temp --confirm", "/forget --older-than=30 --confirm"]
12045
- },
12046
- "/memory-status": {
12047
- name: "/memory-status",
12048
- description: "Show memory usage statistics and health",
12049
- category: "memory",
12050
- aliases: ["/mem-status"],
12051
- usage: "/memory-status",
12052
- examples: ["/memory-status"]
12053
- },
12054
- "/export": {
12055
- name: "/export",
12056
- description: "Export project data",
12057
- category: "development",
12058
- usage: "/export [format] [--clipboard]",
12059
- examples: ["/export json", "/export --clipboard"]
12060
- },
12061
- // Learning & Training
12062
- "/l2r": {
12063
- name: "/l2r",
12064
- description: "Learning-to-Rank operations with 44-dimension feature system *GPU needed - Local LLM only (Pro+ members only)",
12065
- category: "learning",
12066
- aliases: ["/ltr", "/rank", "/learn"],
12067
- usage: "/l2r [train|predict|status|features|explain] [options]",
12068
- examples: [
12069
- "/l2r status",
12070
- "/l2r train --interactions 1000",
12071
- '/l2r predict "API documentation security"',
12072
- "/l2r features --top 10 --category semantic"
12073
- ]
12074
- },
12075
- // GraphRAG Operations
12076
- "/search": {
12077
- name: "/search",
12078
- description: "GraphRAG-powered semantic search across codebase *GPU needed - Local LLM only (Pro+ members only)",
12079
- category: "graphrag",
12080
- usage: "/search <query> [--limit=<n>] [--threshold=<score>]",
12081
- examples: [
12082
- '/search "authentication implementation"',
12083
- '/search "database connection" --limit 5',
12084
- '/search "error handling" --threshold 0.8'
12085
- ]
12086
- },
12087
- // Language Operations
12088
- "/language": {
12089
- name: "/language",
12090
- description: "Multilingual operations and translation",
12091
- category: "multimodal",
12092
- usage: "/language [translate|detect|switch] [options]",
12093
- examples: [
12094
- '/language translate "Hello world" --to=ja',
12095
- '/language detect "Bonjour le monde"',
12096
- "/language switch ja"
12097
- ]
12098
- },
12099
- // File Operations
12100
- "/save": {
12101
- name: "/save",
12102
- description: "Save last AI response to a file",
12103
- category: "file",
12104
- aliases: ["/write"],
12105
- usage: "/save <filename>",
12106
- examples: ["/save tetris.html", "/save code.js", "/save output.txt"]
12107
- },
12108
- "/saveto": {
12109
- name: "/saveto",
12110
- description: "Save response to specified directory",
12111
- category: "file",
12112
- aliases: ["/writeto"],
12113
- usage: "/saveto <path/to/filename>",
12114
- examples: ["/saveto ~/Documents/code.js", "/saveto ./output/report.md"]
12115
- },
12116
- "/hooks": {
12117
- name: "/hooks",
12118
- description: "Manage Git hooks integration",
12119
- category: "development",
12120
- usage: "/hooks [list|add|remove]",
12121
- examples: ["/hooks list", "/hooks add pre-commit"]
12122
- },
12123
- "/terminal-setup": {
12124
- name: "/terminal-setup",
12125
- description: "Setup terminal integration",
12126
- category: "development",
12127
- usage: "/terminal-setup",
12128
- examples: ["/terminal-setup"]
12129
- },
12130
- "/vim": {
12131
- name: "/vim",
12132
- description: "Vim editor integration",
12133
- category: "development",
12134
- usage: "/vim [file]",
12135
- examples: ["/vim src/app.ts", "/vim"]
12136
- },
12137
- "/release-notes": {
12138
- name: "/release-notes",
12139
- description: "Generate release notes",
12140
- category: "development",
12141
- usage: "/release-notes [version]",
12142
- examples: ["/release-notes v1.2.0", "/release-notes"]
12143
- },
12144
- // Integration
12145
- "/agents": {
12146
- name: "/agents",
12147
- description: "Manage AI agents",
12148
- category: "integration",
12149
- usage: "/agents [list|start|stop] [agent-name]",
12150
- examples: ["/agents list", "/agents start codeReview"]
12151
- },
12152
- "/mcp": {
12153
- name: "/mcp",
12154
- description: "MCP integrations",
12155
- category: "integration",
12156
- usage: "/mcp [status|start|stop] [server]",
12157
- examples: ["/mcp status", "/mcp start myServer"]
12158
- },
12159
- "/migrate-installer": {
12160
- name: "/migrate-installer",
12161
- description: "Migrate installer configuration",
12162
- category: "integration",
12163
- usage: "/migrate-installer",
12164
- examples: ["/migrate-installer"]
12165
- },
12166
- // System & Diagnostics (Enhanced)
12167
- "/status": {
12168
- name: "/status",
12169
- description: "System health monitoring with API connectivity checks",
12170
- category: "system",
12171
- usage: "/status [--json] [--exit-code]",
12172
- examples: ["/status", "/status --json", "/status --exit-code"]
12173
- },
12174
- "/doctor": {
12175
- name: "/doctor",
12176
- description: "Comprehensive system diagnostics with actionable fixes",
12177
- category: "system",
12178
- usage: "/doctor [--verbose] [--fix]",
12179
- examples: ["/doctor", "/doctor --verbose", "/doctor --fix"]
12180
- },
12181
- "/cost": {
12182
- name: "/cost",
12183
- description: "Show usage costs",
12184
- category: "system",
12185
- usage: "/cost",
12186
- examples: ["/cost"]
12187
- },
12188
- "/upgrade": {
12189
- name: "/upgrade",
12190
- description: "Upgrade MARIA to latest version",
12191
- category: "system",
12192
- usage: "/upgrade",
12193
- examples: ["/upgrade"]
12194
- },
12195
- "/shell": {
12196
- name: "/shell",
12197
- description: "Execute natural language shell operations safely (Phase B: with patch support)",
12198
- category: "system",
12199
- aliases: ["/sh"],
12200
- usage: '/shell "<natural language instruction>" [--dry] [--phase B]',
12201
- examples: [
12202
- '/shell "show README file"',
12203
- '/shell "list TypeScript files in src"',
12204
- '/shell "search for TODO in package.json"',
12205
- '/shell "find all .md files" --dry',
12206
- `/shell "replace 'old' with 'new' in test.txt" --phase B`
12207
- ]
12208
- },
12209
- "/approval": {
12210
- name: "/approval",
12211
- description: "Review and approve pending patch operations (Phase B)",
12212
- category: "system",
12213
- aliases: ["/approve"],
12214
- usage: "/approval [--auto] [--colorize] [--line-numbers]",
12215
- examples: [
12216
- "/approval",
12217
- "/approval --auto",
12218
- "/approval --colorize --line-numbers"
12219
- ]
12220
- },
12221
- // Math and Computational Commands
12222
- "/calc": {
12223
- name: "/calc",
12224
- description: "Calculate mathematical expressions safely without eval()",
12225
- category: "development",
12226
- aliases: [],
12227
- usage: '/calc "<expression>" [--vars <variables>]',
12228
- examples: [
12229
- '/calc "2 + 3 * 4"',
12230
- '/calc "sin(pi/4) + cos(pi/4)"',
12231
- '/calc "sqrt(x^2 + y^2)" --vars x=3 y=4'
12232
- ]
12233
- },
12234
- "/solve": {
12235
- name: "/solve",
12236
- description: "Solve equations and systems of equations using numerical methods",
12237
- category: "development",
12238
- aliases: [],
12239
- usage: '/solve "<equation>" [--vars <variables>] [--x0 <initial>]',
12240
- examples: [
12241
- '/solve "x^2 - 4" --vars x --x0 2',
12242
- '/solve "x^2 + y^2 - 25" "x + y - 7" --vars x y'
12243
- ]
12244
- },
12245
- "/plot": {
12246
- name: "/plot",
12247
- description: "Plot and visualize mathematical functions",
12248
- category: "development",
12249
- aliases: [],
12250
- usage: '/plot "<function>" [--range <min> <max>] [--svg <file>]',
12251
- examples: [
12252
- '/plot "sin(x)" --range -3 3',
12253
- '/plot "x^2 - 4*x + 3" --range -2 6 --svg output.svg'
12254
- ]
12255
- },
12256
- // Performance Optimization Commands
12257
- "/benchmark": {
12258
- name: "/benchmark",
12259
- description: "Performance analysis and benchmarking",
12260
- category: "optimization",
12261
- usage: "/benchmark [code] [--options]",
12262
- examples: [
12263
- "/benchmark quicksort",
12264
- '/benchmark compare "bubble sort" vs "merge sort"',
12265
- "/benchmark --profile complex-algorithm"
12266
- ]
12267
- },
12268
- // Creative Tools Commands
12269
- "/diagram": {
12270
- name: "/diagram",
12271
- description: "Generate visual diagrams and charts",
12272
- category: "creative",
12273
- usage: "/diagram [type] [description]",
12274
- examples: [
12275
- "/diagram flowchart login process",
12276
- "/diagram architecture microservices",
12277
- "/diagram er user database",
12278
- "/diagram sequence API request"
12279
- ]
12280
- },
12281
- // Implementation Utilities Commands
12282
- "/snippet": {
12283
- name: "/snippet",
12284
- description: "Code snippet management",
12285
- category: "implementation",
12286
- usage: "/snippet [command] [args]",
12287
- examples: [
12288
- '/snippet save "quicksort" "function quicksort..."',
12289
- "/snippet search authentication",
12290
- "/snippet list --tags=react",
12291
- "/snippet export ./my-snippets.json"
12292
- ]
12293
- },
12294
- // GPU Management Commands
12295
- "/gpu": {
12296
- name: "/gpu",
12297
- description: "\u{1F3AE} GPU management and monitoring for AI acceleration *GPU needed - Local LLM only (Pro+ members only)",
12298
- category: "ai",
12299
- aliases: ["/graphics", "/device"],
12300
- usage: "/gpu [status|benchmark|devices|memory] [options]",
12301
- examples: [
12302
- "/gpu status",
12303
- "/gpu benchmark",
12304
- "/gpu devices",
12305
- "/gpu memory"
12306
- ]
12307
- },
12308
- // LLM Management Commands - Phase 10 v2.0
12309
- "/llm": {
12310
- name: "/llm",
12311
- description: "Advanced LLM management and model operations *GPU needed - Local LLM only (Pro+ members only)",
12312
- category: "ai",
12313
- usage: "/llm <command> [options]",
12314
- examples: [
12315
- "/llm list",
12316
- "/llm use gpt-oss-20b",
12317
- "/llm bench --detailed",
12318
- "/llm coop run --iterations 5",
12319
- "/llm studio status"
12320
- ]
12321
- },
12322
- // RL Evolution Commands
12323
- "/evolve": {
12324
- name: "/evolve",
12325
- description: "Autonomous system evolution and optimization controls *GPU needed - Local LLM only (Pro+ members only)",
12326
- category: "evolution",
12327
- aliases: ["/evolution", "/auto-evolve"],
12328
- usage: "/evolve <on|off|status|plan|history|revert|approve|reject> [options]",
12329
- examples: [
12330
- "/evolve on nightly",
12331
- "/evolve status",
12332
- "/evolve plan",
12333
- "/evolve history 30",
12334
- "/evolve approve approval_123",
12335
- "/evolve revert v1.0.5",
12336
- "/evolve run canary",
12337
- "/evolve off"
12338
- ]
12339
- },
12340
- // Real-time Monitoring Commands
12341
- "/monitor": {
12342
- name: "/monitor",
12343
- description: "Start real-time monitoring dashboard",
12344
- category: "monitoring",
12345
- usage: "/monitor [options]",
12346
- examples: [
12347
- "/monitor --format ascii --refresh 5",
12348
- "/monitor system --template system-overview",
12349
- "/monitor --port 3001 --auth"
12350
- ]
12351
- },
12352
- "/dashboard": {
12353
- name: "/dashboard",
12354
- description: "Create and manage monitoring dashboards",
12355
- category: "monitoring",
12356
- aliases: ["/dash"],
12357
- usage: "/dashboard <action> [options]",
12358
- examples: [
12359
- "/dashboard create --template system-overview",
12360
- "/dashboard list",
12361
- "/dashboard show my-dashboard --format html",
12362
- "/dashboard export my-dashboard"
12363
- ]
12364
- },
12365
- "/stream": {
12366
- name: "/stream",
12367
- description: "Manage real-time data streams",
12368
- category: "monitoring",
12369
- usage: "/stream <action> [channel] [options]",
12370
- examples: [
12371
- "/stream start system:metrics",
12372
- "/stream list",
12373
- "/stream subscribe app:logs --filter error",
12374
- "/stream stop system:metrics"
12375
- ]
12376
- },
12377
- "/chart": {
12378
- name: "/chart",
12379
- description: "Create and display charts from data",
12380
- category: "monitoring",
12381
- usage: "/chart <type> [data] [options]",
12382
- examples: [
12383
- '/chart line --data "./metrics.json" --format ascii',
12384
- '/chart bar --data "cpu,memory,disk" --format html',
12385
- "/chart gauge system.cpu --threshold 80"
12386
- ]
12387
- },
12388
- "/templates": {
12389
- name: "/templates",
12390
- description: "Manage dashboard templates",
12391
- category: "monitoring",
12392
- usage: "/templates <action> [options]",
12393
- examples: [
12394
- "/templates list",
12395
- "/templates show system-overview",
12396
- "/templates create --name my-template",
12397
- "/templates generate --from-data metrics.json"
12398
- ]
12399
- },
12400
- // AI Coding Agent Commands
12401
- "/create-feature": {
12402
- name: "/create-feature",
12403
- description: "Generate complete feature with all necessary files and folders",
12404
- category: "coding-agent",
12405
- usage: "/create-feature [feature-description]",
12406
- examples: [
12407
- '/create-feature "user authentication"',
12408
- '/create-feature "shopping cart functionality"',
12409
- '/create-feature "file upload system"'
12410
- ]
12411
- },
12412
- "/setup-project": {
12413
- name: "/setup-project",
12414
- description: "Automatically setup project structure and dependencies",
12415
- category: "coding-agent",
12416
- usage: "/setup-project [project-type]",
12417
- examples: [
12418
- '/setup-project "react-typescript"',
12419
- '/setup-project "node-express-api"',
12420
- '/setup-project "python-flask"'
12421
- ]
12422
- },
12423
- "/auto-organize": {
12424
- name: "/auto-organize",
12425
- description: "Automatically organize files and folders following best practices",
12426
- category: "coding-agent",
12427
- usage: "/auto-organize [--dry-run]",
12428
- examples: [
12429
- "/auto-organize",
12430
- "/auto-organize --dry-run"
12431
- ]
12432
- },
12433
- "/generate-docs": {
12434
- name: "/generate-docs",
12435
- description: "Generate comprehensive documentation for the project",
12436
- category: "coding-agent",
12437
- usage: "/generate-docs [--type] [--format]",
12438
- examples: [
12439
- "/generate-docs",
12440
- "/generate-docs --type api",
12441
- "/generate-docs --format markdown"
12442
- ]
12443
- },
12444
- "/optimize-structure": {
12445
- name: "/optimize-structure",
12446
- description: "Analyze and optimize project structure for better maintainability",
12447
- category: "coding-agent",
12448
- usage: "/optimize-structure [--suggestions] [--apply]",
12449
- examples: [
12450
- "/optimize-structure",
12451
- "/optimize-structure --suggestions",
12452
- "/optimize-structure --apply"
12453
- ]
12454
- },
12455
- // Business Operations (Enhanced)
12456
- "/battlecard": {
12457
- name: "/battlecard",
12458
- description: "Generate competitive battlecards with talk scripts (PRO+ required)",
12459
- category: "business",
12460
- usage: "/battlecard --competitor <name> [--customer <company>] [--industry <type>] [--size <enterprise|mid-market|smb>]",
12461
- examples: [
12462
- '/battlecard --competitor "CompetitorX"',
12463
- '/battlecard -c "CompetitorY" --customer "ABC Manufacturing" --industry manufacturing',
12464
- '/battlecard -c "CompetitorZ" --size enterprise'
12465
- ]
12466
- },
12467
- "/tune": {
12468
- name: "/tune",
12469
- description: "Natural language reward tuning - Optimize AI agent behavior patterns",
12470
- category: "business",
12471
- usage: '/tune "<adjustment_description>" [options]',
12472
- examples: [
12473
- '/tune "Prioritize customer relationship building to improve sales"',
12474
- '/tune "Focus on cost reduction while maintaining quality" --intensity high',
12475
- "/tune --metric conversion_rate --direction increase --scope team"
12476
- ]
12477
- },
12478
- "/sales-dashboard": {
12479
- name: "/sales-dashboard",
12480
- description: "Interactive TUI sales dashboard with real-time updates (STARTER+ required)",
12481
- category: "business",
12482
- usage: "/sales-dashboard [--profile=executive|manager|rep] [--theme=light|dark] [--format=tui|json|slack]",
12483
- examples: [
12484
- "/sales-dashboard",
12485
- "/sales-dashboard --profile executive --theme light",
12486
- "/sales-dashboard --format json",
12487
- "/sales-dashboard --format slack"
12488
- ]
12489
- },
12490
- "/pilot-setup": {
12491
- name: "/pilot-setup",
12492
- description: "Sales team pilot setup - Supports 5-person teams",
12493
- category: "business",
12494
- usage: "/pilot-setup [action] [options]",
12495
- examples: [
12496
- "/pilot-setup template",
12497
- "/pilot-setup setup --config ./pilot-config.json",
12498
- "/pilot-setup onboard --pilot-id pilot_123 --member-id member_001",
12499
- "/pilot-setup start --pilot-id pilot_123"
12500
- ]
12501
- },
12502
- // Project Management Commands
12503
- "/pm": {
12504
- name: "/pm",
12505
- description: "Project Management Suite - SOW and Gantt chart generation from natural language",
12506
- category: "business",
12507
- usage: "/pm <command> [options]",
12508
- examples: [
12509
- "/pm analyze --source all --days 30",
12510
- '/pm sow "Improve search latency by 20% with GPU acceleration"',
12511
- "/pm gantt --sow docs/SOW_AUTO.md --ics out/schedule.ics",
12512
- "/pm update --since 2025-08-01 --create-pr",
12513
- "/pm export --format mermaid"
12514
- ]
12515
- },
12516
- "/pm analyze": {
12517
- name: "/pm analyze",
12518
- description: "Analyze repository for PM insights (WBS, risks, dependencies)",
12519
- category: "business",
12520
- usage: "/pm analyze [--source repo|issues|notes|all] [--days N] [--json]",
12521
- examples: [
12522
- "/pm analyze",
12523
- "/pm analyze --source issues --days 7",
12524
- "/pm analyze --json > analysis.json"
12525
- ]
12526
- },
12527
- "/pm sow": {
12528
- name: "/pm sow",
12529
- description: "Generate Statement of Work from natural language description",
12530
- category: "business",
12531
- usage: '/pm sow "<description>" [--out path]',
12532
- examples: [
12533
- '/pm sow "Implement GPU acceleration for search reranking"',
12534
- '/pm sow "Improve API latency by 20%" --out docs/Q4_SOW.md'
12535
- ]
12536
- },
12537
- "/pm gantt": {
12538
- name: "/pm gantt",
12539
- description: "Generate Mermaid Gantt chart and optional ICS calendar from SOW",
12540
- category: "business",
12541
- usage: "/pm gantt [--sow path] [--out path] [--ics path]",
12542
- examples: [
12543
- "/pm gantt",
12544
- "/pm gantt --sow docs/SOW_Q4.md --ics out/timeline.ics"
12545
- ]
12546
- },
12547
- "/pm update": {
12548
- name: "/pm update",
12549
- description: "Update SOW/Gantt with recent repository changes",
12550
- category: "business",
12551
- usage: "/pm update [--since date] [--create-pr]",
12552
- examples: [
12553
- "/pm update --since 2025-08-01",
12554
- "/pm update --create-pr"
12555
- ]
12556
- },
12557
- "/pm export": {
12558
- name: "/pm export",
12559
- description: "Export PM artifacts in various formats (mermaid, ics, json)",
12560
- category: "business",
12561
- usage: "/pm export --format <format> [--out path]",
12562
- examples: [
12563
- "/pm export --format mermaid",
12564
- "/pm export --format ics --out calendar.ics",
12565
- "/pm export --format json"
12566
- ]
12567
- },
12568
- // System Update Commands
12569
- "/update": {
12570
- name: "/update",
12571
- description: "Update project dependencies, configurations, and system components",
12572
- category: "configuration",
12573
- usage: "/update [target] [options]",
12574
- examples: [
12575
- "/update",
12576
- "/update --deps",
12577
- "/update --config",
12578
- "/update --system"
12579
- ]
12580
- },
12581
- // Design System Commands
12582
- "/design": {
12583
- name: "/design",
12584
- description: "Design System Suite - Creative brief, analysis, and asset generation",
12585
- category: "creative",
12586
- usage: "/design <command> [options]",
12587
- examples: [
12588
- '/design brief "Modern B2B SaaS landing page"',
12589
- "/design analyze --brand ./brand.md --competitor ./competitors.txt",
12590
- "/design web --profile=landing --a11y --perf",
12591
- "/design wireframe --pages Home,Pricing,Contact"
12592
- ]
12593
- },
12594
- "/design brief": {
12595
- name: "/design brief",
12596
- description: "Generate creative brief from natural language prompt",
12597
- category: "creative",
12598
- usage: '/design brief "<description>"',
12599
- examples: [
12600
- '/design brief "Professional B2B SaaS landing page"',
12601
- '/design brief "Minimal e-commerce product showcase"'
12602
- ]
12603
- },
12604
- "/design analyze": {
12605
- name: "/design analyze",
12606
- description: "Analyze brand guidelines and competitor designs",
12607
- category: "creative",
12608
- usage: "/design analyze [--brand path] [--competitor path]",
12609
- examples: [
12610
- "/design analyze --brand ./brand-guide.md",
12611
- "/design analyze --competitor ./competitors.txt",
12612
- "/design analyze --brand ./brand.md --competitor ./competitors.txt"
12613
- ]
12614
- },
12615
- "/design web": {
12616
- name: "/design web",
12617
- description: "Generate Web SOW with accessibility and performance options",
12618
- category: "creative",
12619
- usage: "/design web [--profile type] [--a11y] [--perf] [--out path]",
12620
- examples: [
12621
- "/design web --profile=landing --a11y --perf",
12622
- "/design web --profile=site --out ./docs/web-sow.md"
12623
- ]
12624
- },
12625
- // POC Commands (Production Ready)
12626
- "/nl-poc": {
12627
- name: "/nl-poc",
12628
- description: "Natural Language Command Translation (POC #1) - Production ready with 0.2ms response time",
12629
- category: "workflow",
12630
- usage: '/nl-poc "<natural language description>" [options]',
12631
- examples: [
12632
- '/nl-poc "commit my changes and run tests"',
12633
- '/nl-poc "fix typescript errors" --dry-run',
12634
- '/nl-poc "show system status" --explain --verbose'
12635
- ]
12636
- },
12637
- "/bug-poc": {
12638
- name: "/bug-poc",
12639
- description: "AI-powered error analysis and solution system (POC #4) - 80% accuracy, 0.2ms response time",
12640
- category: "quality",
12641
- usage: '/bug-poc "<error message>" [options]',
12642
- examples: [
12643
- `/bug-poc "Property 'name' does not exist on type 'User'"`,
12644
- `/bug-poc "Cannot read property 'id' of undefined" --file src/user.ts`,
12645
- "/bug-poc --from-output --verbose",
12646
- "/bug-poc --solution-id typescript-fix-0 --dry-run"
12647
- ]
12648
- },
12649
- // Intelligence System Commands
12650
- "/intelligence-dashboard": {
12651
- name: "/intelligence-dashboard",
12652
- description: "Start real-time MARIA Intelligence monitoring dashboard",
12653
- category: "intelligence",
12654
- usage: "/intelligence-dashboard [--format=ascii|html|json] [--duration=<minutes>] [--export=<file>]",
12655
- examples: [
12656
- "/intelligence-dashboard",
12657
- "/intelligence-dashboard --format html --export report.html",
12658
- "/intelligence-dashboard --duration 5 --format ascii"
12659
- ]
12660
- },
12661
- "/canary": {
12662
- name: "/canary",
12663
- description: "Manage MARIA Intelligence canary deployments for zero-downtime releases",
12664
- category: "intelligence",
12665
- usage: "/canary <action> [options]",
12666
- examples: [
12667
- "/canary deploy v4.2.0 --traffic 20 --duration 15",
12668
- "/canary status",
12669
- "/canary stop",
12670
- "/canary test"
12671
- ]
12672
- },
12673
- "/quality-gate": {
12674
- name: "/quality-gate",
12675
- description: "Run MARIA Intelligence quality gate validation with automated testing",
12676
- category: "intelligence",
12677
- usage: "/quality-gate [--threshold=<score>] [--verbose] [--report=<file>]",
12678
- examples: [
12679
- "/quality-gate",
12680
- "/quality-gate --threshold 85 --verbose",
12681
- "/quality-gate --report results.json"
12682
- ]
12683
- }
11759
+ commandGroups = {
11760
+ core: [
11761
+ "about",
11762
+ "changelog",
11763
+ "config",
11764
+ "contact",
11765
+ "doctor",
11766
+ "examples",
11767
+ "help",
11768
+ "history",
11769
+ "list",
11770
+ "logout",
11771
+ "model",
11772
+ "ping",
11773
+ "plan",
11774
+ "plugins",
11775
+ "status",
11776
+ "tutorial",
11777
+ "usage",
11778
+ "verify",
11779
+ "version"
11780
+ ],
11781
+ auth: ["login", "logout", "whoami"],
11782
+ code: ["code", "mm", "multimodal"],
11783
+ configuration: ["config", "hooks", "model", "permissions", "settings", "theme"],
11784
+ multimodal: ["face", "image", "mm", "multimodal", "screenshot", "video", "voice"],
11785
+ evolution: ["benchmark", "evolve", "quality"],
11786
+ memory: ["forget", "memory", "recall", "remember"],
11787
+ analysis: ["analyze", "diagram", "diff", "visualize"],
11788
+ system: ["doctor", "health", "manifest", "selftest"],
11789
+ workflow: ["nl", "nl-poc"],
11790
+ safety: ["check"],
11791
+ evaluation: ["run"],
11792
+ assistant: ["ask", "chat", "think"],
11793
+ data: ["db", "export", "import", "sync"],
11794
+ utilities: ["alias", "clear", "history", "reset"],
11795
+ experimental: ["preview", "test"],
11796
+ business: ["battlecard", "sales-dashboard", "tune", "pilot-setup"],
11797
+ plugins: ["plugins"],
11798
+ search: ["search"],
11799
+ enterprise: ["admin", "audit", "compliance", "security"],
11800
+ development: ["debug", "profile", "trace"]
12684
11801
  };
12685
- _normToken = (s2) => s2.trim().toLowerCase();
12686
- _withSlash = (s2) => s2.startsWith("/") ? s2 : `/${s2}`;
12687
- _keyOf = (s2) => _withSlash(_normToken(s2));
12688
- _NAME_MAP = /* @__PURE__ */ new Map();
12689
- _ALIAS_MAP = /* @__PURE__ */ new Map();
12690
- _CATEGORY_MAP = /* @__PURE__ */ new Map();
12691
- (function buildIndexes() {
12692
- for (const key2 of Object.keys(commandInfo)) {
12693
- const info = commandInfo[key2];
12694
- const canonical = _withSlash(info.name || key2);
12695
- _NAME_MAP.set(_keyOf(canonical), info);
12696
- const arr = _CATEGORY_MAP.get(info.category) ?? [];
12697
- arr.push(info);
12698
- _CATEGORY_MAP.set(info.category, arr);
12699
- if (info.aliases?.length) {
12700
- for (const a2 of info.aliases) {
12701
- _ALIAS_MAP.set(_keyOf(a2), info);
12702
- }
12703
- }
12704
- }
12705
- assertRegistry();
12706
- })();
11802
+ Object.values(commandGroups).flat();
11803
+ commandInfo = {};
11804
+ for (const [category, commands] of Object.entries(commandGroups)) {
11805
+ for (const command of commands) {
11806
+ commandInfo[command] = {
11807
+ name: `/${command}`,
11808
+ category
11809
+ };
11810
+ }
11811
+ }
11812
+ commandInfo["model"] = { ...commandInfo["model"], aliases: ["/m", "/models"] };
11813
+ commandInfo["memory"] = { ...commandInfo["memory"], aliases: ["/mem"] };
11814
+ commandInfo["login"] = { ...commandInfo["login"], aliases: ["/signin"] };
11815
+ commandInfo["logout"] = { ...commandInfo["logout"], aliases: ["/signout"] };
11816
+ commandInfo["evolve"] = { ...commandInfo["evolve"], aliases: ["/evolution", "/auto-evolve"] };
12707
11817
  }
12708
11818
  });
12709
11819
  var AutocompleteDropdown;
@@ -12796,8 +11906,11 @@ var init_autocomplete_dropdown = __esm({
12796
11906
  const isSelected = index === this.selectedIndex;
12797
11907
  const prefix = isSelected ? chalk17__default.default.cyan("\u25BA ") : " ";
12798
11908
  const nameStyle = isSelected ? chalk17__default.default.inverse : (s2) => s2;
12799
- const displayName = suggestion.name.padEnd(20);
12800
- const displayDesc = suggestion.description.length > 30 ? suggestion.description.substring(0, 27) + "..." : suggestion.description.padEnd(30);
11909
+ const safeName = (suggestion?.name ?? "").toString();
11910
+ const safeDescRaw = suggestion?.description ?? "";
11911
+ const safeDesc = typeof safeDescRaw === "string" ? safeDescRaw : String(safeDescRaw ?? "");
11912
+ const displayName = safeName.padEnd(20);
11913
+ const displayDesc = safeDesc.length > 30 ? safeDesc.substring(0, 27) + "..." : safeDesc.padEnd(30);
12801
11914
  const line = `\u2502${prefix}${nameStyle(chalk17__default.default.white(displayName) + " " + chalk17__default.default.gray(displayDesc))} \u2502`;
12802
11915
  process.stdout.write("\x1B[K" + line + "\n");
12803
11916
  });
@@ -13007,7 +12120,7 @@ var init_interactive_cli = __esm({
13007
12120
  */
13008
12121
  async loadConfiguration() {
13009
12122
  try {
13010
- const configPath = path8__namespace.default.join(os__namespace.default.homedir(), ".maria", "config.json");
12123
+ const configPath = path10__namespace.default.join(os__namespace.default.homedir(), ".maria", "config.json");
13011
12124
  const content = await fsp__namespace.default.readFile(configPath, "utf-8");
13012
12125
  return JSON.parse(content);
13013
12126
  } catch {
@@ -13851,8 +12964,8 @@ ${this.description}
13851
12964
  var DIR, FILE, QuickPersistence;
13852
12965
  var init_quick_persistence = __esm({
13853
12966
  "src/services/memory-system/quick-persistence.ts"() {
13854
- DIR = path8__namespace.join(os__namespace.homedir(), ".maria", "memory");
13855
- FILE = path8__namespace.join(DIR, "memories.jsonl");
12967
+ DIR = path10__namespace.join(os__namespace.homedir(), ".maria", "memory");
12968
+ FILE = path10__namespace.join(DIR, "memories.jsonl");
13856
12969
  QuickPersistence = class {
13857
12970
  static async init() {
13858
12971
  await fsp__namespace.mkdir(DIR, { recursive: true });
@@ -13974,8 +13087,8 @@ var init_quick_persistence = __esm({
13974
13087
  const mine = rows.filter((r2) => r2.userId === userId);
13975
13088
  const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
13976
13089
  const filename = `maria-memory-export-${timestamp}.${format}`;
13977
- const exportDir = path8__namespace.join(os__namespace.homedir(), ".maria", "exports");
13978
- const exportPath = path8__namespace.join(exportDir, filename);
13090
+ const exportDir = path10__namespace.join(os__namespace.homedir(), ".maria", "exports");
13091
+ const exportPath = path10__namespace.join(exportDir, filename);
13979
13092
  await fsp__namespace.mkdir(exportDir, { recursive: true });
13980
13093
  if (format === "jsonl") {
13981
13094
  await fsp__namespace.writeFile(
@@ -14062,11 +13175,41 @@ async function loadBigQuery() {
14062
13175
  }
14063
13176
  return BigQuery;
14064
13177
  }
14065
- var BigQuery, bigQueryLoadAttempted, BigQueryTelemetryService, bigQueryTelemetry;
13178
+ async function loadFirebaseAdmin() {
13179
+ if (firebaseLoadAttempted) return { adminFirestore, FieldValue, Timestamp };
13180
+ firebaseLoadAttempted = true;
13181
+ try {
13182
+ const firebaseAdminModule = await import('firebase-admin/app');
13183
+ const firestoreModule = await import('firebase-admin/firestore');
13184
+ const keyPath = path10__namespace.join(process.cwd(), "config", "maria-cli-firestore-key.json");
13185
+ if (!adminApp && firebaseAdminModule.getApps().length === 0) {
13186
+ adminApp = firebaseAdminModule.initializeApp({
13187
+ credential: firebaseAdminModule.cert(keyPath),
13188
+ projectId: "maria-code-470602"
13189
+ });
13190
+ } else if (firebaseAdminModule.getApps().length > 0) {
13191
+ adminApp = firebaseAdminModule.getApps()[0];
13192
+ }
13193
+ if (adminApp) {
13194
+ adminFirestore = firestoreModule.getFirestore(adminApp);
13195
+ FieldValue = firestoreModule.FieldValue;
13196
+ Timestamp = firestoreModule.Timestamp;
13197
+ }
13198
+ } catch (error2) {
13199
+ console.warn("[Firestore] Firebase Admin not available for CLI telemetry:", error2.message);
13200
+ }
13201
+ return { adminFirestore, FieldValue, Timestamp };
13202
+ }
13203
+ var BigQuery, bigQueryLoadAttempted, adminApp, adminFirestore, FieldValue, Timestamp, firebaseLoadAttempted, BigQueryTelemetryService, bigQueryTelemetry;
14066
13204
  var init_bigquery_telemetry = __esm({
14067
13205
  "src/services/telemetry/bigquery-telemetry.ts"() {
14068
13206
  BigQuery = null;
14069
13207
  bigQueryLoadAttempted = false;
13208
+ adminApp = null;
13209
+ adminFirestore = null;
13210
+ FieldValue = null;
13211
+ Timestamp = null;
13212
+ firebaseLoadAttempted = false;
14070
13213
  BigQueryTelemetryService = class _BigQueryTelemetryService extends events.EventEmitter {
14071
13214
  static instance;
14072
13215
  bigquery = null;
@@ -14134,6 +13277,9 @@ var init_bigquery_telemetry = __esm({
14134
13277
  args: data2.args?.slice(0, 3)
14135
13278
  };
14136
13279
  this.telemetryQueue.push(telemetryData);
13280
+ this.syncToFirestore(telemetryData).catch((error2) => {
13281
+ console.warn("[Firestore Sync] Failed:", error2.message);
13282
+ });
14137
13283
  this.emit("command:tracked", telemetryData);
14138
13284
  if (this.telemetryQueue.length >= this.config.batchSize) {
14139
13285
  await this.flush();
@@ -14223,6 +13369,48 @@ var init_bigquery_telemetry = __esm({
14223
13369
  throw new Error(`HTTP flush failed: ${response2.status}`);
14224
13370
  }
14225
13371
  }
13372
+ /**
13373
+ * Sync telemetry data to Firestore for real-time dashboard
13374
+ */
13375
+ async syncToFirestore(data2) {
13376
+ if (!data2.userId) return;
13377
+ const { adminFirestore: adminFirestore2, FieldValue: FieldValue2, Timestamp: Timestamp2 } = await loadFirebaseAdmin();
13378
+ if (!adminFirestore2) return;
13379
+ try {
13380
+ const now = new Date(data2.timestamp);
13381
+ const periodId = `${now.getFullYear()}${String(now.getMonth() + 1).padStart(2, "0")}`;
13382
+ const userUsageRef = adminFirestore2.collection("users").doc(data2.userId).collection("usage").doc(periodId);
13383
+ const updateData = {
13384
+ lastUpdated: FieldValue2.serverTimestamp(),
13385
+ "used.requests": FieldValue2.increment(1)
13386
+ };
13387
+ if (data2.cmd === "code" || data2.cmd.includes("code")) {
13388
+ updateData["used.commands"] = FieldValue2.increment(1);
13389
+ }
13390
+ if (data2.quotaLeft) {
13391
+ const estimatedTokensUsed = Math.max(10, data2.latencyMs / 10);
13392
+ updateData["used.tokens"] = FieldValue2.increment(estimatedTokensUsed);
13393
+ }
13394
+ updateData["providers.maria-cli.requests"] = FieldValue2.increment(1);
13395
+ if (data2.quotaLeft) {
13396
+ const estimatedTokensUsed = Math.max(10, data2.latencyMs / 10);
13397
+ updateData["providers.maria-cli.tokens"] = FieldValue2.increment(estimatedTokensUsed);
13398
+ updateData["providers.maria-cli.cost"] = FieldValue2.increment(1e-4);
13399
+ }
13400
+ updateData["models.maria-cli.requests"] = FieldValue2.increment(1);
13401
+ if (data2.quotaLeft) {
13402
+ const estimatedTokensUsed = Math.max(10, data2.latencyMs / 10);
13403
+ updateData["models.maria-cli.tokens"] = FieldValue2.increment(estimatedTokensUsed);
13404
+ }
13405
+ updateData[`commands.${data2.cmd}`] = FieldValue2.increment(1);
13406
+ updateData["totalCost"] = FieldValue2.increment(1e-4);
13407
+ await userUsageRef.set(updateData, { merge: true });
13408
+ console.log(`[Firestore Sync] Updated usage for user ${data2.userId}, command ${data2.cmd}`);
13409
+ } catch (error2) {
13410
+ console.warn(`[Firestore Sync] Failed to update usage for user ${data2.userId}:`, error2);
13411
+ throw error2;
13412
+ }
13413
+ }
14226
13414
  /**
14227
13415
  * Start flush timer
14228
13416
  */
@@ -14355,10 +13543,30 @@ var init_bigquery_telemetry = __esm({
14355
13543
  bigQueryTelemetry = BigQueryTelemetryService.getInstance();
14356
13544
  }
14357
13545
  });
14358
-
14359
- // src/slash-commands/shared/telemetry-helper.ts
13546
+ async function getUserContext() {
13547
+ try {
13548
+ const configDir = path10__namespace.join(process.env.HOME || process.env.USERPROFILE || "", ".maria");
13549
+ const authFile = path10__namespace.join(configDir, "auth.json");
13550
+ if (await fs8__namespace.pathExists(authFile)) {
13551
+ const authData = await fs8__namespace.readJson(authFile);
13552
+ return {
13553
+ userId: authData.userId || authData.user?.id,
13554
+ userEmail: authData.userEmail || authData.user?.email,
13555
+ sessionId: authData.sessionId || authData.token
13556
+ };
13557
+ }
13558
+ return {
13559
+ userId: process.env.MARIA_USER_ID,
13560
+ userEmail: process.env.MARIA_USER_EMAIL,
13561
+ sessionId: process.env.MARIA_SESSION_ID
13562
+ };
13563
+ } catch (error2) {
13564
+ return {};
13565
+ }
13566
+ }
14360
13567
  async function trackCommand(data2) {
14361
13568
  try {
13569
+ const userContext = await getUserContext();
14362
13570
  await bigQueryTelemetry.trackCommandExecution({
14363
13571
  cmd: data2.cmd,
14364
13572
  status: data2.status,
@@ -14366,7 +13574,10 @@ async function trackCommand(data2) {
14366
13574
  plan: data2.plan,
14367
13575
  quotaLeft: data2.quotaLeft,
14368
13576
  errorType: data2.errorType,
14369
- args: data2.args
13577
+ args: data2.args,
13578
+ userId: data2.userId || userContext.userId,
13579
+ userEmail: data2.userEmail || userContext.userEmail,
13580
+ sessionId: data2.sessionId || userContext.sessionId
14370
13581
  });
14371
13582
  fetch("/v1/telemetry", {
14372
13583
  method: "POST",
@@ -15450,14 +14661,14 @@ var init_ReadyCommandsService = __esm({
15450
14661
  } else {
15451
14662
  const possiblePaths = [
15452
14663
  // For bundled dist version
15453
- path8__namespace.join(__dirname, "READY.manifest.json"),
15454
- path8__namespace.join(__dirname, "../READY.manifest.json"),
15455
- path8__namespace.join(process.cwd(), "dist/READY.manifest.json"),
14664
+ path10__namespace.join(__dirname, "READY.manifest.json"),
14665
+ path10__namespace.join(__dirname, "../READY.manifest.json"),
14666
+ path10__namespace.join(process.cwd(), "dist/READY.manifest.json"),
15456
14667
  // For development/source version
15457
- path8__namespace.join(__dirname, "../../../src/slash-commands/READY.manifest.json"),
15458
- path8__namespace.join(__dirname, "../../slash-commands/READY.manifest.json"),
15459
- path8__namespace.join(process.cwd(), "src/slash-commands/READY.manifest.json"),
15460
- path8__namespace.join(process.cwd(), "READY.manifest.json")
14668
+ path10__namespace.join(__dirname, "../../../src/slash-commands/READY.manifest.json"),
14669
+ path10__namespace.join(__dirname, "../../slash-commands/READY.manifest.json"),
14670
+ path10__namespace.join(process.cwd(), "src/slash-commands/READY.manifest.json"),
14671
+ path10__namespace.join(process.cwd(), "READY.manifest.json")
15461
14672
  ];
15462
14673
  this.manifestPath = possiblePaths[0];
15463
14674
  }
@@ -15468,17 +14679,17 @@ var init_ReadyCommandsService = __esm({
15468
14679
  async findManifestPath() {
15469
14680
  const possiblePaths = [
15470
14681
  // For bundled dist version
15471
- path8__namespace.join(__dirname, "READY.manifest.json"),
15472
- path8__namespace.join(__dirname, "../READY.manifest.json"),
15473
- path8__namespace.join(process.cwd(), "dist/READY.manifest.json"),
14682
+ path10__namespace.join(__dirname, "READY.manifest.json"),
14683
+ path10__namespace.join(__dirname, "../READY.manifest.json"),
14684
+ path10__namespace.join(process.cwd(), "dist/READY.manifest.json"),
15474
14685
  // For development/source version
15475
- path8__namespace.join(__dirname, "../../../src/slash-commands/READY.manifest.json"),
15476
- path8__namespace.join(__dirname, "../../slash-commands/READY.manifest.json"),
15477
- path8__namespace.join(process.cwd(), "src/slash-commands/READY.manifest.json"),
15478
- path8__namespace.join(process.cwd(), "READY.manifest.json"),
14686
+ path10__namespace.join(__dirname, "../../../src/slash-commands/READY.manifest.json"),
14687
+ path10__namespace.join(__dirname, "../../slash-commands/READY.manifest.json"),
14688
+ path10__namespace.join(process.cwd(), "src/slash-commands/READY.manifest.json"),
14689
+ path10__namespace.join(process.cwd(), "READY.manifest.json"),
15479
14690
  // Additional paths for different build scenarios
15480
- path8__namespace.resolve(__dirname, "../../../src/slash-commands/READY.manifest.json"),
15481
- path8__namespace.resolve(process.cwd(), "src/slash-commands/READY.manifest.json")
14691
+ path10__namespace.resolve(__dirname, "../../../src/slash-commands/READY.manifest.json"),
14692
+ path10__namespace.resolve(process.cwd(), "src/slash-commands/READY.manifest.json")
15482
14693
  ];
15483
14694
  for (const testPath of possiblePaths) {
15484
14695
  try {
@@ -15771,9 +14982,9 @@ var init_ReadyCommandsService = __esm({
15771
14982
  if (this.readyCommands.length === 0) {
15772
14983
  await this.loadReadyCommands();
15773
14984
  }
15774
- const categories = [];
14985
+ const categories2 = [];
15775
14986
  for (const [categoryName, commands] of this.commandsByCategory) {
15776
- categories.push({
14987
+ categories2.push({
15777
14988
  name: categoryName,
15778
14989
  emoji: "",
15779
14990
  // Remove emojis for simplicity
@@ -15781,7 +14992,7 @@ var init_ReadyCommandsService = __esm({
15781
14992
  count: commands.length
15782
14993
  });
15783
14994
  }
15784
- categories.sort((a2, b) => {
14995
+ categories2.sort((a2, b) => {
15785
14996
  const aPriority = this.getCategoryPriority(a2.name);
15786
14997
  const bPriority = this.getCategoryPriority(b.name);
15787
14998
  if (aPriority !== bPriority) {
@@ -15789,7 +15000,7 @@ var init_ReadyCommandsService = __esm({
15789
15000
  }
15790
15001
  return a2.name.localeCompare(b.name);
15791
15002
  });
15792
- return categories;
15003
+ return categories2;
15793
15004
  }
15794
15005
  /**
15795
15006
  * Search commands with fuzzy matching
@@ -16124,7 +15335,7 @@ var init_HelpCommand = __esm({
16124
15335
  * Show general help with READY commands only
16125
15336
  */
16126
15337
  async showGeneralHelp() {
16127
- const categories = await this.readyService.getCategories();
15338
+ const categories2 = await this.readyService.getCategories();
16128
15339
  const stats = await this.readyService.getStatistics();
16129
15340
  const lines = [];
16130
15341
  lines.push("\u2550".repeat(60));
@@ -16137,14 +15348,14 @@ var init_HelpCommand = __esm({
16137
15348
  lines.push(" /help --search <term> - Search with fuzzy matching");
16138
15349
  lines.push("");
16139
15350
  let globalMaxNameLength = 0;
16140
- for (const category of categories) {
15351
+ for (const category of categories2) {
16141
15352
  const showCommands = category.commands.slice(0, 4);
16142
15353
  for (const cmd of showCommands) {
16143
15354
  globalMaxNameLength = Math.max(globalMaxNameLength, cmd.name.length);
16144
15355
  }
16145
15356
  }
16146
15357
  globalMaxNameLength = Math.max(globalMaxNameLength, 18) + 1;
16147
- for (const category of categories) {
15358
+ for (const category of categories2) {
16148
15359
  lines.push(chalk17__default.default.bold(`${category.name.toUpperCase()} (${category.count})`));
16149
15360
  const showCommands = category.commands.slice(0, 4);
16150
15361
  for (const cmd of showCommands) {
@@ -16245,8 +15456,8 @@ var init_HelpCommand = __esm({
16245
15456
  async showCategoryHelp(categoryName) {
16246
15457
  const commands = await this.readyService.getCommandsByCategory(categoryName);
16247
15458
  if (commands.length === 0) {
16248
- const categories = await this.readyService.getCategories();
16249
- const availableCategories = categories.map((c) => c.name);
15459
+ const categories2 = await this.readyService.getCategories();
15460
+ const availableCategories = categories2.map((c) => c.name);
16250
15461
  return this.error(
16251
15462
  `No READY commands in category: ${categoryName}. Available: ${availableCategories.join(", ")}`,
16252
15463
  "CATEGORY_NOT_FOUND"
@@ -16382,7 +15593,7 @@ var init_HelpCommand = __esm({
16382
15593
  */
16383
15594
  async showStatistics() {
16384
15595
  const stats = await this.readyService.getStatistics();
16385
- const categories = await this.readyService.getCategories();
15596
+ const categories2 = await this.readyService.getCategories();
16386
15597
  const lines = [];
16387
15598
  lines.push("");
16388
15599
  lines.push(`\u{1F4CA} ${chalk17__default.default.bold("READY COMMANDS STATISTICS")}`);
@@ -16399,7 +15610,7 @@ var init_HelpCommand = __esm({
16399
15610
  lines.push(` Slowest Command: /${stats.slowestCommand}`);
16400
15611
  lines.push("");
16401
15612
  lines.push(chalk17__default.default.bold("\u{1F4CB} By Category:"));
16402
- for (const category of categories) {
15613
+ for (const category of categories2) {
16403
15614
  const avgTime = Math.round(
16404
15615
  category.commands.reduce((sum, cmd) => sum + cmd.contract.maxResponseTime, 0) / category.commands.length
16405
15616
  );
@@ -16537,91 +15748,6 @@ Command: /voice ${args.join(" ")}`,
16537
15748
  }
16538
15749
  });
16539
15750
 
16540
- // src/slash-commands/categories/auth/LoginCommand.ts
16541
- var LoginCommand_exports = {};
16542
- __export(LoginCommand_exports, {
16543
- LoginCommand: () => LoginCommand,
16544
- meta: () => meta2
16545
- });
16546
- var LoginCommand, meta2;
16547
- var init_LoginCommand = __esm({
16548
- "src/slash-commands/categories/auth/LoginCommand.ts"() {
16549
- init_base_command();
16550
- init_cli_auth();
16551
- init_telemetry_helper();
16552
- init_subscription_manager();
16553
- LoginCommand = class extends BaseCommand {
16554
- name = "login";
16555
- category = "auth";
16556
- description = "Sign in to MARIA";
16557
- aliases = ["signin"];
16558
- usage = "";
16559
- examples = [
16560
- {
16561
- input: "/login",
16562
- description: "Sign in to MARIA",
16563
- output: "Logged in with plan and quota info"
16564
- }
16565
- ];
16566
- async execute(args, context2) {
16567
- const startTime = Date.now();
16568
- try {
16569
- const isAuthenticated = await authManager.isAuthenticated();
16570
- if (isAuthenticated) {
16571
- try {
16572
- const user = await authManager.getCurrentUser();
16573
- const plan2 = user.plan || "Free";
16574
- const quotaLeft2 = user.usage?.requestsRemaining || 100;
16575
- return this.success(`Already logged in \xB7 Plan: ${plan2} \xB7 ${quotaLeft2} req left`);
16576
- } catch {
16577
- }
16578
- }
16579
- const authResult = await authManager.login();
16580
- if (!authResult.success) {
16581
- return this.error(authResult.error || "Authentication failed \xB7 Try again", void 0, void 0, 2);
16582
- }
16583
- const userInfo2 = authResult.user;
16584
- const plan = userInfo2?.plan || "Free";
16585
- const quotaLeft = userInfo2?.usage?.requestsRemaining || 100;
16586
- const email = userInfo2?.email || "user";
16587
- await trackCommand({
16588
- cmd: "login",
16589
- status: "success",
16590
- latencyMs: Date.now() - startTime,
16591
- plan,
16592
- quotaLeft
16593
- });
16594
- const message = `\u2705 Logged in as ${email} \xB7 Plan: ${plan} \xB7 ${quotaLeft} req left`;
16595
- return this.success(withQuotaFooter(message, quotaLeft));
16596
- } catch (error2) {
16597
- await trackCommand({
16598
- cmd: "login",
16599
- status: "error",
16600
- latencyMs: Date.now() - startTime,
16601
- plan: getUserPlan(),
16602
- quotaLeft: 999
16603
- });
16604
- if (error2.message?.includes("User cancelled")) {
16605
- return this.success("Login cancelled");
16606
- }
16607
- return this.error("Login failed \xB7 Check your connection and try again", void 0, void 0, 2);
16608
- }
16609
- }
16610
- };
16611
- meta2 = {
16612
- name: "login",
16613
- category: "auth",
16614
- description: "Sign in to MARIA",
16615
- aliases: ["signin"],
16616
- usage: "",
16617
- examples: [
16618
- "/login"
16619
- ],
16620
- deps: []
16621
- };
16622
- }
16623
- });
16624
-
16625
15751
  // src/utils/import-helper.ts
16626
15752
  var import_helper_exports = {};
16627
15753
  __export(import_helper_exports, {
@@ -17098,12 +16224,12 @@ ${this.toYamlLike(value, indent + 1)}`;
17098
16224
  }
17099
16225
  static async loadFromFile(configPath) {
17100
16226
  const { importNodeBuiltin: importNodeBuiltin2 } = await Promise.resolve().then(() => (init_import_helper(), import_helper_exports));
17101
- const fs12 = await importNodeBuiltin2("fs");
16227
+ const fs13 = await importNodeBuiltin2("fs");
17102
16228
  const _path = await importNodeBuiltin2("path");
17103
16229
  const os9 = await importNodeBuiltin2("os");
17104
16230
  const targetPath = configPath || _path.join(os9.homedir(), ".maria", "config.json");
17105
16231
  try {
17106
- const data2 = await fs12.promises.readFile(targetPath, "utf-8");
16232
+ const data2 = await fs13.promises.readFile(targetPath, "utf-8");
17107
16233
  return JSON.parse(data2);
17108
16234
  } catch (innerError) {
17109
16235
  if (error?.code === "ENOENT") {
@@ -17117,25 +16243,25 @@ ${this.toYamlLike(value, indent + 1)}`;
17117
16243
  }
17118
16244
  async save(configPath, options) {
17119
16245
  const { importNodeBuiltin: importNodeBuiltin2 } = await Promise.resolve().then(() => (init_import_helper(), import_helper_exports));
17120
- const fs12 = await importNodeBuiltin2("fs");
16246
+ const fs13 = await importNodeBuiltin2("fs");
17121
16247
  const _path = await importNodeBuiltin2("path");
17122
16248
  const os9 = await importNodeBuiltin2("os");
17123
16249
  const targetPath = configPath || _path.join(os9.homedir(), ".maria", "config.json");
17124
16250
  try {
17125
16251
  if (options?.backup) {
17126
16252
  try {
17127
- await fs12.promises.access(targetPath);
16253
+ await fs13.promises.access(targetPath);
17128
16254
  const backupPath = `${targetPath}.backup.${Date.now()}`;
17129
- await fs12.promises.copyFile(targetPath, backupPath);
16255
+ await fs13.promises.copyFile(targetPath, backupPath);
17130
16256
  } catch {
17131
16257
  }
17132
16258
  }
17133
- await fs12.promises.mkdir(_path.dirname(targetPath), { recursive: true });
16259
+ await fs13.promises.mkdir(_path.dirname(targetPath), { recursive: true });
17134
16260
  const dataToSave = this.getAll({
17135
16261
  maskSensitive: options?.maskSensitive ?? true,
17136
16262
  includeSourceMap: options?.includeSourceMap ?? false
17137
16263
  });
17138
- await fs12.promises.writeFile(
16264
+ await fs13.promises.writeFile(
17139
16265
  targetPath,
17140
16266
  JSON.stringify(dataToSave, null, 2),
17141
16267
  { mode: 384 }
@@ -17179,12 +16305,12 @@ ${this.toYamlLike(value, indent + 1)}`;
17179
16305
  }
17180
16306
  if (outputPath) {
17181
16307
  const { importNodeBuiltin: importNodeBuiltin2 } = await Promise.resolve().then(() => (init_import_helper(), import_helper_exports));
17182
- const fs12 = await importNodeBuiltin2("fs");
16308
+ const fs13 = await importNodeBuiltin2("fs");
17183
16309
  const _path = await importNodeBuiltin2(
17184
16310
  "path"
17185
16311
  );
17186
- await fs12.promises.mkdir(_path.dirname(outputPath), { recursive: true });
17187
- await fs12.promises.writeFile(outputPath, content, "utf-8");
16312
+ await fs13.promises.mkdir(_path.dirname(outputPath), { recursive: true });
16313
+ await fs13.promises.writeFile(outputPath, content, "utf-8");
17188
16314
  console.log(`\u2705 Configuration exported to ${outputPath}`);
17189
16315
  }
17190
16316
  return content;
@@ -17477,9 +16603,9 @@ var init_model_selector_ui = __esm({
17477
16603
  var ModelCommand_exports = {};
17478
16604
  __export(ModelCommand_exports, {
17479
16605
  ModelCommand: () => ModelCommand,
17480
- meta: () => meta3
16606
+ meta: () => meta2
17481
16607
  });
17482
- var ModelCommand, meta3;
16608
+ var ModelCommand, meta2;
17483
16609
  var init_ModelCommand = __esm({
17484
16610
  "src/slash-commands/categories/configuration/handlers/ModelCommand.ts"() {
17485
16611
  init_base_command();
@@ -18740,7 +17866,7 @@ ${model.description}
18740
17866
  }
18741
17867
  }
18742
17868
  };
18743
- meta3 = {
17869
+ meta2 = {
18744
17870
  name: "model",
18745
17871
  category: "configuration",
18746
17872
  description: "Manages AI model configuration and selection",
@@ -18931,9 +18057,9 @@ var init_BaseCommand = __esm({
18931
18057
  var ConfigCommand_exports = {};
18932
18058
  __export(ConfigCommand_exports, {
18933
18059
  ConfigCommand: () => ConfigCommand,
18934
- meta: () => meta4
18060
+ meta: () => meta3
18935
18061
  });
18936
- var ConfigCommand, meta4;
18062
+ var ConfigCommand, meta3;
18937
18063
  var init_ConfigCommand = __esm({
18938
18064
  "src/slash-commands/categories/configuration/handlers/ConfigCommand.ts"() {
18939
18065
  init_BaseCommand();
@@ -19122,8 +18248,8 @@ var init_ConfigCommand = __esm({
19122
18248
  validate: (v) => typeof v === "string"
19123
18249
  }
19124
18250
  };
19125
- globalConfigPath = path8__namespace.default.join(os__namespace.default.homedir(), ".maria", "config.json");
19126
- localConfigPath = path8__namespace.default.join(process.cwd(), ".maria-config.json");
18251
+ globalConfigPath = path10__namespace.default.join(os__namespace.default.homedir(), ".maria", "config.json");
18252
+ localConfigPath = path10__namespace.default.join(process.cwd(), ".maria-config.json");
19127
18253
  async execute(_args, context2) {
19128
18254
  try {
19129
18255
  const _startTime = Date.now();
@@ -19509,7 +18635,7 @@ var init_ConfigCommand = __esm({
19509
18635
  }
19510
18636
  async saveConfiguration(_config, _scope) {
19511
18637
  const _configPath = _scope === "global" ? this.globalConfigPath : this.localConfigPath;
19512
- await fsp__namespace.default.mkdir(path8__namespace.default.dirname(_configPath), { recursive: true });
18638
+ await fsp__namespace.default.mkdir(path10__namespace.default.dirname(_configPath), { recursive: true });
19513
18639
  await fsp__namespace.default.writeFile(_configPath, JSON.stringify(_config, null, 2), "utf-8");
19514
18640
  this.setCache(`_config:${_scope}`, _config, 300);
19515
18641
  }
@@ -19633,7 +18759,7 @@ var init_ConfigCommand = __esm({
19633
18759
  };
19634
18760
  }
19635
18761
  };
19636
- meta4 = {
18762
+ meta3 = {
19637
18763
  name: "config",
19638
18764
  category: "configuration",
19639
18765
  description: "Manages MARIA configuration settings",
@@ -19924,25 +19050,8 @@ async function displayFinalStartupScreen(_selectedProvider, _selectedModel) {
19924
19050
  );
19925
19051
  const cwd = systemInfo.cwd.replace(os__namespace.homedir(), "~");
19926
19052
  console.log(chalk17__default.default.gray("cwd: ") + chalk17__default.default.white(cwd));
19927
- try {
19928
- const { authManager: authManager2 } = await import('../cli-auth/index.js').catch(() => ({ authManager: null }));
19929
- if (authManager2 && await authManager2.isAuthenticated()) {
19930
- try {
19931
- const user = await authManager2.getCurrentUser();
19932
- console.log(chalk17__default.default.green(`Signed in: ${user.email}`));
19933
- console.log(chalk17__default.default.yellow("Tip: /help \xB7 /help code \xB7 /usage"));
19934
- } catch {
19935
- console.log(chalk17__default.default.green("Signed in"));
19936
- console.log(chalk17__default.default.yellow("Tip: /help \xB7 /help code \xB7 /usage"));
19937
- }
19938
- } else {
19939
- console.log(chalk17__default.default.gray("Not signed in"));
19940
- console.log(chalk17__default.default.yellow("Tip: /login \xB7 /help \xB7 /help code"));
19941
- }
19942
- } catch {
19943
- console.log(chalk17__default.default.gray("Not signed in"));
19944
- console.log(chalk17__default.default.yellow("Tip: /login \xB7 /help \xB7 /help code"));
19945
- }
19053
+ console.log(chalk17__default.default.gray("Not signed in"));
19054
+ console.log(chalk17__default.default.yellow("Tip: /login \xB7 /help \xB7 /help code"));
19946
19055
  console.log("");
19947
19056
  }
19948
19057
  function displayRoundedInputBox() {
@@ -26625,11 +25734,11 @@ var init_ConfigService = __esm({
26625
25734
  _saveDebounceTimer = null;
26626
25735
  _isDirty = false;
26627
25736
  constructor(configDir = process.env.MARIA_CONFIG_DIR || "~/.maria") {
26628
- this._configPath = path8__namespace.join(
25737
+ this._configPath = path10__namespace.join(
26629
25738
  this.expandHome(configDir),
26630
25739
  "session.config.json"
26631
25740
  );
26632
- this._userConfigPath = path8__namespace.join(
25741
+ this._userConfigPath = path10__namespace.join(
26633
25742
  this.expandHome(configDir),
26634
25743
  "user.config.json"
26635
25744
  );
@@ -26704,8 +25813,8 @@ var init_ConfigService = __esm({
26704
25813
  /**
26705
25814
  * ネストされた設定値の取得
26706
25815
  */
26707
- getNestedValue(path12) {
26708
- const keys = path12.split(".");
25816
+ getNestedValue(path14) {
25817
+ const keys = path14.split(".");
26709
25818
  let value = this._config;
26710
25819
  for (const key2 of keys) {
26711
25820
  if (value && typeof value === "object" && key2 in value) {
@@ -26735,8 +25844,8 @@ var init_ConfigService = __esm({
26735
25844
  /**
26736
25845
  * ネストされた設定値の更新
26737
25846
  */
26738
- async setNestedValue(path12, value) {
26739
- const keys = path12.split(".");
25847
+ async setNestedValue(path14, value) {
25848
+ const keys = path14.split(".");
26740
25849
  const lastKey = keys.pop();
26741
25850
  let target = this._config;
26742
25851
  for (const key2 of keys) {
@@ -26749,7 +25858,7 @@ var init_ConfigService = __esm({
26749
25858
  target[lastKey] = value;
26750
25859
  this.validateConfig();
26751
25860
  this.emitChange({
26752
- path: path12,
25861
+ path: path14,
26753
25862
  oldValue,
26754
25863
  newValue: value,
26755
25864
  timestamp: /* @__PURE__ */ new Date()
@@ -26763,7 +25872,7 @@ var init_ConfigService = __esm({
26763
25872
  async save() {
26764
25873
  if (!this._isDirty) return;
26765
25874
  try {
26766
- const configDir = path8__namespace.dirname(this._userConfigPath);
25875
+ const configDir = path10__namespace.dirname(this._userConfigPath);
26767
25876
  await fsp__namespace.mkdir(configDir, { recursive: true });
26768
25877
  await fsp__namespace.writeFile(
26769
25878
  this._userConfigPath,
@@ -26794,8 +25903,8 @@ var init_ConfigService = __esm({
26794
25903
  setupAutoSave() {
26795
25904
  process.on("exit", () => {
26796
25905
  if (this._isDirty) {
26797
- const fs12 = __require("fs");
26798
- fs12.writeFileSync(
25906
+ const fs13 = __require("fs");
25907
+ fs13.writeFileSync(
26799
25908
  this._userConfigPath,
26800
25909
  JSON.stringify(this._config, null, 2),
26801
25910
  "utf-8"
@@ -26806,13 +25915,13 @@ var init_ConfigService = __esm({
26806
25915
  /**
26807
25916
  * 変更リスナーの登録
26808
25917
  */
26809
- onChange(path12, listener) {
26810
- if (!this._listeners.has(path12)) {
26811
- this._listeners.set(path12, []);
25918
+ onChange(path14, listener) {
25919
+ if (!this._listeners.has(path14)) {
25920
+ this._listeners.set(path14, []);
26812
25921
  }
26813
- this._listeners.get(path12).push(listener);
25922
+ this._listeners.get(path14).push(listener);
26814
25923
  return () => {
26815
- const listeners = this._listeners.get(path12);
25924
+ const listeners = this._listeners.get(path14);
26816
25925
  if (listeners) {
26817
25926
  const index = listeners.indexOf(listener);
26818
25927
  if (index !== -1) {
@@ -26863,7 +25972,7 @@ var init_ConfigService = __esm({
26863
25972
  */
26864
25973
  expandHome(filePath) {
26865
25974
  if (filePath.startsWith("~/")) {
26866
- return path8__namespace.join(process.env.HOME || "", filePath.slice(2));
25975
+ return path10__namespace.join(process.env.HOME || "", filePath.slice(2));
26867
25976
  }
26868
25977
  return filePath;
26869
25978
  }
@@ -27301,7 +26410,7 @@ var init_ValidationService = __esm({
27301
26410
  );
27302
26411
  this._schemas.set(
27303
26412
  "filePath",
27304
- zod.z.string().min(1).max(this._config.maxFilePathLength).refine((path12) => !this.containsPathTraversal(path12), {
26413
+ zod.z.string().min(1).max(this._config.maxFilePathLength).refine((path14) => !this.containsPathTraversal(path14), {
27305
26414
  message: "Path traversal detected"
27306
26415
  })
27307
26416
  );
@@ -27440,11 +26549,11 @@ var init_ValidationService = __esm({
27440
26549
  /**
27441
26550
  * ファイルパス検証
27442
26551
  */
27443
- validateFilePath(path12) {
26552
+ validateFilePath(path14) {
27444
26553
  try {
27445
26554
  const schema = this._schemas.get("filePath");
27446
- const result = schema.parse(path12);
27447
- if (this.isSystemPath(path12)) {
26555
+ const result = schema.parse(path14);
26556
+ if (this.isSystemPath(path14)) {
27448
26557
  return {
27449
26558
  valid: false,
27450
26559
  errors: [
@@ -27590,8 +26699,8 @@ var init_ValidationService = __esm({
27590
26699
  /**
27591
26700
  * パストラバーサルの検出
27592
26701
  */
27593
- containsPathTraversal(path12) {
27594
- return /\.\.[/\\]/.test(path12) || path12.includes("..\\") || path12.includes("../");
26702
+ containsPathTraversal(path14) {
26703
+ return /\.\.[/\\]/.test(path14) || path14.includes("..\\") || path14.includes("../");
27595
26704
  }
27596
26705
  /**
27597
26706
  * 危険なコマンドの判定
@@ -27618,7 +26727,7 @@ var init_ValidationService = __esm({
27618
26727
  /**
27619
26728
  * システムパスの判定
27620
26729
  */
27621
- isSystemPath(path12) {
26730
+ isSystemPath(path14) {
27622
26731
  const systemPaths = [
27623
26732
  "/etc",
27624
26733
  "/sys",
@@ -27632,7 +26741,7 @@ var init_ValidationService = __esm({
27632
26741
  "/sbin"
27633
26742
  ];
27634
26743
  return systemPaths.some(
27635
- (sysPath) => path12.toLowerCase().startsWith(sysPath.toLowerCase())
26744
+ (sysPath) => path14.toLowerCase().startsWith(sysPath.toLowerCase())
27636
26745
  );
27637
26746
  }
27638
26747
  /**
@@ -30321,13 +29430,13 @@ var init_CommandRegistry = __esm({
30321
29430
  * @returns Array of unique categories
30322
29431
  */
30323
29432
  getCategories() {
30324
- const categories = /* @__PURE__ */ new Set();
29433
+ const categories2 = /* @__PURE__ */ new Set();
30325
29434
  for (const registration of this.handlers.values()) {
30326
29435
  if (registration.handler.category) {
30327
- categories.add(registration.handler.category);
29436
+ categories2.add(registration.handler.category);
30328
29437
  }
30329
29438
  }
30330
- return Array.from(categories);
29439
+ return Array.from(categories2);
30331
29440
  }
30332
29441
  /**
30333
29442
  * Get command help text
@@ -31200,14 +30309,14 @@ var init_CoreHandlers = __esm({
31200
30309
  let message = chalk17__default.default.cyan(`\u{1F916} MARIA v3.5.0 - Available Commands
31201
30310
 
31202
30311
  `);
31203
- const categories = {
30312
+ const categories2 = {
31204
30313
  core: ["/help", "/clear", "/exit", "/version", "/history"],
31205
30314
  conversation: ["/chat", "/context", "/memory"],
31206
30315
  development: ["/code", "/test", "/review", "/debug", "/deploy"],
31207
30316
  business: ["/business", "/pilot", "/dashboard"],
31208
30317
  system: ["/status", "/config", "/logs", "/approve"]
31209
30318
  };
31210
- for (const [category, cmds] of Object.entries(categories)) {
30319
+ for (const [category, cmds] of Object.entries(categories2)) {
31211
30320
  message += chalk17__default.default.yellow(`
31212
30321
  ${category.toUpperCase()}:
31213
30322
  `);
@@ -31226,7 +30335,7 @@ Type '/help <command>' for detailed information about a specific command.`
31226
30335
  return {
31227
30336
  success: true,
31228
30337
  message,
31229
- data: { commands, categories },
30338
+ data: { commands, categories: categories2 },
31230
30339
  metadata: {
31231
30340
  processingTime,
31232
30341
  timestamp: /* @__PURE__ */ new Date()
@@ -32368,15 +31477,15 @@ var init_SessionOrchestrator = __esm({
32368
31477
  /**
32369
31478
  * 設定の取得
32370
31479
  */
32371
- getConfig(path12) {
32372
- return this._configService?.getNestedValue(path12);
31480
+ getConfig(path14) {
31481
+ return this._configService?.getNestedValue(path14);
32373
31482
  }
32374
31483
  /**
32375
31484
  * 設定の更新
32376
31485
  */
32377
- async setConfig(path12, value) {
31486
+ async setConfig(path14, value) {
32378
31487
  if (this._configService) {
32379
- await this._configService.setNestedValue(path12, value);
31488
+ await this._configService.setNestedValue(path14, value);
32380
31489
  }
32381
31490
  }
32382
31491
  /**
@@ -32494,11 +31603,11 @@ var init_interactive_session = __esm({
32494
31603
  getStats() {
32495
31604
  return this.orchestrator.getSessionStats();
32496
31605
  }
32497
- getConfig(path12) {
32498
- return this.orchestrator.getConfig(path12);
31606
+ getConfig(path14) {
31607
+ return this.orchestrator.getConfig(path14);
32499
31608
  }
32500
- async setConfig(path12, value) {
32501
- await this.orchestrator.setConfig(path12, value);
31609
+ async setConfig(path14, value) {
31610
+ await this.orchestrator.setConfig(path14, value);
32502
31611
  }
32503
31612
  };
32504
31613
  }
@@ -32510,8 +31619,8 @@ var init_package = __esm({
32510
31619
  "package.json"() {
32511
31620
  package_default = {
32512
31621
  name: "@bonginkan/maria",
32513
- version: "4.2.6",
32514
- description: "\u{1F680} MARIA v4.2.0 - Enterprise AI Development Platform with 100% Command Availability. Features 74 production-ready commands with comprehensive fallback implementation, local LLM support, and zero external dependencies. Includes natural language coding, AI safety evaluation, intelligent evolution system, episodic memory with PII masking, and real-time monitoring dashboard. Built with TypeScript AST-powered code generation, OAuth2.0 + PKCE authentication, quantum-resistant cryptography, and enterprise-grade performance.",
31622
+ version: "4.2.8",
31623
+ description: "\u{1F680} MARIA v4.2.8 - Enterprise AI Development Platform with 100% Command Availability. Features 74 production-ready commands with comprehensive fallback implementation, local LLM support, and zero external dependencies. Includes natural language coding, AI safety evaluation, intelligent evolution system, episodic memory with PII masking, and real-time monitoring dashboard. Built with TypeScript AST-powered code generation, OAuth2.0 + PKCE authentication, quantum-resistant cryptography, and enterprise-grade performance.",
32515
31624
  keywords: [
32516
31625
  "ai",
32517
31626
  "cli",
@@ -32737,19 +31846,18 @@ var init_package = __esm({
32737
31846
  node: ">=20.10.0"
32738
31847
  },
32739
31848
  scripts: {
32740
- build: "NODE_ENV=production tsup && npm run copy:manifest && npm run verify:manifest",
32741
- "build:dev": "NODE_ENV=development tsup && npm run copy:manifest && npm run verify:manifest",
32742
- "build:analyze": "ANALYZE=true NODE_ENV=production tsup && npm run copy:manifest && npm run verify:manifest",
32743
- "copy:manifest": "cp src/slash-commands/READY.manifest.json dist/READY.manifest.json || (echo '\u274C READY.manifest.json not found! Generating...' && npm run generate:manifest && cp src/slash-commands/READY.manifest.json dist/READY.manifest.json)",
32744
- "verify:manifest": "test -f dist/READY.manifest.json && echo '\u2705 READY.manifest.json included in build' || (echo '\u274C READY.manifest.json missing from build!' && exit 1)",
32745
- "build:fast": "NODE_ENV=production tsup --minify false --sourcemap false",
32746
- dev: "NODE_ENV=development tsup --watch",
32747
- clean: "rm -rf dist",
31849
+ "ensure:manifest": "tsx scripts/generate-ready-manifest.ts",
31850
+ "copy:manifest": `node -e "const{copyFileSync,existsSync,mkdirSync}=require('fs');const{join,dirname}=require('path');const s=join(process.cwd(),'src/slash-commands/READY.manifest.json');const d=join(process.cwd(),'dist/READY.manifest.json');if(!existsSync(s)){console.error('\u274C READY.manifest.json not found. Run: pnpm generate:manifest');process.exit(1);}mkdirSync(dirname(d),{recursive:true});copyFileSync(s,d);console.log('\u2705 READY.manifest.json copied to dist/');"`,
31851
+ "verify:manifest": "tsx scripts/verify-manifest-inclusion.ts",
31852
+ build: "pnpm ensure:manifest && cross-env NODE_ENV=production tsup && pnpm copy:manifest && pnpm verify:manifest",
31853
+ "build:dev": "pnpm ensure:manifest && cross-env NODE_ENV=development tsup && pnpm copy:manifest && pnpm verify:manifest",
31854
+ "build:analyze": "pnpm ensure:manifest && cross-env ANALYZE=true NODE_ENV=production tsup && pnpm copy:manifest && pnpm verify:manifest",
31855
+ "build:fast": "cross-env NODE_ENV=production tsup --minify false --sourcemap false",
31856
+ dev: "cross-env NODE_ENV=development tsup --watch",
31857
+ clean: "rimraf dist",
32748
31858
  "gen:cmd-types": "tsx scripts/gen/command-types.mts",
32749
- prebuild: "pnpm run clean && pnpm gen:cmd-types && pnpm run ensure:manifest",
32750
- "ensure:manifest": "test -f src/slash-commands/READY.manifest.json || npm run generate:manifest",
31859
+ prebuild: "pnpm run clean && pnpm gen:cmd-types && pnpm ensure:manifest && pnpm vscode:sync",
32751
31860
  "build:docker": "NODE_ENV=production tsup",
32752
- postbuild: "chmod +x dist/cli.cjs dist/bin/maria.cjs 2>/dev/null || true",
32753
31861
  test: "vitest",
32754
31862
  "test:coverage": "vitest --coverage",
32755
31863
  "test:smoke": "vitest run src/__tests__/smoke.test.ts",
@@ -32760,7 +31868,7 @@ var init_package = __esm({
32760
31868
  "test:integration:ci": "vitest run --config vitest.integration.config.ts --reporter=json --reporter=verbose",
32761
31869
  "test:contract": "vitest run tests/contract/**/*.test.ts",
32762
31870
  "test:deps": "cross-env MOCK_DEPS=true vitest run tests/contract/**/*.test.ts",
32763
- "generate:manifest": "tsx scripts/generate-ready-manifest.ts",
31871
+ "generate:manifest": "tsx scripts/generate-ready-manifest.ts && tsx scripts/generate-enhanced-manifest.ts",
32764
31872
  "health:report": "tsx scripts/command-health-report.ts",
32765
31873
  "ims:deploy": "tsx scripts/deploy-ims-config.ts",
32766
31874
  "ims:secrets": "tsx scripts/setup-ims-secrets.ts",
@@ -32768,19 +31876,19 @@ var init_package = __esm({
32768
31876
  "ims:dashboard": "tsx scripts/ims-dashboard.ts",
32769
31877
  "ci:smoke": "pnpm -s build && pnpm -s test:smoke",
32770
31878
  "verify:build": "tsx scripts/verify-manifest-inclusion.ts",
32771
- lint: "eslint --cache 'src/**/*.{ts,tsx}'",
32772
- "lint:errors-only": "eslint --cache --quiet 'src/**/*.{ts,tsx}'",
32773
- "lint:ci": "eslint --cache --max-warnings=0 'src/**/*.{ts,tsx}'",
32774
- "lint:fix": "eslint --cache --fix 'src/**/*.{ts,tsx}'",
32775
- "lint:fix:errors": "eslint --cache --quiet --fix 'src/**/*.{ts,tsx}'",
31879
+ lint: 'eslint --cache "src/**/*.{ts,tsx}"',
31880
+ "lint:errors-only": 'eslint --cache --quiet "src/**/*.{ts,tsx}"',
31881
+ "lint:ci": 'eslint --cache --max-warnings=0 "src/**/*.{ts,tsx}"',
31882
+ "lint:fix": 'eslint --cache --fix "src/**/*.{ts,tsx}"',
31883
+ "lint:fix:errors": 'eslint --cache --quiet --fix "src/**/*.{ts,tsx}"',
32776
31884
  "lint:report": "eslint src --ext .ts,.tsx --format json > lint-report.json",
32777
- "lint:summary": "eslint --cache --format codeframe 'src/**/*.{ts,tsx}' | head -50",
31885
+ "lint:summary": 'eslint --cache --format codeframe "src/**/*.{ts,tsx}"',
32778
31886
  "lint:strict": "eslint src --ext .ts,.tsx --max-warnings 0",
32779
- "type-check": "./scripts/type-check-syntax.sh",
32780
- "type-check:syntax": "./scripts/type-check-syntax.sh",
31887
+ "type-check": "tsc -p tsconfig.json --noEmit",
31888
+ "type-check:syntax": "tsc -p tsconfig.json --noEmit",
32781
31889
  "type-check:full": "tsc --noEmit",
32782
31890
  precommit: "lint-staged",
32783
- "quality-gate": "pnpm lint:errors-only && pnpm type-check:syntax && echo '\u2705 Quality gates passed'",
31891
+ "quality-gate": `pnpm lint:errors-only && pnpm type-check:syntax && node -e "console.log('\u2705 Quality gates passed')"`,
32784
31892
  "quality-gate:ci": "pnpm lint:errors-only && pnpm type-check:syntax",
32785
31893
  "quality-check": "bash scripts/check-quality-gates.sh",
32786
31894
  "ready:baseline": "tsx scripts/check-ready-baseline.ts",
@@ -32826,6 +31934,7 @@ var init_package = __esm({
32826
31934
  "release:alpha": "pnpm publish --tag alpha",
32827
31935
  "release:beta": "pnpm publish --tag beta",
32828
31936
  "version:sync": "node scripts/sync-versions.js",
31937
+ "vscode:sync": "tsx scripts/sync-vscode-version.ts",
32829
31938
  "test:arch": "depcruise --config .dependency-cruiser.cjs 'src/**/*.ts?(x)'",
32830
31939
  "check:public-api": 'grep -REn "export (\\*|\\{|default)" src | grep -v "^src/index.ts:" || true',
32831
31940
  "check:deps": 'depcruise --config .dependency-cruiser.cjs "src/**/*.ts?(x)"',
@@ -32886,6 +31995,7 @@ var init_package = __esm({
32886
31995
  "express-validator": "^7.2.1",
32887
31996
  figlet: "^1.7.0",
32888
31997
  "file-type": "^21.0.0",
31998
+ "firebase-admin": "^13.5.0",
32889
31999
  "fs-extra": "^11.2.0",
32890
32000
  "fuse.js": "^7.1.0",
32891
32001
  globby: "^14.1.0",
@@ -32951,6 +32061,7 @@ var init_package = __esm({
32951
32061
  "cli-highlight": "^2.1.11",
32952
32062
  compression: "^1.8.1",
32953
32063
  cors: "^2.8.5",
32064
+ "cross-env": "^10.0.0",
32954
32065
  "dependency-cruiser": "^16.10.4",
32955
32066
  eslint: "^8.56.0",
32956
32067
  "eslint-config-prettier": "^9.1.0",
@@ -32969,6 +32080,7 @@ var init_package = __esm({
32969
32080
  prettier: "^3.2.4",
32970
32081
  "react-devtools-core": "^6.1.5",
32971
32082
  recast: "^0.23.11",
32083
+ rimraf: "^6.0.1",
32972
32084
  "rollup-plugin-visualizer": "^6.0.3",
32973
32085
  sqlite: "^5.1.1",
32974
32086
  sqlite3: "^5.1.7",
@@ -33480,9 +32592,9 @@ Chat:
33480
32592
  }
33481
32593
  if (cmd === "login" || cmd === "signin" || cmd === "auth") {
33482
32594
  try {
33483
- const { LoginCommand: LoginCommand2 } = await Promise.resolve().then(() => (init_LoginCommand(), LoginCommand_exports)).catch(() => ({}));
33484
- if (LoginCommand2) {
33485
- const loginCmd = new LoginCommand2();
32595
+ const { LoginCommand } = await import('./slash-commands/categories/auth/LoginCommand.js').catch(() => ({}));
32596
+ if (LoginCommand) {
32597
+ const loginCmd = new LoginCommand();
33486
32598
  const result = await loginCmd.execute();
33487
32599
  return true;
33488
32600
  } else {
@@ -33892,7 +33004,7 @@ async function handleCodeCommand(prompt) {
33892
33004
  console.log(response2);
33893
33005
  const { language, code, extension } = extractCodeInfo(response2);
33894
33006
  const filename = generateCodeFilename(prompt, language, extension);
33895
- const filepath = path8__namespace.resolve(process.cwd(), filename);
33007
+ const filepath = path10__namespace.resolve(process.cwd(), filename);
33896
33008
  await fsp__namespace.writeFile(filepath, code, "utf-8");
33897
33009
  console.log(
33898
33010
  chalk17__default.default.green("\n\u2705 **Code Saved**\n") + chalk17__default.default.white(`\u{1F4C1} **File (Click to open):**
@@ -33918,7 +33030,7 @@ async function handleCodeCommand(prompt) {
33918
33030
  try {
33919
33031
  const { language, code, extension } = extractCodeInfo(fallbackCode);
33920
33032
  const filename = generateCodeFilename(prompt, language, extension);
33921
- const filepath = path8__namespace.resolve(process.cwd(), filename);
33033
+ const filepath = path10__namespace.resolve(process.cwd(), filename);
33922
33034
  await fsp__namespace.writeFile(filepath, code, "utf-8");
33923
33035
  console.log(
33924
33036
  chalk17__default.default.green("\n\u2705 **Template Code Saved**\n") + chalk17__default.default.white(`\u{1F4C1} **File (Click to open):**
@@ -34271,7 +33383,7 @@ function createCLI2() {
34271
33383
  if (options.server) {
34272
33384
  console.log(chalk17__default.default.green("\u{1F680} Starting MARIA server mode..."));
34273
33385
  try {
34274
- const serverPath = path8__namespace.join(process.cwd(), "server.mjs");
33386
+ const serverPath = path10__namespace.join(process.cwd(), "server.mjs");
34275
33387
  const { spawn } = await import('child_process');
34276
33388
  const serverProcess = spawn("node", [serverPath], {
34277
33389
  stdio: "inherit",