@virsanghavi/axis-server 1.0.5 → 1.0.7
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/mcp-server.mjs +37 -31
- package/package.json +1 -1
package/dist/mcp-server.mjs
CHANGED
|
@@ -20,15 +20,16 @@ import dotenv2 from "dotenv";
|
|
|
20
20
|
import fs from "fs/promises";
|
|
21
21
|
import path from "path";
|
|
22
22
|
import { Mutex } from "async-mutex";
|
|
23
|
-
var LEGACY_INSTRUCTIONS_DIR = path.resolve(process.cwd(), "agent-instructions");
|
|
24
|
-
var AXIS_DIR = path.resolve(process.cwd(), ".axis");
|
|
25
|
-
var INSTRUCTIONS_DIR = path.resolve(AXIS_DIR, "instructions");
|
|
26
23
|
function getEffectiveInstructionsDir() {
|
|
24
|
+
const cwd = process.cwd();
|
|
25
|
+
const axisDir = path.resolve(cwd, ".axis");
|
|
26
|
+
const instructionsDir = path.resolve(axisDir, "instructions");
|
|
27
|
+
const legacyDir = path.resolve(cwd, "agent-instructions");
|
|
27
28
|
try {
|
|
28
|
-
if (__require("fs").existsSync(
|
|
29
|
+
if (__require("fs").existsSync(instructionsDir)) return instructionsDir;
|
|
29
30
|
} catch {
|
|
30
31
|
}
|
|
31
|
-
return
|
|
32
|
+
return legacyDir;
|
|
32
33
|
}
|
|
33
34
|
var ContextManager = class {
|
|
34
35
|
mutex;
|
|
@@ -772,35 +773,40 @@ if (process.env.NEXT_PUBLIC_SUPABASE_URL && process.env.SUPABASE_SERVICE_ROLE_KE
|
|
|
772
773
|
);
|
|
773
774
|
}
|
|
774
775
|
async function ensureFileSystem() {
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
const axisInstructions = path3.join(axisDir, "instructions");
|
|
784
|
-
const legacyInstructions = path3.join(cwd, "agent-instructions");
|
|
785
|
-
if (fsSync.existsSync(legacyInstructions) && !fsSync.existsSync(axisDir)) {
|
|
786
|
-
logger.info("Using legacy agent-instructions directory");
|
|
787
|
-
} else {
|
|
788
|
-
await fs3.mkdir(axisInstructions, { recursive: true }).catch(() => {
|
|
776
|
+
try {
|
|
777
|
+
const fs3 = await import("fs/promises");
|
|
778
|
+
const path3 = await import("path");
|
|
779
|
+
const fsSync = await import("fs");
|
|
780
|
+
const cwd = process.cwd();
|
|
781
|
+
logger.info(`Server CWD: ${cwd}`);
|
|
782
|
+
const historyDir = path3.join(cwd, "history");
|
|
783
|
+
await fs3.mkdir(historyDir, { recursive: true }).catch(() => {
|
|
789
784
|
});
|
|
790
|
-
const
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
785
|
+
const axisDir = path3.join(cwd, ".axis");
|
|
786
|
+
const axisInstructions = path3.join(axisDir, "instructions");
|
|
787
|
+
const legacyInstructions = path3.join(cwd, "agent-instructions");
|
|
788
|
+
if (fsSync.existsSync(legacyInstructions) && !fsSync.existsSync(axisDir)) {
|
|
789
|
+
logger.info("Using legacy agent-instructions directory");
|
|
790
|
+
} else {
|
|
791
|
+
await fs3.mkdir(axisInstructions, { recursive: true }).catch(() => {
|
|
792
|
+
});
|
|
793
|
+
const defaults = [
|
|
794
|
+
["context.md", "# Project Context\n\n"],
|
|
795
|
+
["conventions.md", "# Coding Conventions\n\n"],
|
|
796
|
+
["activity.md", "# Activity Log\n\n"]
|
|
797
|
+
];
|
|
798
|
+
for (const [file, content] of defaults) {
|
|
799
|
+
const p = path3.join(axisInstructions, file);
|
|
800
|
+
try {
|
|
801
|
+
await fs3.access(p);
|
|
802
|
+
} catch {
|
|
803
|
+
await fs3.writeFile(p, content);
|
|
804
|
+
logger.info(`Created default context file: ${file}`);
|
|
805
|
+
}
|
|
802
806
|
}
|
|
803
807
|
}
|
|
808
|
+
} catch (error) {
|
|
809
|
+
logger.warn("Could not initialize local file system. Persistence features (context.md) may be disabled.", { error: String(error) });
|
|
804
810
|
}
|
|
805
811
|
}
|
|
806
812
|
var server = new Server(
|