estatehelm 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/index.js CHANGED
@@ -1547,11 +1547,11 @@ function waitForCallback(port) {
1547
1547
  const sessionToken = url.searchParams.get("session_token");
1548
1548
  const error = url.searchParams.get("error");
1549
1549
  if (error) {
1550
- res.writeHead(400, { "Content-Type": "text/html" });
1550
+ res.writeHead(400, { "Content-Type": "text/html; charset=utf-8" });
1551
1551
  res.end(`
1552
1552
  <!DOCTYPE html>
1553
1553
  <html>
1554
- <head><title>Authentication Failed</title>
1554
+ <head><meta charset="utf-8"><title>Authentication Failed</title>
1555
1555
  <style>body{font-family:system-ui;display:flex;justify-content:center;align-items:center;height:100vh;margin:0;background:#fef2f2}.card{background:white;padding:2rem;border-radius:1rem;box-shadow:0 10px 25px rgba(0,0,0,0.1);text-align:center}h1{color:#dc2626}</style></head>
1556
1556
  <body><div class="card"><h1>Authentication Failed</h1><p>${url.searchParams.get("error_description") || error}</p></div></body>
1557
1557
  </html>
@@ -1561,13 +1561,13 @@ function waitForCallback(port) {
1561
1561
  return;
1562
1562
  }
1563
1563
  if (sessionToken) {
1564
- res.writeHead(200, { "Content-Type": "text/html" });
1564
+ res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
1565
1565
  res.end(`
1566
1566
  <!DOCTYPE html>
1567
1567
  <html>
1568
- <head><title>Authentication Successful</title>
1568
+ <head><meta charset="utf-8"><title>Authentication Successful</title>
1569
1569
  <style>body{font-family:system-ui;display:flex;justify-content:center;align-items:center;height:100vh;margin:0;background:linear-gradient(115deg,#fff1be 28%,#ee87cb 70%,#b060ff 100%)}.card{background:white;padding:2rem;border-radius:1rem;box-shadow:0 10px 25px rgba(0,0,0,0.1);text-align:center}h1{color:#059669}</style></head>
1570
- <body><div class="card"><h1>\u2713 Authentication Successful</h1><p>You can close this window and return to your terminal.</p></div></body>
1570
+ <body><div class="card"><h1>&#10003; Authentication Successful</h1><p>You can close this window and return to your terminal.</p></div></body>
1571
1571
  </html>
1572
1572
  `);
1573
1573
  server.close();
@@ -1603,7 +1603,7 @@ ${loginUrl}
1603
1603
  console.log("Authentication successful!");
1604
1604
  console.log(`Token: ${sanitizeToken(sessionToken)}`);
1605
1605
  await saveBearerToken(sessionToken);
1606
- await saveRefreshToken("");
1606
+ await saveRefreshToken("kratos-session-no-refresh");
1607
1607
  const client = createApiClient(sessionToken);
1608
1608
  console.log("\nFetching encryption keys...");
1609
1609
  const serverWrapSecret = await getServerWrapSecret(client);
@@ -1628,7 +1628,18 @@ ${loginUrl}
1628
1628
  privateKeyBytes: base64Encode(privateKeyBytes)
1629
1629
  });
1630
1630
  console.log("\n\u2713 Login complete!");
1631
- console.log("You can now use: estatehelm mcp");
1631
+ console.log("\nTo use with Claude Code, add to your MCP settings:");
1632
+ console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
1633
+ console.log(JSON.stringify({
1634
+ mcpServers: {
1635
+ estatehelm: {
1636
+ command: "npx",
1637
+ args: ["estatehelm", "mcp"]
1638
+ }
1639
+ }
1640
+ }, null, 2));
1641
+ console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
1642
+ console.log("\nOr run manually: estatehelm mcp");
1632
1643
  }
1633
1644
  async function checkLogin() {
1634
1645
  const credentials = await getCredentials();
@@ -1748,10 +1759,16 @@ var SqliteCacheStore = class {
1748
1759
  this.initializeSchema();
1749
1760
  }
1750
1761
  initializeSchema() {
1751
- const versionRow = this.db.prepare(
1752
- "SELECT value FROM metadata WHERE key = 'schema_version'"
1762
+ const tableExists = this.db.prepare(
1763
+ "SELECT name FROM sqlite_master WHERE type='table' AND name='metadata'"
1753
1764
  ).get();
1754
- const currentVersion = versionRow ? parseInt(versionRow.value, 10) : 0;
1765
+ let currentVersion = 0;
1766
+ if (tableExists) {
1767
+ const versionRow = this.db.prepare(
1768
+ "SELECT value FROM metadata WHERE key = 'schema_version'"
1769
+ ).get();
1770
+ currentVersion = versionRow ? parseInt(versionRow.value, 10) : 0;
1771
+ }
1755
1772
  if (currentVersion < DB_VERSION) {
1756
1773
  this.migrate(currentVersion);
1757
1774
  }
@@ -2838,6 +2855,18 @@ async function startServer(mode) {
2838
2855
  const transport = new import_stdio.StdioServerTransport();
2839
2856
  await server.connect(transport);
2840
2857
  console.error("[MCP] Server started");
2858
+ console.error("");
2859
+ console.error("To use with Claude Code, add to ~/.claude/claude_desktop_config.json:");
2860
+ console.error("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
2861
+ console.error(JSON.stringify({
2862
+ mcpServers: {
2863
+ estatehelm: {
2864
+ command: "npx",
2865
+ args: ["estatehelm", "mcp"]
2866
+ }
2867
+ }
2868
+ }, null, 2));
2869
+ console.error("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
2841
2870
  }
2842
2871
  function parseResourceUri(uri) {
2843
2872
  const match = uri.match(/^estatehelm:\/\/([^/]+)(?:\/([^/]+))?(?:\/([^/]+))?(?:\/([^/]+))?$/);