mpd-llm-cli 0.1.25 → 0.1.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/bundle/api.cjs +1157 -128
  2. package/bundle/api.js +1150 -121
  3. package/bundle/gemini.js +1270 -136
  4. package/package.json +2 -2
package/bundle/gemini.js CHANGED
@@ -70110,10 +70110,10 @@ async function cacheCredentials(credentials) {
70110
70110
  await fs7.writeFile(filePath, credString);
70111
70111
  }
70112
70112
  function getCachedCredentialPath() {
70113
- return path2.join(os3.homedir(), GEMINI_DIR, CREDENTIAL_FILENAME);
70113
+ return path2.join(os3.homedir(), MPDAI_DIR, CREDENTIAL_FILENAME);
70114
70114
  }
70115
70115
  function getGoogleAccountIdCachePath() {
70116
- return path2.join(os3.homedir(), GEMINI_DIR, GOOGLE_ACCOUNT_ID_FILENAME);
70116
+ return path2.join(os3.homedir(), MPDAI_DIR, GOOGLE_ACCOUNT_ID_FILENAME);
70117
70117
  }
70118
70118
  async function cacheGoogleAccountId(googleAccountId) {
70119
70119
  const filePath = getGoogleAccountIdCachePath();
@@ -70168,7 +70168,7 @@ async function getRawGoogleAccountId(client) {
70168
70168
  return null;
70169
70169
  }
70170
70170
  }
