@ottocode/server 0.1.202 → 0.1.203
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ottocode/server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.203",
|
|
4
4
|
"description": "HTTP API server for ottocode",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"typecheck": "tsc --noEmit"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@ottocode/sdk": "0.1.
|
|
53
|
-
"@ottocode/database": "0.1.
|
|
52
|
+
"@ottocode/sdk": "0.1.203",
|
|
53
|
+
"@ottocode/database": "0.1.203",
|
|
54
54
|
"drizzle-orm": "^0.44.5",
|
|
55
55
|
"hono": "^4.9.9",
|
|
56
56
|
"zod": "^4.1.8"
|
package/src/routes/git/index.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { registerStagingRoutes } from './staging.ts';
|
|
|
6
6
|
import { registerCommitRoutes } from './commit.ts';
|
|
7
7
|
import { registerPushRoute } from './push.ts';
|
|
8
8
|
import { registerPullRoute } from './pull.ts';
|
|
9
|
+
import { registerInitRoute } from './init.ts';
|
|
9
10
|
|
|
10
11
|
export type { GitFile } from './types.ts';
|
|
11
12
|
|
|
@@ -17,4 +18,5 @@ export function registerGitRoutes(app: Hono) {
|
|
|
17
18
|
registerCommitRoutes(app);
|
|
18
19
|
registerPushRoute(app);
|
|
19
20
|
registerPullRoute(app);
|
|
21
|
+
registerInitRoute(app);
|
|
20
22
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Hono } from 'hono';
|
|
2
|
+
import { execFile } from 'node:child_process';
|
|
3
|
+
import { promisify } from 'node:util';
|
|
4
|
+
import { gitStatusSchema } from './schemas.ts';
|
|
5
|
+
|
|
6
|
+
const execFileAsync = promisify(execFile);
|
|
7
|
+
|
|
8
|
+
export function registerInitRoute(app: Hono) {
|
|
9
|
+
app.post('/v1/git/init', async (c) => {
|
|
10
|
+
try {
|
|
11
|
+
const body = await c.req.json().catch(() => ({}));
|
|
12
|
+
const { project } = gitStatusSchema.parse(body);
|
|
13
|
+
const requestedPath = project || process.cwd();
|
|
14
|
+
|
|
15
|
+
await execFileAsync('git', ['init'], { cwd: requestedPath });
|
|
16
|
+
|
|
17
|
+
return c.json({
|
|
18
|
+
status: 'ok',
|
|
19
|
+
data: { initialized: true, path: requestedPath },
|
|
20
|
+
});
|
|
21
|
+
} catch (error) {
|
|
22
|
+
return c.json(
|
|
23
|
+
{
|
|
24
|
+
status: 'error',
|
|
25
|
+
error:
|
|
26
|
+
error instanceof Error
|
|
27
|
+
? error.message
|
|
28
|
+
: 'Failed to initialize git repository',
|
|
29
|
+
},
|
|
30
|
+
500,
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
@@ -7,6 +7,7 @@ import { resolveSetuModel, type ResolveSetuModelOptions } from './setu.ts';
|
|
|
7
7
|
import { getZaiInstance, getZaiCodingInstance } from './zai.ts';
|
|
8
8
|
import { resolveOpencodeModel } from './opencode.ts';
|
|
9
9
|
import { getMoonshotInstance } from './moonshot.ts';
|
|
10
|
+
import { getMinimaxInstance } from './minimax.ts';
|
|
10
11
|
import { resolveCopilotModel } from './copilot.ts';
|
|
11
12
|
|
|
12
13
|
export type ProviderName = ProviderId;
|
|
@@ -56,5 +57,8 @@ export async function resolveModel(
|
|
|
56
57
|
if (provider === 'moonshot') {
|
|
57
58
|
return getMoonshotInstance(cfg, model);
|
|
58
59
|
}
|
|
60
|
+
if (provider === 'minimax') {
|
|
61
|
+
return getMinimaxInstance(cfg, model);
|
|
62
|
+
}
|
|
59
63
|
throw new Error(`Unsupported provider: ${provider}`);
|
|
60
64
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { OttoConfig } from '@ottocode/sdk';
|
|
2
|
+
import { getAuth, createMinimaxModel } from '@ottocode/sdk';
|
|
3
|
+
|
|
4
|
+
export async function getMinimaxInstance(cfg: OttoConfig, model: string) {
|
|
5
|
+
const auth = await getAuth('minimax', cfg.projectRoot);
|
|
6
|
+
const apiKey = auth?.type === 'api' ? auth.key : undefined;
|
|
7
|
+
return createMinimaxModel(model, { apiKey });
|
|
8
|
+
}
|