@lovelybunch/api 1.0.32 → 1.0.33

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.
@@ -1,21 +1,11 @@
1
1
  import { promises as fs } from 'fs';
2
2
  import path from 'path';
3
+ import { findGaitDirectory } from '../../../../lib/gait-path.js';
3
4
  async function getConfigPath() {
4
- // Use the same approach as FileStorageAdapter for consistency
5
- let basePath;
6
- if (process.env.NODE_ENV === 'development' && process.env.GAIT_DEV_ROOT) {
7
- // Dev mode: use project root .gait directory
8
- basePath = process.env.GAIT_DEV_ROOT;
9
- }
10
- else if (process.env.GAIT_DATA_PATH) {
11
- // Production mode: use GAIT_DATA_PATH (set by CLI)
12
- basePath = path.resolve(process.env.GAIT_DATA_PATH, '.gait');
13
- }
14
- else {
15
- // Fallback: use current directory .gait
16
- basePath = path.resolve(process.cwd(), '.gait');
17
- }
18
- return path.join(basePath, 'config.json');
5
+ const gaitDir = await findGaitDirectory();
6
+ if (!gaitDir)
7
+ return null;
8
+ return path.join(gaitDir, 'config.json');
19
9
  }
20
10
  export async function GET(c) {
21
11
  try {
@@ -2,7 +2,10 @@ import { Hono } from 'hono';
2
2
  import { promises as fs } from 'fs';
3
3
  import path from 'path';
4
4
  import matter from 'gray-matter';
5
+ import { trimTrailingSlash } from 'hono/trailing-slash';
5
6
  const app = new Hono();
7
+ // Handle trailing slashes consistently
8
+ app.use('*', trimTrailingSlash());
6
9
  function getArchitecturePath() {
7
10
  let basePath;
8
11
  if (process.env.NODE_ENV === 'development' && process.env.GAIT_DEV_ROOT) {
@@ -2,7 +2,10 @@ import { Hono } from 'hono';
2
2
  import { promises as fs } from 'fs';
3
3
  import path from 'path';
4
4
  import matter from 'gray-matter';
5
+ import { trimTrailingSlash } from 'hono/trailing-slash';
5
6
  const app = new Hono();
7
+ // Handle trailing slashes consistently
8
+ app.use('*', trimTrailingSlash());
6
9
  function getProjectPath() {
7
10
  let basePath;
8
11
  if (process.env.NODE_ENV === 'development' && process.env.GAIT_DEV_ROOT) {
@@ -4,6 +4,7 @@ import { createNodeWebSocket } from '@hono/node-ws';
4
4
  import { Hono } from 'hono';
5
5
  import { cors } from 'hono/cors';
6
6
  import { serveStatic } from '@hono/node-server/serve-static';
7
+ import { trimTrailingSlash } from 'hono/trailing-slash';
7
8
  import path from 'path';
8
9
  import fs from 'fs';
9
10
  import { getGlobalTerminalManager } from './lib/terminal/global-manager.js';
@@ -18,6 +19,8 @@ app.use('/api/*', cors({
18
19
  origin: '*',
19
20
  credentials: true,
20
21
  }));
22
+ // Handle trailing slashes consistently for API routes
23
+ app.use('/api/*', trimTrailingSlash());
21
24
  // Create WebSocket support
22
25
  const { injectWebSocket, upgradeWebSocket } = createNodeWebSocket({ app });
23
26
  // WebSocket route for terminal sessions
package/dist/server.js CHANGED
@@ -3,6 +3,7 @@ import { serve } from '@hono/node-server';
3
3
  import { createNodeWebSocket } from '@hono/node-ws';
4
4
  import { Hono } from 'hono';
5
5
  import { cors } from 'hono/cors';
6
+ import { trimTrailingSlash } from 'hono/trailing-slash';
6
7
  import { getGlobalTerminalManager } from './lib/terminal/global-manager.js';
7
8
  import path from 'path';
8
9
  import { fileURLToPath } from 'url';
@@ -16,6 +17,8 @@ app.use('*', cors({
16
17
  origin: ['http://localhost:5173', 'http://localhost:5174', 'http://localhost:3000'], // Vite and Next.js dev servers
17
18
  credentials: true,
18
19
  }));
20
+ // Handle trailing slashes consistently for API routes
21
+ app.use('/api/*', trimTrailingSlash());
19
22
  // Create WebSocket support
20
23
  const { injectWebSocket, upgradeWebSocket } = createNodeWebSocket({ app });
21
24
  // WebSocket route for terminal sessions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lovelybunch/api",
3
- "version": "1.0.32",
3
+ "version": "1.0.33",
4
4
  "type": "module",
5
5
  "main": "dist/server-with-static.js",
6
6
  "exports": {
@@ -32,8 +32,8 @@
32
32
  "dependencies": {
33
33
  "@hono/node-server": "^1.13.7",
34
34
  "@hono/node-ws": "^1.0.6",
35
- "@lovelybunch/core": "^1.0.32",
36
- "@lovelybunch/types": "^1.0.32",
35
+ "@lovelybunch/core": "^1.0.33",
36
+ "@lovelybunch/types": "^1.0.33",
37
37
  "dotenv": "^17.2.1",
38
38
  "fuse.js": "^7.0.0",
39
39
  "gray-matter": "^4.0.3",