70171
- var import_google_auth_library2, OAUTH_CLIENT_ID, OAUTH_CLIENT_SECRET, OAUTH_SCOPE, HTTP_REDIRECT, SIGN_IN_SUCCESS_URL, SIGN_IN_FAILURE_URL, GEMINI_DIR, CREDENTIAL_FILENAME, GOOGLE_ACCOUNT_ID_FILENAME;
70171
+ var import_google_auth_library2, OAUTH_CLIENT_ID, OAUTH_CLIENT_SECRET, OAUTH_SCOPE, HTTP_REDIRECT, SIGN_IN_SUCCESS_URL, SIGN_IN_FAILURE_URL, MPDAI_DIR, CREDENTIAL_FILENAME, GOOGLE_ACCOUNT_ID_FILENAME;
70172
70172
  var init_oauth2 = __esm({
70173
70173
  "packages/core/dist/src/code_assist/oauth2.js"() {
70174
70174
  "use strict";
@@ -70186,7 +70186,7 @@ var init_oauth2 = __esm({
70186
70186
  HTTP_REDIRECT = 301;
70187
70187
  SIGN_IN_SUCCESS_URL = "https://developers.google.com/gemini-code-assist/auth_success_gemini";
70188
70188
  SIGN_IN_FAILURE_URL = "https://developers.google.com/gemini-code-assist/auth_failure_gemini";
70189
- GEMINI_DIR = ".gemini";
70189
+ MPDAI_DIR = ".mpdai";
70190
70190
  CREDENTIAL_FILENAME = "oauth_creds.json";
70191
70191
  GOOGLE_ACCOUNT_ID_FILENAME = "google_account_id";
70192
70192
  }
@@ -78281,7 +78281,7 @@ async function createContentGeneratorConfig(model, authType) {
78281
78281
  return contentGeneratorConfig;
78282
78282
  }
78283
78283
  async function createContentGenerator(config2, sessionId2) {
78284
- const version3 = "0.1.25";
78284
+ const version3 = "0.1.28";
78285
78285
  const httpOptions = {
78286
78286
  headers: {
78287
78287
  "User-Agent": `GeminiCLI/${version3} (${process.platform}; ${process.arch})`
@@ -99694,13 +99694,13 @@ function getProjectHash(projectRoot) {
99694
99694
  }
99695
99695
  function getProjectTempDir(projectRoot) {
99696
99696
  const hash = getProjectHash(projectRoot);
99697
- return path4.join(os4.homedir(), GEMINI_DIR2, TMP_DIR_NAME, hash);
99697
+ return path4.join(os4.homedir(), MPDAI_DIR2, TMP_DIR_NAME, hash);
99698
99698
  }
99699
- var GEMINI_DIR2, TMP_DIR_NAME;
99699
+ var MPDAI_DIR2, TMP_DIR_NAME;
99700
99700
  var init_paths = __esm({
99701
99701
  "packages/core/dist/src/utils/paths.js"() {
99702
99702
  "use strict";
99703
- GEMINI_DIR2 = ".gemini";
99703
+ MPDAI_DIR2 = ".mpdai";
99704
99704
  TMP_DIR_NAME = "tmp";
99705
99705
  }
99706
99706
  });
@@ -110591,7 +110591,7 @@ var init_read_file = __esm({
110591
110591
  const fileService = this.config.getFileService();
110592
110592
  if (fileService.shouldGeminiIgnoreFile(params.absolute_path)) {
110593
110593
  const relativePath = makeRelative(params.absolute_path, this.rootDirectory);
110594
- return `File path '${shortenPath(relativePath)}' is ignored by .geminiignore pattern(s).`;
110594
+ return `File path '${shortenPath(relativePath)}' is ignored by .mpdaiignore pattern(s).`;
110595
110595
  }
110596
110596
  return null;
110597
110597
  }
@@ -119027,7 +119027,7 @@ function getAllGeminiMdFilenames() {
119027
119027
  return [currentGeminiMdFilename];
119028
119028
  }
119029
119029
  function getGlobalMemoryFilePath() {
119030
- return path13.join(homedir2(), GEMINI_CONFIG_DIR, getCurrentGeminiMdFilename());
119030
+ return path13.join(homedir2(), MPDAI_CONFIG_DIR, getCurrentGeminiMdFilename());
119031
119031
  }
119032
119032
  function ensureNewlineSeparation(currentContent) {
119033
119033
  if (currentContent.length === 0)
@@ -119038,7 +119038,7 @@ function ensureNewlineSeparation(currentContent) {
119038
119038
  return "\n";
119039
119039
  return "\n\n";
119040
119040
  }
119041
- var memoryToolSchemaData, memoryToolDescription, GEMINI_CONFIG_DIR, DEFAULT_CONTEXT_FILENAME, MEMORY_SECTION_HEADER, currentGeminiMdFilename, MemoryTool;
119041
+ var memoryToolSchemaData, memoryToolDescription, MPDAI_CONFIG_DIR, DEFAULT_CONTEXT_FILENAME, MEMORY_SECTION_HEADER, currentGeminiMdFilename, MemoryTool;
119042
119042
  var init_memoryTool = __esm({
119043
119043
  "packages/core/dist/src/tools/memoryTool.js"() {
119044
119044
  "use strict";
@@ -119076,7 +119076,7 @@ Do NOT use this tool:
119076
119076
 
119077
119077
  - \`fact\` (string, required): The specific fact or piece of information to remember. This should be a clear, self-contained statement. For example, if the user says "My favorite color is blue", the fact would be "My favorite color is blue".
119078
119078
  `;
119079
- GEMINI_CONFIG_DIR = ".gemini";
119079
+ MPDAI_CONFIG_DIR = ".mpdai";
119080
119080
  DEFAULT_CONTEXT_FILENAME = "MEMORY.md";
119081
119081
  MEMORY_SECTION_HEADER = "## Memory Added Memories";
119082
119082
  currentGeminiMdFilename = DEFAULT_CONTEXT_FILENAME;
@@ -119303,7 +119303,7 @@ Use this tool when the user's query implies needing the content of several files
119303
119303
  if (this.geminiIgnorePatterns.length > 0) {
119304
119304
  const geminiPatternsInEffect = this.geminiIgnorePatterns.filter((p) => finalExclusionPatternsForDescription.includes(p)).length;
119305
119305
  if (geminiPatternsInEffect > 0) {
119306
- excludeDesc += ` (includes ${geminiPatternsInEffect} from .geminiignore)`;
119306
+ excludeDesc += ` (includes ${geminiPatternsInEffect} from .mpdaiignore)`;
119307
119307
  }
119308
119308
  }
119309
119309
  return `Will attempt to read and concatenate files ${pathDesc}. ${excludeDesc}. File encoding: ${DEFAULT_ENCODING}. Separator: "${DEFAULT_OUTPUT_SEPARATOR_FORMAT.replace("{filePath}", "path/to/file.ext")}".`;
@@ -121479,8 +121479,8 @@ function many(p) {
121479
121479
  function many1(p) {
121480
121480
  return ab(p, many(p), (head, tail) => [head, ...tail]);
121481
121481
  }
121482
- function ab(pa, pb, join24) {
121483
- return (data, i) => mapOuter(pa(data, i), (ma) => mapInner(pb(data, ma.position), (vb, j) => join24(ma.value, vb, data, i, j)));
121482
+ function ab(pa, pb, join25) {
121483
+ return (data, i) => mapOuter(pa(data, i), (ma) => mapInner(pb(data, ma.position), (vb, j) => join25(ma.value, vb, data, i, j)));
121484
121484
  }
121485
121485
  function left(pa, pb) {
121486
121486
  return ab(pa, pb, (va) => va);
@@ -121488,8 +121488,8 @@ function left(pa, pb) {
121488
121488
  function right(pa, pb) {
121489
121489
  return ab(pa, pb, (va, vb) => vb);
121490
121490
  }
121491
- function abc(pa, pb, pc, join24) {
121492
- return (data, i) => mapOuter(pa(data, i), (ma) => mapOuter(pb(data, ma.position), (mb) => mapInner(pc(data, mb.position), (vc, j) => join24(ma.value, mb.value, vc, data, i, j))));
121491
+ function abc(pa, pb, pc, join25) {
121492
+ return (data, i) => mapOuter(pa(data, i), (ma) => mapOuter(pb(data, ma.position), (mb) => mapInner(pc(data, mb.position), (vc, j) => join25(ma.value, mb.value, vc, data, i, j))));
121493
121493
  }
121494
121494
  function middle(pa, pb, pc) {
121495
121495
  return abc(pa, pb, pc, (ra, rb) => rb);
@@ -126454,6 +126454,991 @@ ${modifiedResponseText}`,
126454
126454
  }
126455
126455
  });
126456
126456
 
126457
+ // packages/core/dist/src/tools/confluence-get-page.js
126458
+ var CONFLUENCE_FETCH_TIMEOUT_MS, CONFLUENCE_URL, ConfluenceGetPageTool;
126459
+ var init_confluence_get_page = __esm({
126460
+ "packages/core/dist/src/tools/confluence-get-page.js"() {
126461
+ "use strict";
126462
+ init_schemaValidator();
126463
+ init_tools();
126464
+ init_node();
126465
+ init_errors();
126466
+ CONFLUENCE_FETCH_TIMEOUT_MS = 3e4;
126467
+ CONFLUENCE_URL = "https://confluence.rakuten-it.com/confluence";
126468
+ ConfluenceGetPageTool = class _ConfluenceGetPageTool extends BaseTool {
126469
+ config;
126470
+ static Name = "confluence_get_page";
126471
+ constructor(config2) {
126472
+ super(_ConfluenceGetPageTool.Name, "ConfluenceGetPage", "Retrieves content from a Confluence page by its ID. Uses Personal Access Token from keys.json for authentication and can convert HTML content to markdown.", {
126473
+ properties: {
126474
+ page_id: {
126475
+ description: "The ID of the Confluence page to retrieve",
126476
+ type: Type.STRING
126477
+ },
126478
+ convert_to_markdown: {
126479
+ description: "Whether to convert HTML content to markdown format (default: true)",
126480
+ type: Type.STRING
126481
+ }
126482
+ },
126483
+ required: ["page_id"],
126484
+ type: Type.OBJECT
126485
+ });
126486
+ this.config = config2;
126487
+ }
126488
+ validateParams(params) {
126489
+ const errors = SchemaValidator.validate(this.schema.parameters, params);
126490
+ if (errors) {
126491
+ return errors;
126492
+ }
126493
+ if (!params.page_id || params.page_id.trim() === "") {
126494
+ return "The 'page_id' parameter cannot be empty.";
126495
+ }
126496
+ return null;
126497
+ }
126498
+ getDescription(params) {
126499
+ return `Retrieving Confluence page ${params.page_id} from ${CONFLUENCE_URL}`;
126500
+ }
126501
+ /**
126502
+ * Process HTML content to handle user mentions and page links
126503
+ */
126504
+ processHtmlContent(html, spaceKey, baseUrl) {
126505
+ let processed = html;
126506
+ processed = processed.replace(/<ac:link>[\s\S]*?<ri:user[^>]+ri:username="([^"]+)"\s*\/>[\s\S]*?<\/ac:link>/g, "@$1");
126507
+ processed = processed.replace(/<ac:link[^>]*>[\s\S]*?<ri:page[^>]+ri:content-title="([^"]*)"\s*ri:space-key="([^"]*)"\s*\/>[\s\S]*?<\/ac:link>/g, (match2, title) => {
126508
+ return title || "Page Link";
126509
+ });
126510
+ processed = processed.replace(/<\/?(span|div|p)[^>]*>/g, "\n");
126511
+ processed = processed.replace(/<strong>([^<]*)<\/strong>/g, "**$1**");
126512
+ processed = processed.replace(/<b>([^<]*)<\/b>/g, "**$1**");
126513
+ processed = processed.replace(/<em>([^<]*)<\/em>/g, "*$1*");
126514
+ processed = processed.replace(/<i>([^<]*)<\/i>/g, "*$1*");
126515
+ for (let i = 1; i <= 6; i++) {
126516
+ const tag = `h${i}`;
126517
+ const prefix = "#".repeat(i);
126518
+ processed = processed.replace(new RegExp(`<${tag}>([^<]*)</${tag}>`, "g"), `${prefix} $1`);
126519
+ }
126520
+ processed = processed.replace(/<li>([^<]*)<\/li>/g, "- $1\n");
126521
+ processed = processed.replace(/<ul[^>]*>/g, "\n");
126522
+ processed = processed.replace(/<\/ul>/g, "\n");
126523
+ processed = processed.replace(/<ol[^>]*>/g, "\n");
126524
+ processed = processed.replace(/<\/ol>/g, "\n");
126525
+ processed = processed.replace(/<a[^>]+href="([^"]*)"[^>]*>([^<]*)<\/a>/g, "[$2]($1)");
126526
+ processed = processed.replace(/<[^>]+>/g, "");
126527
+ processed = processed.replace(/\n{3,}/g, "\n\n");
126528
+ return processed.trim();
126529
+ }
126530
+ async execute(params, signal) {
126531
+ const validationError = this.validateParams(params);
126532
+ if (validationError) {
126533
+ return {
126534
+ llmContent: `Error: Invalid parameters provided. Reason: ${validationError}`,
126535
+ returnDisplay: validationError
126536
+ };
126537
+ }
126538
+ const { page_id, convert_to_markdown = true } = params;
126539
+ const personal_access_token = this.config.getConfluenceToken();
126540
+ if (!personal_access_token) {
126541
+ return {
126542
+ llmContent: "Error: Confluence Personal Access Token not found in keys.json. Please configure it first.",
126543
+ returnDisplay: "Confluence token not configured"
126544
+ };
126545
+ }
126546
+ try {
126547
+ const isCloud = CONFLUENCE_URL.includes(".atlassian.net");
126548
+ const apiUrl = `${CONFLUENCE_URL.replace(/\/$/, "")}/rest/api/content/${page_id}`;
126549
+ const paramsObj = new URLSearchParams({
126550
+ expand: "body.storage,version,space,children.attachment,ancestors"
126551
+ });
126552
+ const fullUrl = `${apiUrl}?${paramsObj.toString()}`;
126553
+ const headers = {
126554
+ "Accept": "application/json",
126555
+ "Content-Type": "application/json",
126556
+ "Authorization": `Bearer ${personal_access_token}`
126557
+ };
126558
+ const controller = new AbortController();
126559
+ const timeoutId = setTimeout(() => controller.abort(), CONFLUENCE_FETCH_TIMEOUT_MS);
126560
+ let response;
126561
+ try {
126562
+ response = await fetch(fullUrl, {
126563
+ method: "GET",
126564
+ headers,
126565
+ signal: signal || controller.signal
126566
+ });
126567
+ } finally {
126568
+ clearTimeout(timeoutId);
126569
+ }
126570
+ if (response.status === 401) {
126571
+ return {
126572
+ llmContent: "Error: Authentication failed (401). Personal Access Token may be invalid or expired.",
126573
+ returnDisplay: "Authentication failed (401)"
126574
+ };
126575
+ }
126576
+ if (response.status === 403) {
126577
+ return {
126578
+ llmContent: "Error: Access denied (403). Token may not have sufficient permissions.",
126579
+ returnDisplay: "Access denied (403)"
126580
+ };
126581
+ }
126582
+ if (response.status === 404) {
126583
+ return {
126584
+ llmContent: `Error: Page not found (404). Page ID ${page_id} may not exist.`,
126585
+ returnDisplay: `Page not found (404): ${page_id}`
126586
+ };
126587
+ }
126588
+ if (!response.ok) {
126589
+ const errorText = await response.text().catch(() => "Unknown error");
126590
+ return {
126591
+ llmContent: `Error: API call failed with status ${response.status}: ${errorText}`,
126592
+ returnDisplay: `API error (${response.status})`
126593
+ };
126594
+ }
126595
+ const pageData = await response.json();
126596
+ const content = pageData.body.storage.value;
126597
+ const spaceKey = pageData.space.key;
126598
+ const title = pageData.title;
126599
+ const version3 = pageData.version.number;
126600
+ const created = pageData.created;
126601
+ const updated = pageData.updated;
126602
+ let pageUrl;
126603
+ if (isCloud) {
126604
+ pageUrl = `${CONFLUENCE_URL}/spaces/${spaceKey}/pages/${pageData.id}`;
126605
+ } else {
126606
+ pageUrl = `${CONFLUENCE_URL}/pages/viewpage.action?pageId=${pageData.id}`;
126607
+ }
126608
+ let processedContent;
126609
+ let contentFormat;
126610
+ if (convert_to_markdown) {
126611
+ processedContent = this.processHtmlContent(content, spaceKey, CONFLUENCE_URL);
126612
+ contentFormat = "markdown";
126613
+ } else {
126614
+ processedContent = content;
126615
+ contentFormat = "storage";
126616
+ }
126617
+ const result = {
126618
+ id: pageData.id,
126619
+ title,
126620
+ type: pageData.type,
126621
+ status: pageData.status,
126622
+ created,
126623
+ updated,
126624
+ url: pageUrl,
126625
+ space: {
126626
+ key: spaceKey,
126627
+ name: pageData.space.name
126628
+ },
126629
+ version: version3,
126630
+ attachments: pageData.children?.attachment?.results || [],
126631
+ ancestors: pageData.ancestors || [],
126632
+ content: {
126633
+ value: processedContent,
126634
+ format: contentFormat
126635
+ }
126636
+ };
126637
+ const resultText = `# ${title}
126638
+
126639
+ **Page ID:** ${pageData.id}
126640
+ **Space:** ${spaceKey}
126641
+ **Version:** ${version3}
126642
+ **Created:** ${created}
126643
+ **Updated:** ${updated}
126644
+ **URL:** ${pageUrl}
126645
+
126646
+ ---
126647
+
126648
+ ${processedContent}
126649
+ `;
126650
+ return {
126651
+ llmContent: resultText,
126652
+ returnDisplay: `Retrieved Confluence page: ${title}`
126653
+ };
126654
+ } catch (error) {
126655
+ const errorMessage = `Error retrieving Confluence page ${page_id}: ${getErrorMessage(error)}`;
126656
+ console.error(errorMessage, error);
126657
+ return {
126658
+ llmContent: `Error: ${errorMessage}`,
126659
+ returnDisplay: `Error: ${errorMessage}`
126660
+ };
126661
+ }
126662
+ }
126663
+ };
126664
+ }
126665
+ });
126666
+
126667
+ // packages/core/dist/src/tools/jira-get-issue.js
126668
+ var JIRA_FETCH_TIMEOUT_MS, JIRA_URL, JiraGetIssueTool;
126669
+ var init_jira_get_issue = __esm({
126670
+ "packages/core/dist/src/tools/jira-get-issue.js"() {
126671
+ "use strict";
126672
+ init_schemaValidator();
126673
+ init_tools();
126674
+ init_node();
126675
+ init_errors();
126676
+ JIRA_FETCH_TIMEOUT_MS = 3e4;
126677
+ JIRA_URL = "https://jira.rakuten-it.com/jira";
126678
+ JiraGetIssueTool = class _JiraGetIssueTool extends BaseTool {
126679
+ config;
126680
+ static Name = "jira_get_issue";
126681
+ constructor(config2) {
126682
+ super(_JiraGetIssueTool.Name, "JiraGetIssue", "Retrieves content from a Jira issue by its key. Uses Personal Access Token from keys.json for authentication.", {
126683
+ properties: {
126684
+ issue_key: {
126685
+ description: "The Jira issue key to retrieve (e.g., PROJECT-123)",
126686
+ type: Type.STRING
126687
+ },
126688
+ expand: {
126689
+ description: 'Fields to expand in the response (e.g., "renderedFields,changelog")',
126690
+ type: Type.STRING
126691
+ },
126692
+ comment_limit: {
126693
+ description: 'Maximum number of comments to include (default: 10, use "all" for all comments)',
126694
+ type: Type.STRING
126695
+ }
126696
+ },
126697
+ required: ["issue_key"],
126698
+ type: Type.OBJECT
126699
+ });
126700
+ this.config = config2;
126701
+ }
126702
+ validateParams(params) {
126703
+ const errors = SchemaValidator.validate(this.schema.parameters, params);
126704
+ if (errors) {
126705
+ return errors;
126706
+ }
126707
+ if (!params.issue_key || params.issue_key.trim() === "") {
126708
+ return "The 'issue_key' parameter cannot be empty.";
126709
+ }
126710
+ const issueKeyPattern = /^[A-Z]+-\d+$/;
126711
+ if (!issueKeyPattern.test(params.issue_key.trim())) {
126712
+ return "The 'issue_key' must be in format PROJECT-123 (e.g., PROJ-456)";
126713
+ }
126714
+ return null;
126715
+ }
126716
+ getDescription(params) {
126717
+ return `Retrieving Jira issue ${params.issue_key} from ${JIRA_URL}`;
126718
+ }
126719
+ /**
126720
+ * Normalize comment limit to a number
126721
+ */
126722
+ normalizeCommentLimit(commentLimit) {
126723
+ if (commentLimit === void 0) {
126724
+ return 10;
126725
+ }
126726
+ if (typeof commentLimit === "number") {
126727
+ return commentLimit;
126728
+ }
126729
+ if (commentLimit === "all" || commentLimit === "") {
126730
+ return null;
126731
+ }
126732
+ try {
126733
+ return parseInt(commentLimit, 10);
126734
+ } catch {
126735
+ return 10;
126736
+ }
126737
+ }
126738
+ /**
126739
+ * Convert Jira formatted text to plain text
126740
+ */
126741
+ convertJiraTextToPlainText(content) {
126742
+ if (typeof content === "string") {
126743
+ return content;
126744
+ }
126745
+ if (typeof content === "object" && content !== null) {
126746
+ const obj = content;
126747
+ if (Array.isArray(obj.content)) {
126748
+ return this.extractTextFromContent(obj.content);
126749
+ }
126750
+ }
126751
+ return "";
126752
+ }
126753
+ /**
126754
+ * Extract text from Jira content structure
126755
+ */
126756
+ extractTextFromContent(content) {
126757
+ let text = "";
126758
+ for (const item of content) {
126759
+ if (typeof item === "object" && item !== null) {
126760
+ const obj = item;
126761
+ if (obj.text) {
126762
+ text += obj.text;
126763
+ }
126764
+ if (obj.content && Array.isArray(obj.content)) {
126765
+ text += this.extractTextFromContent(obj.content);
126766
+ }
126767
+ }
126768
+ }
126769
+ return text;
126770
+ }
126771
+ /**
126772
+ * Format date string
126773
+ */
126774
+ formatDate(dateStr) {
126775
+ if (!dateStr) {
126776
+ return "";
126777
+ }
126778
+ try {
126779
+ const date = new Date(dateStr);
126780
+ return date.toLocaleString();
126781
+ } catch {
126782
+ return dateStr;
126783
+ }
126784
+ }
126785
+ async execute(params, signal) {
126786
+ const validationError = this.validateParams(params);
126787
+ if (validationError) {
126788
+ return {
126789
+ llmContent: `Error: Invalid parameters provided. Reason: ${validationError}`,
126790
+ returnDisplay: validationError
126791
+ };
126792
+ }
126793
+ const { issue_key, expand: expand2, comment_limit } = params;
126794
+ const personal_access_token = this.config.getJiraToken();
126795
+ if (!personal_access_token) {
126796
+ return {
126797
+ llmContent: "Error: Jira Personal Access Token not found in keys.json. Please configure it first.",
126798
+ returnDisplay: "Jira token not configured"
126799
+ };
126800
+ }
126801
+ try {
126802
+ const apiUrl = `${JIRA_URL}/rest/api/2/issue/${issue_key}`;
126803
+ const queryParams = new URLSearchParams();
126804
+ const expandParams = expand2 ? expand2.split(",").map((s2) => s2.trim()) : [];
126805
+ if (!expandParams.includes("renderedFields")) {
126806
+ expandParams.push("renderedFields");
126807
+ }
126808
+ if (expandParams.length > 0) {
126809
+ queryParams.set("expand", expandParams.join(","));
126810
+ }
126811
+ const fullUrl = `${apiUrl}?${queryParams.toString()}`;
126812
+ const headers = {
126813
+ "Accept": "application/json",
126814
+ "Content-Type": "application/json",
126815
+ "Authorization": `Bearer ${personal_access_token}`
126816
+ };
126817
+ console.log("Jira API request:", {
126818
+ url: fullUrl,
126819
+ authMethod: "Bearer",
126820
+ tokenLength: personal_access_token.length,
126821
+ headers: { ...headers, Authorization: "Bearer ***" }
126822
+ });
126823
+ const controller = new AbortController();
126824
+ const timeoutId = setTimeout(() => controller.abort(), JIRA_FETCH_TIMEOUT_MS);
126825
+ let response;
126826
+ try {
126827
+ response = await fetch(fullUrl, {
126828
+ method: "GET",
126829
+ headers,
126830
+ signal: signal || controller.signal
126831
+ });
126832
+ } finally {
126833
+ clearTimeout(timeoutId);
126834
+ }
126835
+ if (response.status === 401) {
126836
+ return {
126837
+ llmContent: "Error: Authentication failed (401). Personal Access Token may be invalid or expired.",
126838
+ returnDisplay: "Authentication failed (401)"
126839
+ };
126840
+ }
126841
+ if (response.status === 403) {
126842
+ return {
126843
+ llmContent: "Error: Access denied (403). Token may not have sufficient permissions.",
126844
+ returnDisplay: "Access denied (403)"
126845
+ };
126846
+ }
126847
+ if (response.status === 404) {
126848
+ return {
126849
+ llmContent: `Error: Issue not found (404). Issue key ${issue_key} may not exist.`,
126850
+ returnDisplay: `Issue not found (404): ${issue_key}`
126851
+ };
126852
+ }
126853
+ if (!response.ok) {
126854
+ const errorText = await response.text().catch(() => "Unknown error");
126855
+ console.error(`Jira API error (${response.status}):`, errorText.substring(0, 500));
126856
+ return {
126857
+ llmContent: `Error: API call failed with status ${response.status}: ${errorText.substring(0, 200)}`,
126858
+ returnDisplay: `API error (${response.status})`
126859
+ };
126860
+ }
126861
+ const contentType = response.headers.get("content-type") || "";
126862
+ if (!contentType.includes("application/json")) {
126863
+ const responseText = await response.text();
126864
+ console.error("Jira API returned non-JSON response:", responseText.substring(0, 500));
126865
+ return {
126866
+ llmContent: "Error: Jira API returned non-JSON response. This usually means authentication failed. Please check your Personal Access Token in keys.json.",
126867
+ returnDisplay: "Authentication failed - invalid response format"
126868
+ };
126869
+ }
126870
+ const issueData = await response.json();
126871
+ const fields = issueData.fields || {};
126872
+ const summary = fields.summary || "";
126873
+ const status = fields.status?.name || "Unknown";
126874
+ const issueType = fields.issuetype?.name || "Unknown";
126875
+ const created = this.formatDate(fields.created);
126876
+ const updated = this.formatDate(fields.updated);
126877
+ const assignee = fields.assignee?.displayName || fields.assignee?.name || "Unassigned";
126878
+ const reporter = fields.reporter?.displayName || fields.reporter?.name || "Unknown";
126879
+ const description = this.convertJiraTextToPlainText(fields.description);
126880
+ const comments = fields.comment?.comments || [];
126881
+ const normalizedCommentLimit = this.normalizeCommentLimit(comment_limit);
126882
+ const limitedComments = normalizedCommentLimit !== null ? comments.slice(0, normalizedCommentLimit) : comments;
126883
+ const issueUrl = `${JIRA_URL}/browse/${issue_key}`;
126884
+ let resultText = `# ${issue_key}: ${summary}
126885
+
126886
+ `;
126887
+ resultText += `**Type**: ${issueType}
126888
+ `;
126889
+ resultText += `**Status**: ${status}
126890
+ `;
126891
+ resultText += `**Reporter**: ${reporter}
126892
+ `;
126893
+ resultText += `**Assignee**: ${assignee}
126894
+ `;
126895
+ resultText += `**Created**: ${created}
126896
+ `;
126897
+ resultText += `**Updated**: ${updated}
126898
+ `;
126899
+ resultText += `**URL**: ${issueUrl}
126900
+
126901
+ `;
126902
+ if (description) {
126903
+ resultText += `## Description
126904
+
126905
+ ${description}
126906
+
126907
+ `;
126908
+ }
126909
+ if (limitedComments.length > 0) {
126910
+ resultText += `## Comments (${limitedComments.length}${normalizedCommentLimit !== null ? ` of ${comments.length}` : ""})
126911
+
126912
+ `;
126913
+ for (const comment of limitedComments) {
126914
+ const commentAuthor = comment.author?.displayName || comment.author?.name || "Unknown";
126915
+ const commentBody = this.convertJiraTextToPlainText(comment.body);
126916
+ const commentCreated = this.formatDate(comment.created);
126917
+ if (commentBody) {
126918
+ resultText += `**${commentAuthor}** (${commentCreated}):
126919
+ ${commentBody}
126920
+
126921
+ `;
126922
+ }
126923
+ }
126924
+ }
126925
+ return {
126926
+ llmContent: resultText,
126927
+ returnDisplay: `Retrieved Jira issue: ${issue_key}`
126928
+ };
126929
+ } catch (error) {
126930
+ const errorMessage = `Error retrieving Jira issue ${issue_key}: ${getErrorMessage(error)}`;
126931
+ console.error(errorMessage, error);
126932
+ return {
126933
+ llmContent: `Error: ${errorMessage}`,
126934
+ returnDisplay: `Error: ${errorMessage}`
126935
+ };
126936
+ }
126937
+ }
126938
+ };
126939
+ }
126940
+ });
126941
+
126942
+ // packages/core/dist/src/tools/bitbucket-get-pr-diff.js
126943
+ var BITBUCKET_FETCH_TIMEOUT_MS, BITBUCKET_URL, BitbucketGetPrDiffTool;
126944
+ var init_bitbucket_get_pr_diff = __esm({
126945
+ "packages/core/dist/src/tools/bitbucket-get-pr-diff.js"() {
126946
+ "use strict";
126947
+ init_schemaValidator();
126948
+ init_tools();
126949
+ init_node();
126950
+ init_errors();
126951
+ BITBUCKET_FETCH_TIMEOUT_MS = 3e4;
126952
+ BITBUCKET_URL = "https://git.rakuten-it.com";
126953
+ BitbucketGetPrDiffTool = class _BitbucketGetPrDiffTool extends BaseTool {
126954
+ config;
126955
+ static Name = "bitbucket_get_pr_diff";
126956
+ constructor(config2) {
126957
+ super(_BitbucketGetPrDiffTool.Name, "BitbucketGetPrDiff", "Retrieves the diff content for a specified Bitbucket Pull Request. Uses Personal Access Token from keys.json for authentication.", {
126958
+ properties: {
126959
+ project_key: {
126960
+ description: "The unique identifier for the Bitbucket project that owns the PR",
126961
+ type: Type.STRING
126962
+ },
126963
+ repo_slug: {
126964
+ description: "The repository slug name that owns the PR",
126965
+ type: Type.STRING
126966
+ },
126967
+ pr_id: {
126968
+ description: "The Pull Request unique identifier",
126969
+ type: Type.NUMBER
126970
+ }
126971
+ },
126972
+ required: ["project_key", "repo_slug", "pr_id"],
126973
+ type: Type.OBJECT
126974
+ });
126975
+ this.config = config2;
126976
+ }
126977
+ validateParams(params) {
126978
+ const errors = SchemaValidator.validate(this.schema.parameters, params);
126979
+ if (errors) {
126980
+ return errors;
126981
+ }
126982
+ if (!params.project_key || params.project_key.trim() === "") {
126983
+ return "The 'project_key' parameter cannot be empty.";
126984
+ }
126985
+ if (!params.repo_slug || params.repo_slug.trim() === "") {
126986
+ return "The 'repo_slug' parameter cannot be empty.";
126987
+ }
126988
+ if (params.pr_id <= 0) {
126989
+ return "The 'pr_id' must be a positive number.";
126990
+ }
126991
+ return null;
126992
+ }
126993
+ getDescription(params) {
126994
+ return `Retrieving diff for Bitbucket PR #${params.pr_id} in ${params.project_key}/${params.repo_slug}`;
126995
+ }
126996
+ async execute(params, signal) {
126997
+ const validationError = this.validateParams(params);
126998
+ if (validationError) {
126999
+ return {
127000
+ llmContent: `Error: Invalid parameters provided. Reason: ${validationError}`,
127001
+ returnDisplay: validationError
127002
+ };
127003
+ }
127004
+ const { project_key, repo_slug, pr_id } = params;
127005
+ const personal_access_token = this.config.getBitbucketToken();
127006
+ if (!personal_access_token) {
127007
+ return {
127008
+ llmContent: "Error: Bitbucket Personal Access Token not found in keys.json. Please configure it first.",
127009
+ returnDisplay: "Bitbucket token not configured"
127010
+ };
127011
+ }
127012
+ try {
127013
+ const apiUrl = `${BITBUCKET_URL}/rest/api/1.0/projects/${project_key}/repos/${repo_slug}/pull-requests/${pr_id}/diff`;
127014
+ const headers = {
127015
+ "Authorization": `Bearer ${personal_access_token}`,
127016
+ "Accept": "text/plain"
127017
+ };
127018
+ console.log("Bitbucket API request:", {
127019
+ url: apiUrl,
127020
+ authMethod: "Bearer",
127021
+ tokenLength: personal_access_token.length,
127022
+ headers: { ...headers, Authorization: "Bearer ***" }
127023
+ });
127024
+ const controller = new AbortController();
127025
+ const timeoutId = setTimeout(() => controller.abort(), BITBUCKET_FETCH_TIMEOUT_MS);
127026
+ let response;
127027
+ try {
127028
+ response = await fetch(apiUrl, {
127029
+ method: "GET",
127030
+ headers,
127031
+ signal: signal || controller.signal
127032
+ });
127033
+ } finally {
127034
+ clearTimeout(timeoutId);
127035
+ }
127036
+ if (response.status === 401) {
127037
+ return {
127038
+ llmContent: "Error: Authentication failed (401). Personal Access Token may be invalid or expired.",
127039
+ returnDisplay: "Authentication failed (401)"
127040
+ };
127041
+ }
127042
+ if (response.status === 403) {
127043
+ return {
127044
+ llmContent: "Error: Access denied (403). Token may not have sufficient permissions.",
127045
+ returnDisplay: "Access denied (403)"
127046
+ };
127047
+ }
127048
+ if (response.status === 404) {
127049
+ return {
127050
+ llmContent: `Error: Pull Request not found (404). PR #${pr_id} in ${project_key}/${repo_slug} may not exist.`,
127051
+ returnDisplay: `PR not found (404): #${pr_id}`
127052
+ };
127053
+ }
127054
+ if (!response.ok) {
127055
+ const errorText = await response.text().catch(() => "Unknown error");
127056
+ console.error(`Bitbucket API error (${response.status}):`, errorText.substring(0, 500));
127057
+ return {
127058
+ llmContent: `Error: API call failed with status ${response.status}: ${errorText.substring(0, 200)}`,
127059
+ returnDisplay: `API error (${response.status})`
127060
+ };
127061
+ }
127062
+ const diffText = await response.text();
127063
+ let resultText = `# Pull Request Diff: ${project_key}/${repo_slug}#${pr_id}
127064
+
127065
+ `;
127066
+ resultText += `\`\`\`diff
127067
+ ${diffText}
127068
+ \`\`\``;
127069
+ return {
127070
+ llmContent: resultText,
127071
+ returnDisplay: `Retrieved diff for Bitbucket PR #${pr_id}`
127072
+ };
127073
+ } catch (error) {
127074
+ const errorMessage = `Error retrieving Bitbucket PR diff ${project_key}/${repo_slug}#${pr_id}: ${getErrorMessage(error)}`;
127075
+ console.error(errorMessage, error);
127076
+ return {
127077
+ llmContent: `Error: ${errorMessage}`,
127078
+ returnDisplay: `Error: ${errorMessage}`
127079
+ };
127080
+ }
127081
+ }
127082
+ };
127083
+ }
127084
+ });
127085
+
127086
+ // packages/core/dist/src/tools/bitbucket-add-pr-comment.js
127087
+ var BITBUCKET_FETCH_TIMEOUT_MS2, BITBUCKET_URL2, BitbucketAddPrCommentTool;
127088
+ var init_bitbucket_add_pr_comment = __esm({
127089
+ "packages/core/dist/src/tools/bitbucket-add-pr-comment.js"() {
127090
+ "use strict";
127091
+ init_schemaValidator();
127092
+ init_tools();
127093
+ init_node();
127094
+ init_errors();
127095
+ BITBUCKET_FETCH_TIMEOUT_MS2 = 3e4;
127096
+ BITBUCKET_URL2 = "https://git.rakuten-it.com";
127097
+ BitbucketAddPrCommentTool = class _BitbucketAddPrCommentTool extends BaseTool {
127098
+ config;
127099
+ static Name = "bitbucket_add_pr_comment";
127100
+ constructor(config2) {
127101
+ super(_BitbucketAddPrCommentTool.Name, "BitbucketAddPrComment", "Adds a general comment to a specified Bitbucket Pull Request. Uses Personal Access Token from keys.json for authentication.", {
127102
+ properties: {
127103
+ project_key: {
127104
+ description: "The unique identifier for the Bitbucket project that owns the PR",
127105
+ type: Type.STRING
127106
+ },
127107
+ repo_slug: {
127108
+ description: "The repository slug name that owns the PR",
127109
+ type: Type.STRING
127110
+ },
127111
+ pr_id: {
127112
+ description: "The Pull Request unique identifier",
127113
+ type: Type.NUMBER
127114
+ },
127115
+ comment_text: {
127116
+ description: "The text content of the comment to add",
127117
+ type: Type.STRING
127118
+ }
127119
+ },
127120
+ required: ["project_key", "repo_slug", "pr_id", "comment_text"],
127121
+ type: Type.OBJECT
127122
+ });
127123
+ this.config = config2;
127124
+ }
127125
+ validateParams(params) {
127126
+ const errors = SchemaValidator.validate(this.schema.parameters, params);
127127
+ if (errors) {
127128
+ return errors;
127129
+ }
127130
+ if (!params.project_key || params.project_key.trim() === "") {
127131
+ return "The 'project_key' parameter cannot be empty.";
127132
+ }
127133
+ if (!params.repo_slug || params.repo_slug.trim() === "") {
127134
+ return "The 'repo_slug' parameter cannot be empty.";
127135
+ }
127136
+ if (params.pr_id <= 0) {
127137
+ return "The 'pr_id' must be a positive number.";
127138
+ }
127139
+ if (!params.comment_text || params.comment_text.trim() === "") {
127140
+ return "The 'comment_text' parameter cannot be empty.";
127141
+ }
127142
+ return null;
127143
+ }
127144
+ getDescription(params) {
127145
+ return `Adding comment to Bitbucket PR #${params.pr_id} in ${params.project_key}/${params.repo_slug}`;
127146
+ }
127147
+ async execute(params, signal) {
127148
+ const validationError = this.validateParams(params);
127149
+ if (validationError) {
127150
+ return {
127151
+ llmContent: `Error: Invalid parameters provided. Reason: ${validationError}`,
127152
+ returnDisplay: validationError
127153
+ };
127154
+ }
127155
+ const { project_key, repo_slug, pr_id, comment_text } = params;
127156
+ const personal_access_token = this.config.getBitbucketToken();
127157
+ if (!personal_access_token) {
127158
+ return {
127159
+ llmContent: "Error: Bitbucket Personal Access Token not found in keys.json. Please configure it first.",
127160
+ returnDisplay: "Bitbucket token not configured"
127161
+ };
127162
+ }
127163
+ try {
127164
+ const apiUrl = `${BITBUCKET_URL2}/rest/api/latest/projects/${project_key}/repos/${repo_slug}/pull-requests/${pr_id}/comments`;
127165
+ const headers = {
127166
+ "Authorization": `Bearer ${personal_access_token}`,
127167
+ "Content-Type": "application/json"
127168
+ };
127169
+ const payload = {
127170
+ text: comment_text
127171
+ };
127172
+ console.log("Bitbucket API request:", {
127173
+ url: apiUrl,
127174
+ method: "POST",
127175
+ authMethod: "Bearer",
127176
+ tokenLength: personal_access_token.length,
127177
+ headers: { ...headers, Authorization: "Bearer ***" }
127178
+ });
127179
+ const controller = new AbortController();
127180
+ const timeoutId = setTimeout(() => controller.abort(), BITBUCKET_FETCH_TIMEOUT_MS2);
127181
+ let response;
127182
+ try {
127183
+ response = await fetch(apiUrl, {
127184
+ method: "POST",
127185
+ headers,
127186
+ body: JSON.stringify(payload),
127187
+ signal: signal || controller.signal
127188
+ });
127189
+ } finally {
127190
+ clearTimeout(timeoutId);
127191
+ }
127192
+ if (response.status === 401) {
127193
+ return {
127194
+ llmContent: "Error: Authentication failed (401). Personal Access Token may be invalid or expired.",
127195
+ returnDisplay: "Authentication failed (401)"
127196
+ };
127197
+ }
127198
+ if (response.status === 403) {
127199
+ return {
127200
+ llmContent: "Error: Access denied (403). Token may not have sufficient permissions.",
127201
+ returnDisplay: "Access denied (403)"
127202
+ };
127203
+ }
127204
+ if (response.status === 404) {
127205
+ return {
127206
+ llmContent: `Error: Pull Request not found (404). PR #${pr_id} in ${project_key}/${repo_slug} may not exist.`,
127207
+ returnDisplay: `PR not found (404): #${pr_id}`
127208
+ };
127209
+ }
127210
+ if (!response.ok) {
127211
+ const errorText = await response.text().catch(() => "Unknown error");
127212
+ console.error(`Bitbucket API error (${response.status}):`, errorText.substring(0, 500));
127213
+ return {
127214
+ llmContent: `Error: API call failed with status ${response.status}: ${errorText.substring(0, 200)}`,
127215
+ returnDisplay: `API error (${response.status})`
127216
+ };
127217
+ }
127218
+ const responseData = await response.json();
127219
+ let resultText = `# Comment added to Pull Request: ${project_key}/${repo_slug}#${pr_id}
127220
+
127221
+ `;
127222
+ resultText += `**Comment ID**: ${responseData.id || "Unknown"}
127223
+ `;
127224
+ resultText += `**Text**: ${comment_text}
127225
+ `;
127226
+ return {
127227
+ llmContent: resultText,
127228
+ returnDisplay: `Added comment to Bitbucket PR #${pr_id}`
127229
+ };
127230
+ } catch (error) {
127231
+ const errorMessage = `Error adding comment to Bitbucket PR ${project_key}/${repo_slug}#${pr_id}: ${getErrorMessage(error)}`;
127232
+ console.error(errorMessage, error);
127233
+ return {
127234
+ llmContent: `Error: ${errorMessage}`,
127235
+ returnDisplay: `Error: ${errorMessage}`
127236
+ };
127237
+ }
127238
+ }
127239
+ };
127240
+ }
127241
+ });
127242
+
127243
+ // packages/core/dist/src/tools/bitbucket-add-pr-inline-comment.js
127244
+ var BITBUCKET_FETCH_TIMEOUT_MS3, BITBUCKET_URL3, BitbucketAddPrInlineCommentTool;
127245
+ var init_bitbucket_add_pr_inline_comment = __esm({
127246
+ "packages/core/dist/src/tools/bitbucket-add-pr-inline-comment.js"() {
127247
+ "use strict";
127248
+ init_schemaValidator();
127249
+ init_tools();
127250
+ init_node();
127251
+ init_errors();
127252
+ BITBUCKET_FETCH_TIMEOUT_MS3 = 3e4;
127253
+ BITBUCKET_URL3 = "https://git.rakuten-it.com";
127254
+ BitbucketAddPrInlineCommentTool = class _BitbucketAddPrInlineCommentTool extends BaseTool {
127255
+ config;
127256
+ static Name = "bitbucket_add_pr_inline_comment";
127257
+ constructor(config2) {
127258
+ super(_BitbucketAddPrInlineCommentTool.Name, "BitbucketAddPrInlineComment", "Adds an inline comment to a specific file and line in a Bitbucket Pull Request diff. Uses Personal Access Token from keys.json for authentication.", {
127259
+ properties: {
127260
+ project_key: {
127261
+ description: "The unique identifier for the Bitbucket project that owns the PR",
127262
+ type: Type.STRING
127263
+ },
127264
+ repo_slug: {
127265
+ description: "The repository slug name that owns the PR",
127266
+ type: Type.STRING
127267
+ },
127268
+ pr_id: {
127269
+ description: "The Pull Request unique identifier",
127270
+ type: Type.NUMBER
127271
+ },
127272
+ file_path: {
127273
+ description: "The file path relative to repository root to add comment to",
127274
+ type: Type.STRING
127275
+ },
127276
+ line: {
127277
+ description: "The line number to add comment to",
127278
+ type: Type.NUMBER
127279
+ },
127280
+ comment_text: {
127281
+ description: "The text content of the inline comment to add",
127282
+ type: Type.STRING
127283
+ },
127284
+ line_type: {
127285
+ description: "The line type, default is ADDED, optional values: ADDED, REMOVED, CONTEXT",
127286
+ type: Type.STRING
127287
+ },
127288
+ file_type: {
127289
+ description: "The file type, default is TO, optional values: TO, FROM",
127290
+ type: Type.STRING
127291
+ }
127292
+ },
127293
+ required: ["project_key", "repo_slug", "pr_id", "file_path", "line", "comment_text"],
127294
+ type: Type.OBJECT
127295
+ });
127296
+ this.config = config2;
127297
+ }
127298
+ validateParams(params) {
127299
+ const errors = SchemaValidator.validate(this.schema.parameters, params);
127300
+ if (errors) {
127301
+ return errors;
127302
+ }
127303
+ if (!params.project_key || params.project_key.trim() === "") {
127304
+ return "The 'project_key' parameter cannot be empty.";
127305
+ }
127306
+ if (!params.repo_slug || params.repo_slug.trim() === "") {
127307
+ return "The 'repo_slug' parameter cannot be empty.";
127308
+ }
127309
+ if (params.pr_id <= 0) {
127310
+ return "The 'pr_id' must be a positive number.";
127311
+ }
127312
+ if (!params.file_path || params.file_path.trim() === "") {
127313
+ return "The 'file_path' parameter cannot be empty.";
127314
+ }
127315
+ if (params.line <= 0) {
127316
+ return "The 'line' must be a positive number.";
127317
+ }
127318
+ if (!params.comment_text || params.comment_text.trim() === "") {
127319
+ return "The 'comment_text' parameter cannot be empty.";
127320
+ }
127321
+ if (params.line_type && !["ADDED", "REMOVED", "CONTEXT"].includes(params.line_type)) {
127322
+ return "The 'line_type' must be one of: ADDED, REMOVED, CONTEXT";
127323
+ }
127324
+ if (params.file_type && !["TO", "FROM"].includes(params.file_type)) {
127325
+ return "The 'file_type' must be one of: TO, FROM";
127326
+ }
127327
+ return null;
127328
+ }
127329
+ getDescription(params) {
127330
+ return `Adding inline comment to Bitbucket PR #${params.pr_id} in ${params.project_key}/${params.repo_slug} at ${params.file_path}:${params.line}`;
127331
+ }
127332
+ async execute(params, signal) {
127333
+ const validationError = this.validateParams(params);
127334
+ if (validationError) {
127335
+ return {
127336
+ llmContent: `Error: Invalid parameters provided. Reason: ${validationError}`,
127337
+ returnDisplay: validationError
127338
+ };
127339
+ }
127340
+ const { project_key, repo_slug, pr_id, file_path, line, comment_text, line_type, file_type } = params;
127341
+ const personal_access_token = this.config.getBitbucketToken();
127342
+ if (!personal_access_token) {
127343
+ return {
127344
+ llmContent: "Error: Bitbucket Personal Access Token not found in keys.json. Please configure it first.",
127345
+ returnDisplay: "Bitbucket token not configured"
127346
+ };
127347
+ }
127348
+ try {
127349
+ const apiUrl = `${BITBUCKET_URL3}/rest/api/latest/projects/${project_key}/repos/${repo_slug}/pull-requests/${pr_id}/comments`;
127350
+ const headers = {
127351
+ "Authorization": `Bearer ${personal_access_token}`,
127352
+ "Content-Type": "application/json"
127353
+ };
127354
+ const payload = {
127355
+ text: comment_text,
127356
+ anchor: {
127357
+ path: file_path,
127358
+ line,
127359
+ lineType: line_type || "ADDED",
127360
+ fileType: file_type || "TO"
127361
+ }
127362
+ };
127363
+ console.log("Bitbucket API request:", {
127364
+ url: apiUrl,
127365
+ method: "POST",
127366
+ authMethod: "Bearer",
127367
+ tokenLength: personal_access_token.length,
127368
+ headers: { ...headers, Authorization: "Bearer ***" }
127369
+ });
127370
+ const controller = new AbortController();
127371
+ const timeoutId = setTimeout(() => controller.abort(), BITBUCKET_FETCH_TIMEOUT_MS3);
127372
+ let response;
127373
+ try {
127374
+ response = await fetch(apiUrl, {
127375
+ method: "POST",
127376
+ headers,
127377
+ body: JSON.stringify(payload),
127378
+ signal: signal || controller.signal
127379
+ });
127380
+ } finally {
127381
+ clearTimeout(timeoutId);
127382
+ }
127383
+ if (response.status === 401) {
127384
+ return {
127385
+ llmContent: "Error: Authentication failed (401). Personal Access Token may be invalid or expired.",
127386
+ returnDisplay: "Authentication failed (401)"
127387
+ };
127388
+ }
127389
+ if (response.status === 403) {
127390
+ return {
127391
+ llmContent: "Error: Access denied (403). Token may not have sufficient permissions.",
127392
+ returnDisplay: "Access denied (403)"
127393
+ };
127394
+ }
127395
+ if (response.status === 404) {
127396
+ return {
127397
+ llmContent: `Error: Pull Request not found (404). PR #${pr_id} in ${project_key}/${repo_slug} may not exist.`,
127398
+ returnDisplay: `PR not found (404): #${pr_id}`
127399
+ };
127400
+ }
127401
+ if (!response.ok) {
127402
+ const errorText = await response.text().catch(() => "Unknown error");
127403
+ console.error(`Bitbucket API error (${response.status}):`, errorText.substring(0, 500));
127404
+ return {
127405
+ llmContent: `Error: API call failed with status ${response.status}: ${errorText.substring(0, 200)}`,
127406
+ returnDisplay: `API error (${response.status})`
127407
+ };
127408
+ }
127409
+ const responseData = await response.json();
127410
+ let resultText = `# Inline comment added to Pull Request: ${project_key}/${repo_slug}#${pr_id}
127411
+
127412
+ `;
127413
+ resultText += `**File**: ${file_path}
127414
+ `;
127415
+ resultText += `**Line**: ${line}
127416
+ `;
127417
+ resultText += `**Line Type**: ${line_type || "ADDED"}
127418
+ `;
127419
+ resultText += `**File Type**: ${file_type || "TO"}
127420
+ `;
127421
+ resultText += `**Comment ID**: ${responseData.id || "Unknown"}
127422
+ `;
127423
+ resultText += `**Text**: ${comment_text}
127424
+ `;
127425
+ return {
127426
+ llmContent: resultText,
127427
+ returnDisplay: `Added inline comment to Bitbucket PR #${pr_id} at ${file_path}:${line}`
127428
+ };
127429
+ } catch (error) {
127430
+ const errorMessage = `Error adding inline comment to Bitbucket PR ${project_key}/${repo_slug}#${pr_id}: ${getErrorMessage(error)}`;
127431
+ console.error(errorMessage, error);
127432
+ return {
127433
+ llmContent: `Error: ${errorMessage}`,
127434
+ returnDisplay: `Error: ${errorMessage}`
127435
+ };
127436
+ }
127437
+ }
127438
+ };
127439
+ }
127440
+ });
127441
+
126457
127442
  // packages/core/dist/src/utils/getFolderStructure.js
126458
127443
  import * as fs18 from "fs/promises";
126459
127444
  import * as path17 from "path";
@@ -126835,7 +127820,7 @@ import fs20 from "node:fs";
126835
127820
  import process20 from "node:process";
126836
127821
  function getCoreSystemPrompt(userMemory) {
126837
127822
  let systemMdEnabled = false;
126838
- let systemMdPath = path19.join(GEMINI_CONFIG_DIR, "system.md");
127823
+ let systemMdPath = path19.join(MPDAI_CONFIG_DIR, "system.md");
126839
127824
  const systemMdVar = process20.env.GEMINI_SYSTEM_MD?.toLowerCase();
126840
127825
  if (systemMdVar && !["0", "false"].includes(systemMdVar)) {
126841
127826
  systemMdEnabled = true;
@@ -174596,7 +175581,7 @@ var require_homedir = __commonJS({
174596
175581
  "node_modules/resolve/lib/homedir.js"(exports2, module2) {
174597
175582
  "use strict";
174598
175583
  var os23 = __require("os");
174599
- module2.exports = os23.homedir || function homedir16() {
175584
+ module2.exports = os23.homedir || function homedir17() {
174600
175585
  var home = process.env.HOME;
174601
175586
  var user = process.env.LOGNAME || process.env.USER || process.env.LNAME || process.env.USERNAME;
174602
175587
  if (process.platform === "win32") {
@@ -175077,11 +176062,11 @@ var require_async2 = __commonJS({
175077
176062
  var normalizeOptions = require_normalize_options();
175078
176063
  var isCore = require_is_core_module();
175079
176064
  var realpathFS = process.platform !== "win32" && fs51.realpath && typeof fs51.realpath.native === "function" ? fs51.realpath.native : fs51.realpath;
175080
- var homedir16 = getHomedir();
176065
+ var homedir17 = getHomedir();
175081
176066
  var defaultPaths = function() {
175082
176067
  return [
175083
- path53.join(homedir16, ".node_modules"),
175084
- path53.join(homedir16, ".node_libraries")
176068
+ path53.join(homedir17, ".node_modules"),
176069
+ path53.join(homedir17, ".node_libraries")
175085
176070
  ];
175086
176071
  };
175087
176072
  var defaultIsFile = function isFile(file, cb) {
@@ -175567,11 +176552,11 @@ var require_sync = __commonJS({
175567
176552
  var nodeModulesPaths = require_node_modules_paths();
175568
176553
  var normalizeOptions = require_normalize_options();
175569
176554
  var realpathFS = process.platform !== "win32" && fs51.realpathSync && typeof fs51.realpathSync.native === "function" ? fs51.realpathSync.native : fs51.realpathSync;
175570
- var homedir16 = getHomedir();
176555
+ var homedir17 = getHomedir();
175571
176556
  var defaultPaths = function() {
175572
176557
  return [
175573
- path53.join(homedir16, ".node_modules"),
175574
- path53.join(homedir16, ".node_libraries")
176558
+ path53.join(homedir17, ".node_modules"),
176559
+ path53.join(homedir17, ".node_libraries")
175575
176560
  ];
175576
176561
  };
175577
176562
  var defaultIsFile = function isFile(file) {
@@ -175608,8 +176593,8 @@ var require_sync = __commonJS({
175608
176593
  }
175609
176594
  return x;
175610
176595
  };
175611
- var defaultReadPackageSync = function defaultReadPackageSync2(readFileSync16, pkgfile) {
175612
- var body = readFileSync16(pkgfile);
176596
+ var defaultReadPackageSync = function defaultReadPackageSync2(readFileSync17, pkgfile) {
176597
+ var body = readFileSync17(pkgfile);
175613
176598
  try {
175614
176599
  var pkg2 = JSON.parse(body);
175615
176600
  return pkg2;
@@ -175629,7 +176614,7 @@ var require_sync = __commonJS({
175629
176614
  }
175630
176615
  var opts = normalizeOptions(x, options);
175631
176616
  var isFile = opts.isFile || defaultIsFile;
175632
- var readFileSync16 = opts.readFileSync || fs51.readFileSync;
176617
+ var readFileSync17 = opts.readFileSync || fs51.readFileSync;
175633
176618
  var isDirectory = opts.isDirectory || defaultIsDir;
175634
176619
  var realpathSync2 = opts.realpathSync || defaultRealpathSync;
175635
176620
  var readPackageSync2 = opts.readPackageSync || defaultReadPackageSync;
@@ -175686,7 +176671,7 @@ var require_sync = __commonJS({
175686
176671
  if (!isFile(pkgfile)) {
175687
176672
  return loadpkg(path53.dirname(dir));
175688
176673
  }
175689
- var pkg2 = readPackageSync2(readFileSync16, pkgfile);
176674
+ var pkg2 = readPackageSync2(readFileSync17, pkgfile);
175690
176675
  if (pkg2 && opts.packageFilter) {
175691
176676
  pkg2 = opts.packageFilter(
175692
176677
  pkg2,
@@ -175700,7 +176685,7 @@ var require_sync = __commonJS({
175700
176685
  var pkgfile = path53.join(maybeRealpathSync(realpathSync2, x2, opts), "/package.json");
175701
176686
  if (isFile(pkgfile)) {
175702
176687
  try {
175703
- var pkg2 = readPackageSync2(readFileSync16, pkgfile);
176688
+ var pkg2 = readPackageSync2(readFileSync17, pkgfile);
175704
176689
  } catch (e2) {
175705
176690
  }
175706
176691
  if (pkg2 && opts.packageFilter) {
@@ -180708,7 +181693,7 @@ var init_user_id = __esm({
180708
181693
  "use strict";
180709
181694
  init_paths();
180710
181695
  homeDir = os7.homedir() ?? "";
180711
- geminiDir = path20.join(homeDir, GEMINI_DIR2);
181696
+ geminiDir = path20.join(homeDir, MPDAI_DIR2);
180712
181697
  installationIdFile = path20.join(geminiDir, "installation_id");
180713
181698
  }
180714
181699
  });
@@ -203445,7 +204430,7 @@ var init_fileDiscoveryService = __esm({
203445
204430
  "use strict";
203446
204431
  init_gitIgnoreParser();
203447
204432
  init_gitUtils();
203448
- GEMINI_IGNORE_FILE_NAME = ".geminiignore";
204433
+ GEMINI_IGNORE_FILE_NAME = ".mpdaiignore";
203449
204434
  FileDiscoveryService = class {
203450
204435
  gitIgnoreFilter = null;
203451
204436
  geminiIgnoreFilter = null;
@@ -203516,7 +204501,7 @@ var init_fileDiscoveryService = __esm({
203516
204501
  return false;
203517
204502
  }
203518
204503
  /**
203519
- * Returns loaded patterns from .geminiignore
204504
+ * Returns loaded patterns from .mpdaiignore
203520
204505
  */
203521
204506
  getGeminiIgnorePatterns() {
203522
204507
  return this.geminiIgnoreFilter?.getPatterns() ?? [];
@@ -208065,7 +209050,7 @@ var init_gitService = __esm({
208065
209050
  }
208066
209051
  getHistoryDir() {
208067
209052
  const hash = getProjectHash(this.projectRoot);
208068
- return path23.join(os8.homedir(), GEMINI_DIR2, "history", hash);
209053
+ return path23.join(os8.homedir(), MPDAI_DIR2, "history", hash);
208069
209054
  }
208070
209055
  async initialize() {
208071
209056
  if (!isGitRepository(this.projectRoot)) {
@@ -208346,7 +209331,7 @@ async function getGeminiMdFilePathsInternal(currentWorkingDirectory, userHomePat
208346
209331
  for (const geminiMdFilename of geminiMdFilenames) {
208347
209332
  const resolvedCwd = path26.resolve(currentWorkingDirectory);
208348
209333
  const resolvedHome = path26.resolve(userHomePath);
208349
- const globalMemoryPath = path26.join(resolvedHome, GEMINI_CONFIG_DIR, geminiMdFilename);
209334
+ const globalMemoryPath = path26.join(resolvedHome, MPDAI_CONFIG_DIR, geminiMdFilename);
208350
209335
  if (debugMode)
208351
209336
  logger3.debug(`Searching for ${geminiMdFilename} starting from CWD: ${resolvedCwd}`);
208352
209337
  if (debugMode)
@@ -208370,7 +209355,7 @@ async function getGeminiMdFilePathsInternal(currentWorkingDirectory, userHomePat
208370
209355
  if (debugMode) {
208371
209356
  logger3.debug(`Checking for ${geminiMdFilename} in (upward scan): ${currentDir}`);
208372
209357
  }
208373
- if (currentDir === path26.join(resolvedHome, GEMINI_CONFIG_DIR)) {
209358
+ if (currentDir === path26.join(resolvedHome, MPDAI_CONFIG_DIR)) {
208374
209359
  if (debugMode) {
208375
209360
  logger3.debug(`Upward scan reached global config dir path, stopping upward search here: ${currentDir}`);
208376
209361
  }
@@ -208516,6 +209501,9 @@ var init_telemetry = __esm({
208516
209501
  // packages/core/dist/src/config/config.js
208517
209502
  import * as path27 from "node:path";
208518
209503
  import process21 from "node:process";
209504
+ import { existsSync as existsSync6, readFileSync as readFileSync6 } from "node:fs";
209505
+ import { join as join11 } from "node:path";
209506
+ import { homedir as homedir6 } from "node:os";
208519
209507
  var ApprovalMode, MCPServerConfig, Config;
208520
209508
  var init_config2 = __esm({
208521
209509
  "packages/core/dist/src/config/config.js"() {
@@ -208532,6 +209520,11 @@ var init_config2 = __esm({
208532
209520
  init_read_many_files();
208533
209521
  init_web_fetch();
208534
209522
  init_web_search();
209523
+ init_confluence_get_page();
209524
+ init_jira_get_issue();
209525
+ init_bitbucket_get_pr_diff();
209526
+ init_bitbucket_add_pr_comment();
209527
+ init_bitbucket_add_pr_inline_comment();
208535
209528
  init_memoryTool();
208536
209529
  init_client3();
208537
209530
  init_fileDiscoveryService();
@@ -208798,7 +209791,7 @@ var init_config2 = __esm({
208798
209791
  return this.geminiClient;
208799
209792
  }
208800
209793
  getGeminiDir() {
208801
- return path27.join(this.targetDir, GEMINI_CONFIG_DIR);
209794
+ return path27.join(this.targetDir, MPDAI_CONFIG_DIR);
208802
209795
  }
208803
209796
  getProjectTempDir() {
208804
209797
  return getProjectTempDir(this.getProjectRoot());
@@ -208852,6 +209845,72 @@ var init_config2 = __esm({
208852
209845
  this.setGeminiMdFileCount(fileCount);
208853
209846
  return { memoryContent, fileCount };
208854
209847
  }
209848
+ /**
209849
+ * Get Confluence Advanced Access Token from keys.json
209850
+ * @returns The Personal Access Token or null if not found
209851
+ */
209852
+ getConfluenceToken() {
209853
+ try {
209854
+ const keysJsonPath = join11(homedir6(), ".mpdai", "keys.json");
209855
+ if (!existsSync6(keysJsonPath)) {
209856
+ return null;
209857
+ }
209858
+ const content = readFileSync6(keysJsonPath, "utf-8");
209859
+ const keys = JSON.parse(content);
209860
+ const confluenceKey = keys.find((key) => key.name === "confluence");
209861
+ if (confluenceKey && confluenceKey.value1) {
209862
+ return confluenceKey.value1;
209863
+ }
209864
+ return null;
209865
+ } catch (error) {
209866
+ console.error("Failed to read Confluence token from keys.json:", error);
209867
+ return null;
209868
+ }
209869
+ }
209870
+ /**
209871
+ * Get Jira Personal Access Token from keys.json
209872
+ * @returns The Personal Access Token or null if not found
209873
+ */
209874
+ getJiraToken() {
209875
+ try {
209876
+ const keysJsonPath = join11(homedir6(), ".mpdai", "keys.json");
209877
+ if (!existsSync6(keysJsonPath)) {
209878
+ return null;
209879
+ }
209880
+ const content = readFileSync6(keysJsonPath, "utf-8");
209881
+ const keys = JSON.parse(content);
209882
+ const jiraKey = keys.find((key) => key.name === "jira");
209883
+ if (jiraKey && jiraKey.value1) {
209884
+ return jiraKey.value1;
209885
+ }
209886
+ return null;
209887
+ } catch (error) {
209888
+ console.error("Failed to read Jira token from keys.json:", error);
209889
+ return null;
209890
+ }
209891
+ }
209892
+ /**
209893
+ * Get Bitbucket Personal Access Token from keys.json
209894
+ * @returns The Personal Access Token or null if not found
209895
+ */
209896
+ getBitbucketToken() {
209897
+ try {
209898
+ const keysJsonPath = join11(homedir6(), ".mpdai", "keys.json");
209899
+ if (!existsSync6(keysJsonPath)) {
209900
+ return null;
209901
+ }
209902
+ const content = readFileSync6(keysJsonPath, "utf-8");
209903
+ const keys = JSON.parse(content);
209904
+ const bitbucketKey = keys.find((key) => key.name === "bitbucket");
209905
+ if (bitbucketKey && bitbucketKey.value1) {
209906
+ return bitbucketKey.value1;
209907
+ }
209908
+ return null;
209909
+ } catch (error) {
209910
+ console.error("Failed to read Bitbucket token from keys.json:", error);
209911
+ return null;
209912
+ }
209913
+ }
208855
209914
  async createToolRegistry() {
208856
209915
  const registry = new ToolRegistry(this);
208857
209916
  const targetDir = this.getTargetDir();
@@ -208884,9 +209943,24 @@ var init_config2 = __esm({
208884
209943
  registerCoreTool(EditTool, this);
208885
209944
  registerCoreTool(WriteFileTool, this);
208886
209945
  }
208887
- if (process21.env.USE_GEMINI_TOOL) {
209946
+ const useMpdaiTool = process21.env.USE_MPDAI_TOOL !== "false";
209947
+ if (useMpdaiTool) {
208888
209948
  registerCoreTool(WebFetchTool, this);
208889
209949
  registerCoreTool(WebSearchTool, this);
209950
+ const confluenceToken = this.getConfluenceToken();
209951
+ if (confluenceToken) {
209952
+ registerCoreTool(ConfluenceGetPageTool, this);
209953
+ }
209954
+ const jiraToken = this.getJiraToken();
209955
+ if (jiraToken) {
209956
+ registerCoreTool(JiraGetIssueTool, this);
209957
+ }
209958
+ const bitbucketToken = this.getBitbucketToken();
209959
+ if (bitbucketToken) {
209960
+ registerCoreTool(BitbucketGetPrDiffTool, this);
209961
+ registerCoreTool(BitbucketAddPrCommentTool, this);
209962
+ registerCoreTool(BitbucketAddPrInlineCommentTool, this);
209963
+ }
208890
209964
  }
208891
209965
  await registry.discoverTools();
208892
209966
  return registry;
@@ -209923,8 +210997,6 @@ __export(dist_exports, {
209923
210997
  EndSessionEvent: () => EndSessionEvent,
209924
210998
  FileDiscoveryService: () => FileDiscoveryService,
209925
210999
  ForbiddenError: () => ForbiddenError,
209926
- GEMINI_CONFIG_DIR: () => GEMINI_CONFIG_DIR,
209927
- GEMINI_DIR: () => GEMINI_DIR2,
209928
211000
  GeminiChat: () => GeminiChat,
209929
211001
  GeminiClient: () => GeminiClient,
209930
211002
  GeminiEventType: () => GeminiEventType,
@@ -209940,6 +211012,8 @@ __export(dist_exports, {
209940
211012
  MCPServerStatus: () => MCPServerStatus,
209941
211013
  MCP_DEFAULT_TIMEOUT_MSEC: () => MCP_DEFAULT_TIMEOUT_MSEC,
209942
211014
  MEMORY_SECTION_HEADER: () => MEMORY_SECTION_HEADER,
211015
+ MPDAI_CONFIG_DIR: () => MPDAI_CONFIG_DIR,
211016
+ MPDAI_DIR: () => MPDAI_DIR2,
209943
211017
  MemoryTool: () => MemoryTool,
209944
211018
  MessageSenderType: () => MessageSenderType,
209945
211019
  OnboardUserStatusCode: () => OnboardUserStatusCode,
@@ -214095,9 +215169,9 @@ var init_lib3 = __esm({
214095
215169
  });
214096
215170
 
214097
215171
  // packages/cli/src/telemetry/langfuseConfig.ts
214098
- import { readFileSync as readFileSync6, existsSync as existsSync6 } from "fs";
214099
- import { join as join11 } from "path";
214100
- import { homedir as homedir6 } from "os";
215172
+ import { readFileSync as readFileSync7, existsSync as existsSync7 } from "fs";
215173
+ import { join as join12 } from "path";
215174
+ import { homedir as homedir7 } from "os";
214101
215175
  var LangfuseConfigManager;
214102
215176
  var init_langfuseConfig = __esm({
214103
215177
  "packages/cli/src/telemetry/langfuseConfig.ts"() {
@@ -214118,15 +215192,15 @@ var init_langfuseConfig = __esm({
214118
215192
  return this.config;
214119
215193
  }
214120
215194
  try {
214121
- const userConfigPath = join11(homedir6(), ".gemini", "settings.conf");
214122
- if (existsSync6(userConfigPath)) {
214123
- const configContent = readFileSync6(userConfigPath, "utf-8");
215195
+ const userConfigPath = join12(homedir7(), ".mpdai", "settings.conf");
215196
+ if (existsSync7(userConfigPath)) {
215197
+ const configContent = readFileSync7(userConfigPath, "utf-8");
214124
215198
  this.config = JSON.parse(configContent);
214125
215199
  return this.config;
214126
215200
  }
214127
- const projectConfigPath = join11(process.cwd(), ".langfuse", "settings.conf");
214128
- if (existsSync6(projectConfigPath)) {
214129
- const configContent = readFileSync6(projectConfigPath, "utf-8");
215201
+ const projectConfigPath = join12(process.cwd(), ".langfuse", "settings.conf");
215202
+ if (existsSync7(projectConfigPath)) {
215203
+ const configContent = readFileSync7(projectConfigPath, "utf-8");
214130
215204
  this.config = JSON.parse(configContent);
214131
215205
  return this.config;
214132
215206
  }
@@ -214158,9 +215232,9 @@ var init_langfuseConfig = __esm({
214158
215232
  });
214159
215233
 
214160
215234
  // packages/cli/src/telemetry/langfuseClient.ts
214161
- import { join as join12 } from "path";
214162
- import { homedir as homedir7 } from "os";
214163
- import { existsSync as existsSync7, readFileSync as readFileSync7 } from "fs";
215235
+ import { join as join13 } from "path";
215236
+ import { homedir as homedir8 } from "os";
215237
+ import { existsSync as existsSync8, readFileSync as readFileSync8 } from "fs";
214164
215238
  var LangfuseClient;
214165
215239
  var init_langfuseClient = __esm({
214166
215240
  "packages/cli/src/telemetry/langfuseClient.ts"() {
@@ -214262,7 +215336,7 @@ var init_langfuseClient = __esm({
214262
215336
  userId,
214263
215337
  metadata: {
214264
215338
  ...safeMetadata,
214265
- cli_version: this.safeString("0.1.25", "unknown"),
215339
+ cli_version: this.safeString("0.1.28", "unknown"),
214266
215340
  model: this.safeString(process.env.CUSTOM_LLM_MODEL_NAME, "gemini"),
214267
215341
  auth_type: process.env.USE_CUSTOM_LLM ? "custom_llm" : "google_oauth",
214268
215342
  environment: this.safeString(this.configManager.getConfig()?.environment, "unknown")
@@ -214574,9 +215648,9 @@ var init_langfuseClient = __esm({
214574
215648
  // 获取用户ID
214575
215649
  getUserId() {
214576
215650
  try {
214577
- const userJsonPath = join12(homedir7(), ".gemini", "user.json");
214578
- if (existsSync7(userJsonPath)) {
214579
- const content = readFileSync7(userJsonPath, "utf-8");
215651
+ const userJsonPath = join13(homedir8(), ".mpdai", "user.json");
215652
+ if (existsSync8(userJsonPath)) {
215653
+ const content = readFileSync8(userJsonPath, "utf-8");
214580
215654
  const userData = JSON.parse(content);
214581
215655
  if (userData.username) {
214582
215656
  return userData.username;
@@ -215429,7 +216503,7 @@ var init_langfuseIntegration = __esm({
215429
216503
  const metadata = {
215430
216504
  model: this.config.getModel(),
215431
216505
  auth_type: this.config.getContentGeneratorConfig()?.authType,
215432
- cli_version: "0.1.25",
216506
+ cli_version: "0.1.28",
215433
216507
  start_time: (/* @__PURE__ */ new Date()).toISOString(),
215434
216508
  session_id: this.sessionId
215435
216509
  };
@@ -215488,7 +216562,7 @@ var init_langfuseIntegration = __esm({
215488
216562
  totalCachedTokens: sessionStats.totalCachedTokens,
215489
216563
  totalPromptTokens: sessionStats.totalPromptTokens,
215490
216564
  metadata: {
215491
- cli_version: "0.1.25",
216565
+ cli_version: "0.1.28",
215492
216566
  auth_type: this.config.getContentGeneratorConfig()?.authType,
215493
216567
  session_end_time: (/* @__PURE__ */ new Date()).toISOString()
215494
216568
  }
@@ -215560,7 +216634,7 @@ var init_langfuseIntegration = __esm({
215560
216634
  error,
215561
216635
  metadata: {
215562
216636
  session_id: this.sessionId,
215563
- cli_version: "0.1.25",
216637
+ cli_version: "0.1.28",
215564
216638
  auth_type: this.config.getContentGeneratorConfig()?.authType
215565
216639
  }
215566
216640
  });
@@ -220730,9 +221804,9 @@ var require_normalize2 = __commonJS({
220730
221804
  });
220731
221805
 
220732
221806
  // packages/cli/src/config/mpdaiConfig.ts
220733
- import { readFileSync as readFileSync8, existsSync as existsSync9 } from "fs";
220734
- import { join as join14 } from "path";
220735
- import { homedir as homedir9 } from "os";
221807
+ import { readFileSync as readFileSync9, existsSync as existsSync10 } from "fs";
221808
+ import { join as join15 } from "path";
221809
+ import { homedir as homedir10 } from "os";
220736
221810
  var MpdaiConfigManager;
220737
221811
  var init_mpdaiConfig = __esm({
220738
221812
  "packages/cli/src/config/mpdaiConfig.ts"() {
@@ -220753,15 +221827,15 @@ var init_mpdaiConfig = __esm({
220753
221827
  return this.config;
220754
221828
  }
220755
221829
  try {
220756
- const userConfigPath = join14(homedir9(), ".gemini", "config.json");
220757
- if (existsSync9(userConfigPath)) {
220758
- const configContent = readFileSync8(userConfigPath, "utf-8");
221830
+ const userConfigPath = join15(homedir10(), ".mpdai", "config.json");
221831
+ if (existsSync10(userConfigPath)) {
221832
+ const configContent = readFileSync9(userConfigPath, "utf-8");
220759
221833
  this.config = JSON.parse(configContent);
220760
221834
  return this.config;
220761
221835
  }
220762
- const projectConfigPath = join14(process.cwd(), ".mpdai", "config.json");
220763
- if (existsSync9(projectConfigPath)) {
220764
- const configContent = readFileSync8(projectConfigPath, "utf-8");
221836
+ const projectConfigPath = join15(process.cwd(), ".mpdai", "config.json");
221837
+ if (existsSync10(projectConfigPath)) {
221838
+ const configContent = readFileSync9(projectConfigPath, "utf-8");
220765
221839
  this.config = JSON.parse(configContent);
220766
221840
  return this.config;
220767
221841
  }
@@ -222015,9 +223089,9 @@ var EnvConfigManager_exports = {};
222015
223089
  __export(EnvConfigManager_exports, {
222016
223090
  EnvConfigManager: () => EnvConfigManager
222017
223091
  });
222018
- import { readFileSync as readFileSync9, writeFileSync as writeFileSync3, existsSync as existsSync10, mkdirSync as mkdirSync3 } from "fs";
222019
- import { join as join15, dirname as dirname6 } from "path";
222020
- import { homedir as homedir10 } from "os";
223092
+ import { readFileSync as readFileSync10, writeFileSync as writeFileSync3, existsSync as existsSync11, mkdirSync as mkdirSync3 } from "fs";
223093
+ import { join as join16, dirname as dirname6 } from "path";
223094
+ import { homedir as homedir11 } from "os";
222021
223095
  var EnvConfigManager;
222022
223096
  var init_EnvConfigManager = __esm({
222023
223097
  "packages/cli/src/services/EnvConfigManager.ts"() {
@@ -222026,7 +223100,7 @@ var init_EnvConfigManager = __esm({
222026
223100
  envPaths;
222027
223101
  constructor() {
222028
223102
  this.envPaths = [
222029
- ".gemini/.env",
223103
+ ".mpdai/.env",
222030
223104
  // 项目级别的gemini配置
222031
223105
  ".env"
222032
223106
  // 项目级别的通用配置
@@ -222039,17 +223113,17 @@ var init_EnvConfigManager = __esm({
222039
223113
  let currentDir = startDir;
222040
223114
  while (true) {
222041
223115
  for (const envPath of this.envPaths) {
222042
- const fullPath = join15(currentDir, envPath);
222043
- if (existsSync10(fullPath)) {
223116
+ const fullPath = join16(currentDir, envPath);
223117
+ if (existsSync11(fullPath)) {
222044
223118
  return fullPath;
222045
223119
  }
222046
223120
  }
222047
- const parentDir = join15(currentDir, "..");
223121
+ const parentDir = join16(currentDir, "..");
222048
223122
  if (parentDir === currentDir) {
222049
- const homeDir2 = homedir10();
223123
+ const homeDir2 = homedir11();
222050
223124
  for (const envPath of this.envPaths) {
222051
- const fullPath = join15(homeDir2, envPath);
222052
- if (existsSync10(fullPath)) {
223125
+ const fullPath = join16(homeDir2, envPath);
223126
+ if (existsSync11(fullPath)) {
222053
223127
  return fullPath;
222054
223128
  }
222055
223129
  }
@@ -222064,7 +223138,7 @@ var init_EnvConfigManager = __esm({
222064
223138
  */
222065
223139
  readEnvFile(envPath) {
222066
223140
  try {
222067
- const content = readFileSync9(envPath, "utf-8");
223141
+ const content = readFileSync10(envPath, "utf-8");
222068
223142
  const envVars = {};
222069
223143
  content.split("\n").forEach((line) => {
222070
223144
  line = line.trim();
@@ -222109,7 +223183,7 @@ var init_EnvConfigManager = __esm({
222109
223183
  const isDebugMode = process.env.DEBUG === "true" || process.env.DEBUG_MODE === "true" || process.env.dev === "true";
222110
223184
  try {
222111
223185
  const dir = dirname6(envPath);
222112
- if (!existsSync10(dir)) {
223186
+ if (!existsSync11(dir)) {
222113
223187
  mkdirSync3(dir, { recursive: true });
222114
223188
  }
222115
223189
  const envContent = Object.entries(envConfig).map(([key, value]) => `${key}=${value}`).join("\n") + "\n";
@@ -222126,8 +223200,8 @@ var init_EnvConfigManager = __esm({
222126
223200
  * 更新或创建.env文件
222127
223201
  */
222128
223202
  updateEnvFile(model, targetPath) {
222129
- const envPath = targetPath || this.findEnvFile(process.cwd()) || join15(process.cwd(), ".gemini", ".env");
222130
- const existingConfig = existsSync10(envPath) ? this.readEnvFile(envPath) : {};
223203
+ const envPath = targetPath || this.findEnvFile(process.cwd()) || join16(process.cwd(), ".mpdai", ".env");
223204
+ const existingConfig = existsSync11(envPath) ? this.readEnvFile(envPath) : {};
222131
223205
  const newConfig = this.generateEnvConfig(model, existingConfig);
222132
223206
  this.writeEnvFile(newConfig, envPath);
222133
223207
  return envPath;
@@ -222512,9 +223586,9 @@ var AuthService_exports = {};
222512
223586
  __export(AuthService_exports, {
222513
223587
  AuthService: () => AuthService
222514
223588
  });
222515
- import { readFileSync as readFileSync10, writeFileSync as writeFileSync4, existsSync as existsSync11, mkdirSync as mkdirSync4 } from "fs";
222516
- import { join as join16 } from "path";
222517
- import { homedir as homedir11 } from "os";
223589
+ import { readFileSync as readFileSync11, writeFileSync as writeFileSync4, existsSync as existsSync12, mkdirSync as mkdirSync4 } from "fs";
223590
+ import { join as join17 } from "path";
223591
+ import { homedir as homedir12 } from "os";
222518
223592
  var readlineSync, AuthService;
222519
223593
  var init_AuthService = __esm({
222520
223594
  "packages/cli/src/services/AuthService.ts"() {
@@ -222524,18 +223598,20 @@ var init_AuthService = __esm({
222524
223598
  readlineSync = __toESM(require_readline_sync(), 1);
222525
223599
  AuthService = class {
222526
223600
  userJsonPath;
223601
+ keysJsonPath;
222527
223602
  authApiUrl;
222528
223603
  mpdaiConfig;
222529
223604
  constructor(authApiUrl) {
222530
223605
  this.mpdaiConfig = MpdaiConfigManager.getInstance();
222531
223606
  this.authApiUrl = authApiUrl || this.mpdaiConfig.getAuthUrl();
222532
- this.userJsonPath = join16(homedir11(), ".gemini", "user.json");
223607
+ this.userJsonPath = join17(homedir12(), ".mpdai", "user.json");
223608
+ this.keysJsonPath = join17(homedir12(), ".mpdai", "keys.json");
222533
223609
  }
222534
223610
  /**
222535
223611
  * 检查本地是否存在用户凭据文件
222536
223612
  */
222537
223613
  hasLocalCredentials() {
222538
- return existsSync11(this.userJsonPath);
223614
+ return existsSync12(this.userJsonPath);
222539
223615
  }
222540
223616
  /**
222541
223617
  * 从本地文件读取用户凭据
@@ -222545,7 +223621,7 @@ var init_AuthService = __esm({
222545
223621
  if (!this.hasLocalCredentials()) {
222546
223622
  return null;
222547
223623
  }
222548
- const content = readFileSync10(this.userJsonPath, "utf-8");
223624
+ const content = readFileSync11(this.userJsonPath, "utf-8");
222549
223625
  const credentials = JSON.parse(content);
222550
223626
  if (credentials.encodedPassword) {
222551
223627
  credentials.password = Buffer.from(credentials.encodedPassword, "base64").toString("utf-8");
@@ -222562,8 +223638,8 @@ var init_AuthService = __esm({
222562
223638
  */
222563
223639
  saveCredentials(credentials) {
222564
223640
  try {
222565
- const dir = join16(homedir11(), ".gemini");
222566
- if (!existsSync11(dir)) {
223641
+ const dir = join17(homedir12(), ".mpdai");
223642
+ if (!existsSync12(dir)) {
222567
223643
  mkdirSync4(dir, { recursive: true });
222568
223644
  }
222569
223645
  const credentialsToSave = {
@@ -222576,6 +223652,43 @@ var init_AuthService = __esm({
222576
223652
  throw error;
222577
223653
  }
222578
223654
  }
223655
+ /**
223656
+ * 检查本地是否存在 keys 文件
223657
+ */
223658
+ hasLocalKeys() {
223659
+ return existsSync12(this.keysJsonPath);
223660
+ }
223661
+ /**
223662
+ * 从本地文件读取 keys
223663
+ */
223664
+ getLocalKeys() {
223665
+ try {
223666
+ if (!this.hasLocalKeys()) {
223667
+ return null;
223668
+ }
223669
+ const content = readFileSync11(this.keysJsonPath, "utf-8");
223670
+ const keys = JSON.parse(content);
223671
+ return keys;
223672
+ } catch (error) {
223673
+ console.error("Failed to read keys:", error);
223674
+ return null;
223675
+ }
223676
+ }
223677
+ /**
223678
+ * 保存 keys 到本地文件
223679
+ */
223680
+ saveKeys(keys) {
223681
+ try {
223682
+ const dir = join17(homedir12(), ".mpdai");
223683
+ if (!existsSync12(dir)) {
223684
+ mkdirSync4(dir, { recursive: true });
223685
+ }
223686
+ writeFileSync4(this.keysJsonPath, JSON.stringify(keys, null, 2), "utf-8");
223687
+ } catch (error) {
223688
+ console.error("Failed to save keys:", error);
223689
+ throw error;
223690
+ }
223691
+ }
222579
223692
  /**
222580
223693
  * 调用认证接口获取用户数据
222581
223694
  */
@@ -222675,6 +223788,12 @@ var init_AuthService = __esm({
222675
223788
  if (!this.hasLocalCredentials()) {
222676
223789
  this.saveCredentials(credentials);
222677
223790
  }
223791
+ if (authResponse.keys && authResponse.keys.length > 0) {
223792
+ this.saveKeys(authResponse.keys);
223793
+ if (isDebugMode) {
223794
+ console.log(`Saved ${authResponse.keys.length} keys to local storage`);
223795
+ }
223796
+ }
222678
223797
  return authResponse;
222679
223798
  }
222680
223799
  /**
@@ -231670,7 +232789,7 @@ var require_require_directory = __commonJS({
231670
232789
  "node_modules/require-directory/index.js"(exports2, module2) {
231671
232790
  "use strict";
231672
232791
  var fs51 = __require("fs");
231673
- var join24 = __require("path").join;
232792
+ var join25 = __require("path").join;
231674
232793
  var resolve18 = __require("path").resolve;
231675
232794
  var dirname11 = __require("path").dirname;
231676
232795
  var defaultOptions2 = {
@@ -231707,7 +232826,7 @@ var require_require_directory = __commonJS({
231707
232826
  }
231708
232827
  path53 = !path53 ? dirname11(m.filename) : resolve18(dirname11(m.filename), path53);
231709
232828
  fs51.readdirSync(path53).forEach(function(filename) {
231710
- var joined = join24(path53, filename), files, key, obj;
232829
+ var joined = join25(path53, filename), files, key, obj;
231711
232830
  if (fs51.statSync(joined).isDirectory() && options.recurse) {
231712
232831
  files = requireDirectory(m, joined, options);
231713
232832
  if (Object.keys(files).length) {
@@ -235477,7 +236596,7 @@ var require_minimist = __commonJS({
235477
236596
  var require_rc = __commonJS({
235478
236597
  "node_modules/rc/index.js"(exports2, module2) {
235479
236598
  var cc = require_utils13();
235480
- var join24 = __require("path").join;
236599
+ var join25 = __require("path").join;
235481
236600
  var deepExtend = require_deep_extend();
235482
236601
  var etc = "/etc";
235483
236602
  var win = process.platform === "win32";
@@ -235502,15 +236621,15 @@ var require_rc = __commonJS({
235502
236621
  }
235503
236622
  if (!win)
235504
236623
  [
235505
- join24(etc, name2, "config"),
235506
- join24(etc, name2 + "rc")
236624
+ join25(etc, name2, "config"),
236625
+ join25(etc, name2 + "rc")
235507
236626
  ].forEach(addConfigFile);
235508
236627
  if (home)
235509
236628
  [
235510
- join24(home, ".config", name2, "config"),
235511
- join24(home, ".config", name2),
235512
- join24(home, "." + name2, "config"),
235513
- join24(home, "." + name2 + "rc")
236629
+ join25(home, ".config", name2, "config"),
236630
+ join25(home, ".config", name2),
236631
+ join25(home, "." + name2, "config"),
236632
+ join25(home, "." + name2 + "rc")
235514
236633
  ].forEach(addConfigFile);
235515
236634
  addConfigFile(cc.find("." + name2 + "rc"));
235516
236635
  if (env6.config) addConfigFile(env6.config);
@@ -251824,7 +252943,7 @@ import { promises as fs33 } from "fs";
251824
252943
  import path37 from "path";
251825
252944
 
251826
252945
  // packages/cli/src/generated/git-commit.ts
251827
- var GIT_COMMIT_INFO = "220545e (local modifications)";
252946
+ var GIT_COMMIT_INFO = "92a0c14 (local modifications)";
251828
252947
 
251829
252948
  // node_modules/read-package-up/index.js
251830
252949
  import path35 from "node:path";
@@ -252037,7 +253156,7 @@ async function getPackageJson() {
252037
253156
  // packages/cli/src/utils/version.ts
252038
253157
  async function getCliVersion() {
252039
253158
  const pkgJson = await getPackageJson();
252040
- return "0.1.25";
253159
+ return "0.1.28";
252041
253160
  }
252042
253161
 
252043
253162
  // packages/cli/src/ui/commands/memoryCommand.ts
@@ -252156,9 +253275,9 @@ var clearCommand = {
252156
253275
  };
252157
253276
 
252158
253277
  // packages/cli/src/ui/commands/logoutCommand.ts
252159
- import { existsSync as existsSync8, unlinkSync } from "fs";
252160
- import { join as join13 } from "path";
252161
- import { homedir as homedir8 } from "os";
253278
+ import { existsSync as existsSync9, unlinkSync } from "fs";
253279
+ import { join as join14 } from "path";
253280
+ import { homedir as homedir9 } from "os";
252162
253281
  var logoutCommand = {
252163
253282
  name: "logout",
252164
253283
  description: "logout and clear user credentials and settings, then exit",
@@ -252166,8 +253285,8 @@ var logoutCommand = {
252166
253285
  const now = /* @__PURE__ */ new Date();
252167
253286
  const { sessionStartTime } = context2.session.stats;
252168
253287
  const wallDuration = now.getTime() - sessionStartTime.getTime();
252169
- const userJsonPath = join13(homedir8(), ".gemini", "user.json");
252170
- if (existsSync8(userJsonPath)) {
253288
+ const userJsonPath = join14(homedir9(), ".mpdai", "user.json");
253289
+ if (existsSync9(userJsonPath)) {
252171
253290
  try {
252172
253291
  unlinkSync(userJsonPath);
252173
253292
  context2.ui.addItem({
@@ -252181,8 +253300,23 @@ var logoutCommand = {
252181
253300
  }, now.getTime());
252182
253301
  }
252183
253302
  }
252184
- const userSettingsPath = join13(homedir8(), ".gemini", "settings.json");
252185
- if (existsSync8(userSettingsPath)) {
253303
+ const keysJsonPath = join14(homedir9(), ".mpdai", "keys.json");
253304
+ if (existsSync9(keysJsonPath)) {
253305
+ try {
253306
+ unlinkSync(keysJsonPath);
253307
+ context2.ui.addItem({
253308
+ type: "info" /* INFO */,
253309
+ text: "\u2705 Keys cleared"
253310
+ }, now.getTime());
253311
+ } catch (error) {
253312
+ context2.ui.addItem({
253313
+ type: "error" /* ERROR */,
253314
+ text: `\u274C Failed to clear keys: ${error}`
253315
+ }, now.getTime());
253316
+ }
253317
+ }
253318
+ const userSettingsPath = join14(homedir9(), ".mpdai", "settings.json");
253319
+ if (existsSync9(userSettingsPath)) {
252186
253320
  try {
252187
253321
  unlinkSync(userSettingsPath);
252188
253322
  context2.ui.addItem({
@@ -252416,9 +253550,9 @@ var useSlashCommandProcessor = (config2, settings, history, addItem, clearItems,
252416
253550
  // `/help` and `/clear` have been migrated and REMOVED from this list.
252417
253551
  {
252418
253552
  name: "docs",
252419
- description: "open full Gemini CLI documentation in your browser",
253553
+ description: "open full MPD AI CLI documentation in your browser",
252420
253554
  action: async (_mainCommand, _subCommand, _args) => {
252421
- const docsUrl = "https://goo.gle/gemini-cli-docs";
253555
+ const docsUrl = "http://lb-100-123-141-85.lbaas.jpe2f.dcnw.rakuten/management/docs/";
252422
253556
  if (process25.env.SANDBOX && process25.env.SANDBOX !== "sandbox-exec") {
252423
253557
  addMessage({
252424
253558
  type: "info" /* INFO */,
@@ -253076,7 +254210,7 @@ ${bugReportUrl}`,
253076
254210
  if (!checkpointDir) {
253077
254211
  addMessage({
253078
254212
  type: "error" /* ERROR */,
253079
- content: "Could not determine the .gemini directory path.",
254213
+ content: "Could not determine the .mpdai directory path.",
253080
254214
  timestamp: /* @__PURE__ */ new Date()
253081
254215
  });
253082
254216
  return;
@@ -269438,9 +270572,9 @@ init_dist3();
269438
270572
  var import_strip_json_comments = __toESM(require_strip_json_comments(), 1);
269439
270573
  import * as fs36 from "fs";
269440
270574
  import * as path40 from "path";
269441
- import { homedir as homedir12 } from "os";
269442
- var SETTINGS_DIRECTORY_NAME = ".gemini";
269443
- var USER_SETTINGS_DIR = path40.join(homedir12(), SETTINGS_DIRECTORY_NAME);
270575
+ import { homedir as homedir13 } from "os";
270576
+ var SETTINGS_DIRECTORY_NAME = ".mpdai";
270577
+ var USER_SETTINGS_DIR = path40.join(homedir13(), SETTINGS_DIRECTORY_NAME);
269444
270578
  var USER_SETTINGS_PATH = path40.join(USER_SETTINGS_DIR, "settings.json");
269445
270579
  var LoadedSettings = class {
269446
270580
  constructor(user, workspace, errors) {
@@ -269513,7 +270647,7 @@ function resolveEnvVarsInObject(obj) {
269513
270647
  function findEnvFile(startDir) {
269514
270648
  let currentDir = path40.resolve(startDir);
269515
270649
  while (true) {
269516
- const geminiEnvPath = path40.join(currentDir, GEMINI_CONFIG_DIR, ".env");
270650
+ const geminiEnvPath = path40.join(currentDir, MPDAI_CONFIG_DIR, ".env");
269517
270651
  if (fs36.existsSync(geminiEnvPath)) {
269518
270652
  return geminiEnvPath;
269519
270653
  }
@@ -269523,11 +270657,11 @@ function findEnvFile(startDir) {
269523
270657
  }
269524
270658
  const parentDir = path40.dirname(currentDir);
269525
270659
  if (parentDir === currentDir || !parentDir) {
269526
- const homeGeminiEnvPath = path40.join(homedir12(), GEMINI_CONFIG_DIR, ".env");
270660
+ const homeGeminiEnvPath = path40.join(homedir13(), MPDAI_CONFIG_DIR, ".env");
269527
270661
  if (fs36.existsSync(homeGeminiEnvPath)) {
269528
270662
  return homeGeminiEnvPath;
269529
270663
  }
269530
- const homeEnvPath = path40.join(homedir12(), ".env");
270664
+ const homeEnvPath = path40.join(homedir13(), ".env");
269531
270665
  if (fs36.existsSync(homeEnvPath)) {
269532
270666
  return homeEnvPath;
269533
270667
  }
@@ -271313,7 +272447,7 @@ function stripQuotes(val) {
271313
272447
  }
271314
272448
 
271315
272449
  // node_modules/yargs-parser/build/lib/index.js
271316
- import { readFileSync as readFileSync12 } from "fs";
272450
+ import { readFileSync as readFileSync13 } from "fs";
271317
272451
  var _a5;
271318
272452
  var _b;
271319
272453
  var _c;
@@ -271340,7 +272474,7 @@ var parser4 = new YargsParser({
271340
272474
  if (typeof __require !== "undefined") {
271341
272475
  return __require(path53);
271342
272476
  } else if (path53.match(/\.json$/)) {
271343
- return JSON.parse(readFileSync12(path53, "utf8"));
272477
+ return JSON.parse(readFileSync13(path53, "utf8"));
271344
272478
  } else {
271345
272479
  throw Error("only .json config files are supported in ESM");
271346
272480
  }
@@ -271668,17 +272802,17 @@ function sync_default(start, callback) {
271668
272802
 
271669
272803
  // node_modules/yargs/lib/platform-shims/esm.mjs
271670
272804
  import { inspect } from "util";
271671
- import { readFileSync as readFileSync14 } from "fs";
272805
+ import { readFileSync as readFileSync15 } from "fs";
271672
272806
  import { fileURLToPath as fileURLToPath7 } from "url";
271673
272807
  import { basename as basename4, dirname as dirname10, extname as extname2, relative as relative6, resolve as resolve17 } from "path";
271674
272808
 
271675
272809
  // node_modules/y18n/build/lib/platform-shims/node.js
271676
- import { readFileSync as readFileSync13, statSync as statSync3, writeFile as writeFile5 } from "fs";
272810
+ import { readFileSync as readFileSync14, statSync as statSync3, writeFile as writeFile5 } from "fs";
271677
272811
  import { format as format2 } from "util";
271678
272812
  import { resolve as resolve16 } from "path";
271679
272813
  var node_default = {
271680
272814
  fs: {
271681
- readFileSync: readFileSync13,
272815
+ readFileSync: readFileSync14,
271682
272816
  writeFile: writeFile5
271683
272817
  },
271684
272818
  format: format2,
@@ -271902,7 +273036,7 @@ var esm_default3 = {
271902
273036
  nextTick: process.nextTick,
271903
273037
  stdColumns: typeof process.stdout.columns !== "undefined" ? process.stdout.columns : null
271904
273038
  },
271905
- readFileSync: readFileSync14,
273039
+ readFileSync: readFileSync15,
271906
273040
  require: () => {
271907
273041
  throw new YError(REQUIRE_ERROR);
271908
273042
  },
@@ -271926,7 +273060,7 @@ import process29 from "node:process";
271926
273060
  import * as fs37 from "fs";
271927
273061
  import * as path41 from "path";
271928
273062
  import * as os11 from "os";
271929
- var EXTENSIONS_DIRECTORY_NAME = path41.join(".gemini", "extensions");
273063
+ var EXTENSIONS_DIRECTORY_NAME = path41.join(".mpdai", "extensions");
271930
273064
  var EXTENSIONS_CONFIG_FILENAME = "gemini-extension.json";
271931
273065
  function loadExtensions(workspaceDir) {
271932
273066
  const allExtensions = [
@@ -273120,7 +274254,7 @@ init_dist3();
273120
274254
  init_langfuseClient();
273121
274255
  import { execSync as execSync2 } from "child_process";
273122
274256
  import { promises as fs38 } from "fs";
273123
- import { join as join21 } from "path";
274257
+ import { join as join22 } from "path";
273124
274258
  var DataCollector = class {
273125
274259
  langfuseClient;
273126
274260
  constructor() {
@@ -273230,7 +274364,7 @@ var DataCollector = class {
273230
274364
  // 提取元数据
273231
274365
  extractMetadata(data) {
273232
274366
  return {
273233
- cli_version: "0.1.25",
274367
+ cli_version: "0.1.28",
273234
274368
  model: process.env.CUSTOM_LLM_MODEL_NAME || "gemini",
273235
274369
  auth_type: process.env.USE_CUSTOM_LLM ? "custom_llm" : "google_oauth",
273236
274370
  project_path: data.projectPath,
@@ -273447,7 +274581,7 @@ var DataCollector = class {
273447
274581
  const walkDir = async (dir) => {
273448
274582
  const entries = await fs38.readdir(dir, { withFileTypes: true });
273449
274583
  for (const entry of entries) {
273450
- const fullPath = join21(dir, entry.name);
274584
+ const fullPath = join22(dir, entry.name);
273451
274585
  if (entry.isDirectory()) {
273452
274586
  dirCount++;
273453
274587
  await walkDir(fullPath);
@@ -280497,10 +281631,10 @@ async function runNonInteractive(config2, input) {
280497
281631
  // packages/cli/src/utils/cleanup.ts
280498
281632
  init_dist3();
280499
281633
  import { promises as fs49 } from "fs";
280500
- import { join as join22 } from "path";
281634
+ import { join as join23 } from "path";
280501
281635
  async function cleanupCheckpoints() {
280502
281636
  const tempDir = getProjectTempDir(process.cwd());
280503
- const checkpointsDir = join22(tempDir, "checkpoints");
281637
+ const checkpointsDir = join23(tempDir, "checkpoints");
280504
281638
  try {
280505
281639
  await fs49.rm(checkpointsDir, { recursive: true, force: true });
280506
281640
  } catch {
@@ -280515,24 +281649,24 @@ init_EnvConfigManager();
280515
281649
  init_mpdaiConfig();
280516
281650
  import * as fs50 from "fs";
280517
281651
  import * as path52 from "path";
280518
- import { homedir as homedir15 } from "os";
281652
+ import { homedir as homedir16 } from "os";
280519
281653
  function initializeLangfuseConfig() {
280520
- const langfuseDir = path52.join(homedir15(), ".gemini");
281654
+ const langfuseDir = path52.join(homedir16(), ".mpdai");
280521
281655
  const settingsFile = path52.join(langfuseDir, "settings.conf");
280522
281656
  const isDebugMode = process.env.DEBUG === "true" || process.env.DEBUG_MODE === "true" || process.env.dev === "true";
280523
281657
  try {
280524
281658
  if (!fs50.existsSync(langfuseDir)) {
280525
281659
  if (isDebugMode) {
280526
- console.log("\u{1F4C1} Creating .gemini directory...");
281660
+ console.log("\u{1F4C1} Creating .mpdai directory...");
280527
281661
  }
280528
281662
  fs50.mkdirSync(langfuseDir, { recursive: true });
280529
281663
  if (isDebugMode) {
280530
- console.log("\u2705 .gemini directory created successfully");
281664
+ console.log("\u2705 .mpdai directory created successfully");
280531
281665
  }
280532
281666
  }
280533
281667
  if (!fs50.existsSync(settingsFile)) {
280534
281668
  if (isDebugMode) {
280535
- console.log("\u{1F4DD} Creating .gemini/settings.conf...");
281669
+ console.log("\u{1F4DD} Creating .mpdai/settings.conf...");
280536
281670
  }
280537
281671
  const defaultSettings = {
280538
281672
  "secretKey": "sk-lf-9da9fdd0-2198-41e6-a1fc-f1abeb08ddff",
@@ -280543,11 +281677,11 @@ function initializeLangfuseConfig() {
280543
281677
  };
280544
281678
  fs50.writeFileSync(settingsFile, JSON.stringify(defaultSettings, null, 2));
280545
281679
  if (isDebugMode) {
280546
- console.log("\u2705 .gemini/settings.conf created successfully");
281680
+ console.log("\u2705 .mpdai/settings.conf created successfully");
280547
281681
  }
280548
281682
  } else {
280549
281683
  if (isDebugMode) {
280550
- console.log("\u2705 .gemini/settings.conf already exists");
281684
+ console.log("\u2705 .mpdai/settings.conf already exists");
280551
281685
  }
280552
281686
  }
280553
281687
  } catch (error) {