@ilivemylife/graph-sdk 1.0.2 → 1.0.3

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.mjs CHANGED
@@ -523,7 +523,7 @@ function createApolloClient(options) {
523
523
  const { token, httpUrl, wsUrl, enableSubscriptions, webSocketImpl } = options;
524
524
  const requestHeaders = {
525
525
  "access-token": token,
526
- "x-client": `sdk/${"1.0.2"}`
526
+ "x-client": `sdk/${"1.0.3"}`
527
527
  };
528
528
  const httpLink = createHttpLink({
529
529
  uri: httpUrl,
@@ -536,7 +536,7 @@ function createApolloClient(options) {
536
536
  if (enableSubscriptions) {
537
537
  const wsClientOptions = {
538
538
  url: wsUrl,
539
- connectionParams: { "access-token": token, "x-client": `sdk/${"1.0.2"}` }
539
+ connectionParams: { "access-token": token, "x-client": `sdk/${"1.0.3"}` }
540
540
  };
541
541
  if (webSocketImpl) {
542
542
  wsClientOptions.webSocketImpl = webSocketImpl;
@@ -2358,7 +2358,7 @@ async function cmdUpdate() {
2358
2358
  const { execSync } = await import("child_process");
2359
2359
  console.log("Checking for updates...");
2360
2360
  try {
2361
- const currentVersion = "1.0.2";
2361
+ const currentVersion = "1.0.3";
2362
2362
  let latestVersion;
2363
2363
  try {
2364
2364
  const result = execSync("npm view @ilivemylife/graph-sdk version", { encoding: "utf-8" }).trim();
@@ -2388,7 +2388,7 @@ async function cmdDoctor() {
2388
2388
  console.log("\u2550".repeat(60));
2389
2389
  let issues = 0;
2390
2390
  console.log(`
2391
- [Version] ${"1.0.2"}`);
2391
+ [Version] ${"1.0.3"}`);
2392
2392
  const localConfigPath = findLocalConfigFile();
2393
2393
  const globalExists = existsSync(GLOBAL_CONFIG_FILE);
2394
2394
  console.log("\n[Config Files]");
@@ -2579,11 +2579,11 @@ async function cmdUninstall() {
2579
2579
  console.log("\u2550".repeat(60));
2580
2580
  }
2581
2581
  function showVersion() {
2582
- console.log(`@ilivemylife/graph-sdk v${"1.0.2"}`);
2582
+ console.log(`@ilivemylife/graph-sdk v${"1.0.3"}`);
2583
2583
  }
2584
2584
  function showHelp() {
2585
2585
  console.log(`
2586
- @ilivemylife/graph-sdk v${"1.0.2"}
2586
+ @ilivemylife/graph-sdk v${"1.0.3"}
2587
2587
  CLI for iLiveMyLife Knowledge Graph
2588
2588
 
2589
2589
  USAGE
package/dist/client.cjs CHANGED
@@ -623,7 +623,7 @@ function createApolloClient(options) {
623
623
  const { token, httpUrl, wsUrl, enableSubscriptions, webSocketImpl } = options;
624
624
  const requestHeaders = {
625
625
  "access-token": token,
626
- "x-client": `sdk/${"1.0.2"}`
626
+ "x-client": `sdk/${"1.0.3"}`
627
627
  };
628
628
  const httpLink = createHttpLink({
629
629
  uri: httpUrl,
@@ -636,7 +636,7 @@ function createApolloClient(options) {
636
636
  if (enableSubscriptions) {
637
637
  const wsClientOptions = {
638
638
  url: wsUrl,
639
- connectionParams: { "access-token": token, "x-client": `sdk/${"1.0.2"}` }
639
+ connectionParams: { "access-token": token, "x-client": `sdk/${"1.0.3"}` }
640
640
  };
641
641
  if (webSocketImpl) {
642
642
  wsClientOptions.webSocketImpl = webSocketImpl;
package/dist/client.mjs CHANGED
@@ -550,7 +550,7 @@ function createApolloClient(options) {
550
550
  const { token, httpUrl, wsUrl, enableSubscriptions, webSocketImpl } = options;
551
551
  const requestHeaders = {
552
552
  "access-token": token,
553
- "x-client": `sdk/${"1.0.2"}`
553
+ "x-client": `sdk/${"1.0.3"}`
554
554
  };
555
555
  const httpLink = createHttpLink({
556
556
  uri: httpUrl,
@@ -563,7 +563,7 @@ function createApolloClient(options) {
563
563
  if (enableSubscriptions) {
564
564
  const wsClientOptions = {
565
565
  url: wsUrl,
566
- connectionParams: { "access-token": token, "x-client": `sdk/${"1.0.2"}` }
566
+ connectionParams: { "access-token": token, "x-client": `sdk/${"1.0.3"}` }
567
567
  };
568
568
  if (webSocketImpl) {
569
569
  wsClientOptions.webSocketImpl = webSocketImpl;
@@ -8,6 +8,9 @@ import {
8
8
  ListToolsRequestSchema
9
9
  } from "@modelcontextprotocol/sdk/types.js";
10
10
  import { createRequire } from "module";
11
+ import { existsSync, readFileSync } from "fs";
12
+ import { join } from "path";
13
+ import { homedir } from "os";
11
14
 
12
15
  // src/client.ts
13
16
  import apolloCore2 from "@apollo/client/core/core.cjs";
@@ -540,7 +543,7 @@ function createApolloClient(options) {
540
543
  const { token, httpUrl, wsUrl, enableSubscriptions, webSocketImpl } = options;
541
544
  const requestHeaders = {
542
545
  "access-token": token,
543
- "x-client": `sdk/${"1.0.2"}`
546
+ "x-client": `sdk/${"1.0.3"}`
544
547
  };
545
548
  const httpLink = createHttpLink({
546
549
  uri: httpUrl,
@@ -553,7 +556,7 @@ function createApolloClient(options) {
553
556
  if (enableSubscriptions) {
554
557
  const wsClientOptions = {
555
558
  url: wsUrl,
556
- connectionParams: { "access-token": token, "x-client": `sdk/${"1.0.2"}` }
559
+ connectionParams: { "access-token": token, "x-client": `sdk/${"1.0.3"}` }
557
560
  };
558
561
  if (webSocketImpl) {
559
562
  wsClientOptions.webSocketImpl = webSocketImpl;
@@ -1109,12 +1112,49 @@ function hasHighPrivacyTag(node) {
1109
1112
  // src/mcp-server.ts
1110
1113
  var require2 = createRequire(import.meta.url);
1111
1114
  var VERSION = require2("../package.json").version;
1115
+ var CONFIG_DIRNAME = ".ilivemylife";
1116
+ var CONFIG_FILENAME = "config.json";
1117
+ function resolveToken() {
1118
+ let dir = process.cwd();
1119
+ const root = process.platform === "win32" ? dir.split("\\")[0] + "\\" : "/";
1120
+ while (dir !== root) {
1121
+ const configPath = join(dir, CONFIG_DIRNAME, CONFIG_FILENAME);
1122
+ if (existsSync(configPath)) {
1123
+ try {
1124
+ const config = JSON.parse(readFileSync(configPath, "utf-8"));
1125
+ if (config.token) return config.token;
1126
+ } catch {
1127
+ }
1128
+ }
1129
+ const parent = join(dir, "..");
1130
+ if (parent === dir) break;
1131
+ dir = parent;
1132
+ }
1133
+ const envPath = join(process.cwd(), ".env");
1134
+ if (existsSync(envPath)) {
1135
+ try {
1136
+ const content = readFileSync(envPath, "utf-8");
1137
+ const match = content.match(/^ILML_TOKEN\s*=\s*["']?([^"'\r\n]+)["']?/m);
1138
+ if (match) return match[1].trim();
1139
+ } catch {
1140
+ }
1141
+ }
1142
+ const globalConfig = join(homedir(), CONFIG_DIRNAME, CONFIG_FILENAME);
1143
+ if (existsSync(globalConfig)) {
1144
+ try {
1145
+ const config = JSON.parse(readFileSync(globalConfig, "utf-8"));
1146
+ if (config.token) return config.token;
1147
+ } catch {
1148
+ }
1149
+ }
1150
+ return process.env.ILML_TOKEN;
1151
+ }
1112
1152
  var _graph = null;
1113
1153
  function getGraph() {
1114
1154
  if (!_graph) {
1115
- const token = process.env.ILML_TOKEN;
1155
+ const token = resolveToken();
1116
1156
  if (!token) {
1117
- throw new Error("ILML_TOKEN environment variable not set. Add it to your MCP server config.");
1157
+ throw new Error('No token found. Run "ilml login" or set ILML_TOKEN environment variable.');
1118
1158
  }
1119
1159
  _graph = createGraphClient({ token });
1120
1160
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ilivemylife/graph-sdk",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "SDK and CLI for iLiveMyLife Knowledge Graph",
5
5
  "license": "UNLICENSED",
6
6
  "engines": {