@ainecto/mcp 0.12.2 → 0.13.1

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/bin/mcp.js CHANGED
@@ -58,7 +58,28 @@ function assertEnv(value) {
58
58
 
59
59
  // src/core/auth/tokenStore.ts
60
60
  import { createHash } from "crypto";
61
- import { mkdir, readFile, rename, rm, stat, writeFile, chmod } from "fs/promises";
61
+ import { mkdir as mkdir2, readFile, rename, rm, stat as stat2, writeFile, chmod as chmod2 } from "fs/promises";
62
+
63
+ // src/core/fs/privateFiles.ts
64
+ import { chmod, lstat, mkdir, stat } from "fs/promises";
65
+ function isNodeError(error, code) {
66
+ return error instanceof Error && "code" in error && error.code === code;
67
+ }
68
+ async function chmodIfPermissive(path, mode) {
69
+ try {
70
+ const result = await stat(path);
71
+ if ((result.mode & 63) !== 0) {
72
+ await chmod(path, mode);
73
+ }
74
+ } catch (error) {
75
+ if (isNodeError(error, "ENOENT")) {
76
+ return;
77
+ }
78
+ throw error;
79
+ }
80
+ }
81
+
82
+ // src/core/auth/tokenStore.ts
62
83
  import { homedir } from "os";
63
84
  import { dirname, join } from "path";
64
85
  var FileTokenStore = class {
@@ -97,14 +118,14 @@ var FileTokenStore = class {
97
118
  }
98
119
  }
99
120
  async writeFile(file) {
100
- await mkdir(dirname(this.filePath), { recursive: true, mode: 448 });
101
- await chmod(dirname(this.filePath), 448);
121
+ await mkdir2(dirname(this.filePath), { recursive: true, mode: 448 });
122
+ await chmod2(dirname(this.filePath), 448);
102
123
  const tmpPath = `${this.filePath}.${process.pid}.${Date.now()}.tmp`;
103
124
  await writeFile(tmpPath, `${JSON.stringify(file, null, 2)}
104
125
  `, { mode: 384 });
105
- await chmod(tmpPath, 384);
126
+ await chmod2(tmpPath, 384);
106
127
  await rename(tmpPath, this.filePath);
107
- await chmod(this.filePath, 384);
128
+ await chmod2(this.filePath, 384);
108
129
  }
109
130
  async hardenExistingPermissions() {
110
131
  const dirPath = dirname(this.filePath);
@@ -115,22 +136,6 @@ var FileTokenStore = class {
115
136
  function tokenKey(endpoint) {
116
137
  return createHash("sha256").update(endpoint).digest("hex");
117
138
  }
118
- function isNodeError(error, code) {
119
- return error instanceof Error && "code" in error && error.code === code;
120
- }
121
- async function chmodIfPermissive(path, mode) {
122
- try {
123
- const result = await stat(path);
124
- if ((result.mode & 63) !== 0) {
125
- await chmod(path, mode);
126
- }
127
- } catch (error) {
128
- if (isNodeError(error, "ENOENT")) {
129
- return;
130
- }
131
- throw error;
132
- }
133
- }
134
139
 
135
140
  // src/core/auth/oauth.ts
136
141
  import { createHash as createHash2, randomBytes } from "crypto";
@@ -214,7 +219,7 @@ function legacyRoleInput(flag, envVars = process.env) {
214
219
  }
215
220
 
216
221
  // src/core/version.ts
217
- var CLI_VERSION = true ? "0.12.2" : UNBUNDLED_VERSION;
222
+ var CLI_VERSION = true ? "0.13.1" : UNBUNDLED_VERSION;
218
223
  var PACKAGE_NAME = "@ainecto/mcp";
219
224
  var CLI_USER_AGENT = `${PACKAGE_NAME} ${CLI_VERSION}`;
220
225
 
@@ -918,12 +923,12 @@ signed-in user's AiNecto permissions decide what they may change, and the server
918
923
  ${MARKER_END}`;
919
924
 
920
925
  // src/core/harness/repositoryFiles.ts
921
- import { lstat, readFile as readFile2, realpath } from "fs/promises";
926
+ import { lstat as lstat2, readFile as readFile2, realpath } from "fs/promises";
922
927
  import { dirname as dirname2, join as join2, resolve, sep } from "path";
923
928
  async function findGitRoot(cwd) {
924
929
  for (let at = resolve(cwd); ; at = dirname2(at)) {
925
930
  try {
926
- await lstat(join2(at, ".git"));
931
+ await lstat2(join2(at, ".git"));
927
932
  return at;
928
933
  } catch {
929
934
  }
@@ -964,7 +969,7 @@ async function assertInsideRepository(root, relativePath) {
964
969
  );
965
970
  }
966
971
  try {
967
- if ((await lstat(absolutePath)).isSymbolicLink()) {
972
+ if ((await lstat2(absolutePath)).isSymbolicLink()) {
968
973
  throw new Error(`${relativePath} is a symbolic link; refusing to write through it.`);
969
974
  }
970
975
  } catch (error) {