@aexol/spectral 0.0.3 → 0.0.6

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
@@ -79,6 +79,41 @@ function resolvePiBin() {
79
79
  function resolveAexolExtensionPath() {
80
80
  return resolve(__dirname, "extensions", "aexol-mcp.js");
81
81
  }
82
+ /**
83
+ * Resolve the entry point of the bundled pi-mcp-adapter extension.
84
+ *
85
+ * pi-mcp-adapter declares its extension entry via `"pi": { "extensions":
86
+ * ["./index.ts"] }` — it does NOT export a `main` or `exports` field. We
87
+ * therefore walk up node_modules ourselves, locate the package directory, and
88
+ * return the absolute path to `index.ts`.
89
+ *
90
+ * Returns null if the package is not installed (graceful degradation).
91
+ */
92
+ function resolveMcpAdapterPath() {
93
+ const rel = "node_modules/pi-mcp-adapter/package.json";
94
+ let dir = __dirname;
95
+ const root = "/";
96
+ for (let i = 0; i < 20; i++) {
97
+ const pkgPath = resolve(dir, rel);
98
+ try {
99
+ const raw = readFileSync(pkgPath, "utf8");
100
+ const pkg = JSON.parse(raw);
101
+ const extRel = pkg.pi?.extensions?.[0];
102
+ if (extRel) {
103
+ return resolve(dirname(pkgPath), extRel);
104
+ }
105
+ break; // package found but no pi.extensions — shouldn't happen
106
+ }
107
+ catch {
108
+ // package.json not readable at this level, keep walking up
109
+ }
110
+ const parent = dirname(dir);
111
+ if (parent === dir || parent === root)
112
+ break;
113
+ dir = parent;
114
+ }
115
+ return null;
116
+ }
82
117
  // ---- Branded helpers ---------------------------------------------------------
83
118
  function printVersion() {
84
119
  process.stdout.write(`spectral ${VERSION} — ${TAGLINE}\n`);
@@ -191,12 +226,26 @@ async function main() {
191
226
  await requireLogin();
192
227
  // Resolve and inject the Aexol MCP extension. Sanity-check existence so we
193
228
  // fail with a clear message if someone publishes a broken bundle.
194
- const extPath = resolveAexolExtensionPath();
195
- if (!existsSync(extPath)) {
196
- process.stderr.write(`spectral: bundled Aexol MCP extension not found at ${extPath}. This is a packaging bug.\n`);
229
+ const aexolExtPath = resolveAexolExtensionPath();
230
+ if (!existsSync(aexolExtPath)) {
231
+ process.stderr.write(`spectral: bundled Aexol MCP extension not found at ${aexolExtPath}. This is a packaging bug.\n`);
197
232
  process.exit(1);
198
233
  }
199
- const finalArgs = ["--extension", extPath, ...args];
234
+ // Inject the bundled pi-mcp-adapter extension for standard MCP server
235
+ // support (stdio + SSE/HTTP transports, lazy loading, OAuth, /mcp panel).
236
+ // Graceful: if the package is missing, we continue without standard MCP.
237
+ const mcpAdapterPath = resolveMcpAdapterPath();
238
+ if (mcpAdapterPath) {
239
+ process.stderr.write(`[spectral] Standard MCP adapter loaded: ${mcpAdapterPath}\n`);
240
+ }
241
+ else {
242
+ process.stderr.write("[spectral] pi-mcp-adapter not found; standard MCP servers disabled.\n");
243
+ }
244
+ const extFlags = ["--extension", aexolExtPath];
245
+ if (mcpAdapterPath) {
246
+ extFlags.push("--extension", mcpAdapterPath);
247
+ }
248
+ const finalArgs = [...extFlags, ...args];
200
249
  delegateToPi(finalArgs);
201
250
  }
202
251
  main().catch((err) => {
@@ -45,7 +45,7 @@ import { gracefulShutdown } from "../server/shutdown.js";
45
45
  import { preflightSqlite, SessionStore } from "../server/storage.js";
46
46
  const __dirname = dirname(fileURLToPath(import.meta.url));
47
47
  /** Default backend base URL when neither env nor override is set. */
48
- const DEFAULT_BACKEND_URL = "http://localhost:4008";
48
+ const DEFAULT_BACKEND_URL = "http://api.aexol.ai";
49
49
  function readPackageVersion() {
50
50
  // dist/commands/serve.js → ../../package.json
51
51
  // src/commands/serve.ts → ../../package.json (tsx / vitest)
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@aexol/spectral",
3
- "version": "0.0.3",
3
+ "version": "0.0.6",
4
4
  "description": "Always-on coding agent for Aexol — branded pi wrapper with relay-based browser access.",
5
5
  "type": "module",
6
6
  "private": false,
7
7
  "bin": {
8
- "spectral": "dist/cli.js"
8
+ "spectral": "dist/cli.js",
9
+ "aexol": "dist/cli.js"
9
10
  },
10
11
  "files": [
11
12
  "dist",
@@ -52,6 +53,7 @@
52
53
  "@inquirer/prompts": "^7.2.0",
53
54
  "@mariozechner/pi-coding-agent": "^0.70.2",
54
55
  "better-sqlite3": "^12.9.0",
56
+ "pi-mcp-adapter": "^2.5.4",
55
57
  "picocolors": "^1.1.1",
56
58
  "ws": "^8.20.0"
57
59
  },