connectbase-client 0.6.20 → 0.6.22

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.js CHANGED
@@ -30,7 +30,7 @@ var crypto = __toESM(require("crypto"));
30
30
  var https = __toESM(require("https"));
31
31
  var http = __toESM(require("http"));
32
32
  var readline = __toESM(require("readline"));
33
- var VERSION = "0.6.17";
33
+ var VERSION = "0.6.21";
34
34
  var DEFAULT_BASE_URL = "https://api.connectbase.world";
35
35
  var colors = {
36
36
  reset: "\x1B[0m",
@@ -445,23 +445,10 @@ function addDeployScript(deployDir) {
445
445
  }
446
446
  }
447
447
  async function downloadDocs(apiKey, templates) {
448
- let claudeMdPath = path.join(process.cwd(), "CLAUDE.md");
449
- if (fs.existsSync(claudeMdPath)) {
450
- const choice = await prompt(`${colors.yellow}\u26A0${colors.reset} CLAUDE.md\uAC00 \uC774\uBBF8 \uC874\uC7AC\uD569\uB2C8\uB2E4. \uC5B4\uB5BB\uAC8C \uD560\uAE4C\uC694?
451
- ${colors.cyan}1${colors.reset}) \uB36E\uC5B4\uC4F0\uAE30
452
- ${colors.cyan}2${colors.reset}) .claude/CLAUDE.md\uC5D0 \uC800\uC7A5
453
- ${colors.cyan}3${colors.reset}) \uCDE8\uC18C
454
- ${colors.blue}?${colors.reset} \uC120\uD0DD (1/2/3): `);
455
- if (choice === "2") {
456
- const claudeDir = path.join(process.cwd(), ".claude");
457
- if (!fs.existsSync(claudeDir)) {
458
- fs.mkdirSync(claudeDir, { recursive: true });
459
- }
460
- claudeMdPath = path.join(claudeDir, "CLAUDE.md");
461
- } else if (choice !== "1") {
462
- info("SDK \uAC00\uC774\uB4DC \uB2E4\uC6B4\uB85C\uB4DC\uB97C \uAC74\uB108\uB701\uB2C8\uB2E4");
463
- return;
464
- }
448
+ const docsDir = path.join(process.cwd(), ".claude", "docs");
449
+ const rootClaudeMd = path.join(process.cwd(), "CLAUDE.md");
450
+ if (!fs.existsSync(docsDir)) {
451
+ fs.mkdirSync(docsDir, { recursive: true });
465
452
  }
466
453
  if (!templates) {
467
454
  templates = ["rules"];
@@ -470,28 +457,63 @@ ${colors.blue}?${colors.reset} \uC120\uD0DD (1/2/3): `);
470
457
  try {
471
458
  const templateParam = templates.join(",");
472
459
  const res = await makeRequest(
473
- `${DEFAULT_BASE_URL}/v1/storages/webs/claude-md?template=${encodeURIComponent(templateParam)}`,
460
+ `${DEFAULT_BASE_URL}/v1/storages/webs/claude-md?template=${encodeURIComponent(templateParam)}&format=sections&api_key=${encodeURIComponent(apiKey)}`,
474
461
  "GET",
475
462
  {}
476
463
  );
477
464
  if (res.status !== 200) {
478
465
  throw new Error(`HTTP ${res.status}`);
479
466
  }
480
- const content = typeof res.data === "string" ? res.data : JSON.stringify(res.data);
481
- fs.writeFileSync(claudeMdPath, content);
482
- const relativePath = path.relative(process.cwd(), claudeMdPath);
483
- success(`${relativePath} \uC0DD\uC131 \uC644\uB8CC`);
467
+ const data = typeof res.data === "string" ? JSON.parse(res.data) : res.data;
468
+ const sections = data.sections || [];
469
+ for (const section of sections) {
470
+ const filePath = path.join(docsDir, section.filename);
471
+ fs.writeFileSync(filePath, section.content);
472
+ }
473
+ success(`.claude/docs/ \uC5D0 ${sections.length}\uAC1C \uBB38\uC11C \uC800\uC7A5 \uC644\uB8CC`);
474
+ updateRootClaudeMd(rootClaudeMd);
484
475
  log(`${colors.dim}\u203B SDK \uBB38\uC11C\uB294 MCP search_sdk_docs\uB85C \uAC80\uC0C9\uD558\uC138\uC694${colors.reset}`);
485
476
  } catch {
486
- warn("SDK \uAC00\uC774\uB4DC \uB2E4\uC6B4\uB85C\uB4DC \uC2E4\uD328, \uAE30\uBCF8 CLAUDE.md\uB97C \uC0DD\uC131\uD569\uB2C8\uB2E4");
487
- fs.writeFileSync(claudeMdPath, `# Connect Base SDK
477
+ warn("SDK \uAC00\uC774\uB4DC \uB2E4\uC6B4\uB85C\uB4DC \uC2E4\uD328, \uAE30\uBCF8 \uBB38\uC11C\uB97C \uC0DD\uC131\uD569\uB2C8\uB2E4");
478
+ const fallbackContent = `# ConnectBase \uD504\uB85C\uC81D\uD2B8
479
+
480
+ \uC774 \uD504\uB85C\uC81D\uD2B8\uB294 ConnectBase\uB97C \uBC31\uC5D4\uB4DC\uB85C \uC0AC\uC6A9\uD569\uB2C8\uB2E4.
481
+
482
+ \uC0C1\uC138 \uAD6C\uD604\uBC95\uC740 MCP \`search_sdk_docs\` \uB3C4\uAD6C\uB85C \uAC80\uC0C9\uD558\uC138\uC694.
483
+ `;
484
+ fs.writeFileSync(path.join(docsDir, "project-rules.md"), fallbackContent);
485
+ updateRootClaudeMd(rootClaudeMd);
486
+ success(`.claude/docs/ \uC0DD\uC131 \uC644\uB8CC (\uAE30\uBCF8)`);
487
+ }
488
+ }
489
+ function updateRootClaudeMd(claudeMdPath) {
490
+ const startMarker = "<!-- CONNECTBASE_START -->";
491
+ const endMarker = "<!-- CONNECTBASE_END -->";
492
+ const sdkBlock = `${startMarker}
493
+ ## ConnectBase SDK
488
494
 
489
- \uC774 \uD504\uB85C\uC81D\uD2B8\uB294 Connect Base SDK\uB97C \uC0AC\uC6A9\uD569\uB2C8\uB2E4.
495
+ \uC774 \uD504\uB85C\uC81D\uD2B8\uB294 ConnectBase\uB97C \uBC31\uC5D4\uB4DC\uB85C \uC0AC\uC6A9\uD569\uB2C8\uB2E4.
496
+ SDK \uAC1C\uBC1C \uAC00\uC774\uB4DC\uB294 \`.claude/docs/\` \uD3F4\uB354\uB97C \uCC38\uC870\uD558\uC138\uC694.
497
+
498
+ \uC0C1\uC138 \uAD6C\uD604\uBC95\uC740 MCP \`search_sdk_docs\` \uB3C4\uAD6C\uB85C \uAC80\uC0C9\uD558\uC138\uC694.
499
+ ${endMarker}`;
500
+ if (fs.existsSync(claudeMdPath)) {
501
+ let content = fs.readFileSync(claudeMdPath, "utf-8");
502
+ const startIdx = content.indexOf(startMarker);
503
+ const endIdx = content.indexOf(endMarker);
504
+ if (startIdx !== -1 && endIdx !== -1) {
505
+ content = content.substring(0, startIdx) + sdkBlock + content.substring(endIdx + endMarker.length);
506
+ } else {
507
+ content = content.trimEnd() + "\n\n" + sdkBlock + "\n";
508
+ }
509
+ fs.writeFileSync(claudeMdPath, content);
510
+ info("CLAUDE.md\uC5D0 ConnectBase \uCC38\uC870 \uC5C5\uB370\uC774\uD2B8 \uC644\uB8CC");
511
+ } else {
512
+ fs.writeFileSync(claudeMdPath, `# \uD504\uB85C\uC81D\uD2B8
490
513
 
491
- \uC790\uC138\uD55C \uAC00\uC774\uB4DC: https://connectbase.world
514
+ ${sdkBlock}
492
515
  `);
493
- const relativePath = path.relative(process.cwd(), claudeMdPath);
494
- success(`${relativePath} \uC0DD\uC131 \uC644\uB8CC (\uAE30\uBCF8)`);
516
+ success("CLAUDE.md \uC0DD\uC131 \uC644\uB8CC");
495
517
  }
496
518
  }
497
519
  async function setupClaudeCode(apiKey) {
package/dist/index.d.mts CHANGED
@@ -240,10 +240,8 @@ interface UpdateDataRequest {
240
240
  data: Record<string, unknown>;
241
241
  }
242
242
  interface FetchDataResponse {
243
- data: DataItem[];
244
- total_count: number;
245
- limit: number;
246
- offset: number;
243
+ datas: DataItem[];
244
+ total_size: number;
247
245
  }
248
246
  interface QueryOptions {
249
247
  limit?: number;
package/dist/index.d.ts CHANGED
@@ -240,10 +240,8 @@ interface UpdateDataRequest {
240
240
  data: Record<string, unknown>;
241
241
  }
242
242
  interface FetchDataResponse {
243
- data: DataItem[];
244
- total_count: number;
245
- limit: number;
246
- offset: number;
243
+ datas: DataItem[];
244
+ total_size: number;
247
245
  }
248
246
  interface QueryOptions {
249
247
  limit?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "connectbase-client",
3
- "version": "0.6.20",
3
+ "version": "0.6.22",
4
4
  "description": "Connect Base JavaScript/TypeScript SDK for browser and Node.js",
5
5
  "repository": {
6
6
  "type": "git",