@kimuson/claude-code-viewer 0.4.2-beta.2 → 0.4.3
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/README.md +1 -1
- package/dist/main.js +479 -259
- package/dist/main.js.map +4 -4
- package/dist/static/assets/index-BX91c2dU.js +181 -0
- package/dist/static/assets/index-CFyrPwl3.js +1 -0
- package/dist/static/assets/index-COLo22uo.js +135 -0
- package/dist/static/assets/index-Cgk1r7Zx.js +1 -0
- package/dist/static/assets/{index-DIDGF7dr.js → index-L2a6LFAW.js} +1 -1
- package/dist/static/assets/index-boq9-cUJ.js +1 -0
- package/dist/static/assets/index-qaeuDHv4.js +6 -0
- package/dist/static/assets/index-tkMROyMY.css +1 -0
- package/dist/static/assets/label-CUAUo5_J.js +105 -0
- package/dist/static/assets/messages-BY-GWSRM.js +1 -0
- package/dist/static/assets/messages-Cq6UkkpZ.js +1 -0
- package/dist/static/index.html +2 -2
- package/package.json +5 -2
- package/dist/static/assets/fileUtils-Dx6psFN4.js +0 -1
- package/dist/static/assets/formatLocaleDate-Dt6P14B9.js +0 -105
- package/dist/static/assets/index-BCLB4du1.js +0 -1
- package/dist/static/assets/index-BGPIfxUi.js +0 -194
- package/dist/static/assets/index-BSbB57mR.css +0 -1
- package/dist/static/assets/index-CK6hOCWi.js +0 -1
- package/dist/static/assets/index-DfIIjCmW.js +0 -6
- package/dist/static/assets/index-ctyalk2m.js +0 -1
- package/dist/static/assets/index-u3TFrHTl.js +0 -115
- package/dist/static/assets/messages-B2As9KeS.js +0 -1
- package/dist/static/assets/messages-CTBgz1qg.js +0 -1
package/dist/main.js
CHANGED
|
@@ -112,7 +112,7 @@ var encodeProjectIdFromSessionFilePath = (sessionFilePath) => {
|
|
|
112
112
|
// src/server/core/project/services/ProjectMetaService.ts
|
|
113
113
|
import { FileSystem as FileSystem2, Path as Path3 } from "@effect/platform";
|
|
114
114
|
import { Context as Context4, Effect as Effect5, Layer as Layer5, Option, Ref as Ref3 } from "effect";
|
|
115
|
-
import { z as
|
|
115
|
+
import { z as z19 } from "zod";
|
|
116
116
|
|
|
117
117
|
// src/server/lib/storage/FileCacheStorage/index.ts
|
|
118
118
|
import { Context as Context3, Effect as Effect4, Layer as Layer4, Ref as Ref2, Runtime } from "effect";
|
|
@@ -245,7 +245,7 @@ var makeFileCacheStorageLayer = (storageKey, schema) => Layer4.effect(
|
|
|
245
245
|
);
|
|
246
246
|
|
|
247
247
|
// src/lib/conversation-schema/index.ts
|
|
248
|
-
import { z as
|
|
248
|
+
import { z as z18 } from "zod";
|
|
249
249
|
|
|
250
250
|
// src/lib/conversation-schema/entry/AssistantEntrySchema.ts
|
|
251
251
|
import { z as z10 } from "zod";
|
|
@@ -381,80 +381,99 @@ var FileHistorySnapshotEntrySchema = z11.object({
|
|
|
381
381
|
isSnapshotUpdate: z11.boolean()
|
|
382
382
|
});
|
|
383
383
|
|
|
384
|
-
// src/lib/conversation-schema/entry/
|
|
384
|
+
// src/lib/conversation-schema/entry/QueueOperationEntrySchema.ts
|
|
385
385
|
import { z as z12 } from "zod";
|
|
386
|
-
var
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
386
|
+
var QueueOperationEntrySchema = z12.union([
|
|
387
|
+
z12.object({
|
|
388
|
+
type: z12.literal("queue-operation"),
|
|
389
|
+
operation: z12.literal("enqueue"),
|
|
390
|
+
content: z12.string(),
|
|
391
|
+
sessionId: z12.string(),
|
|
392
|
+
timestamp: z12.iso.datetime()
|
|
393
|
+
}),
|
|
394
|
+
z12.object({
|
|
395
|
+
type: z12.literal("queue-operation"),
|
|
396
|
+
operation: z12.literal("dequeue"),
|
|
397
|
+
sessionId: z12.string(),
|
|
398
|
+
timestamp: z12.iso.datetime()
|
|
399
|
+
})
|
|
400
|
+
]);
|
|
401
|
+
|
|
402
|
+
// src/lib/conversation-schema/entry/SummaryEntrySchema.ts
|
|
403
|
+
import { z as z13 } from "zod";
|
|
404
|
+
var SummaryEntrySchema = z13.object({
|
|
405
|
+
type: z13.literal("summary"),
|
|
406
|
+
summary: z13.string(),
|
|
407
|
+
leafUuid: z13.string().uuid()
|
|
390
408
|
});
|
|
391
409
|
|
|
392
410
|
// src/lib/conversation-schema/entry/SystemEntrySchema.ts
|
|
393
|
-
import { z as
|
|
411
|
+
import { z as z14 } from "zod";
|
|
394
412
|
var SystemEntrySchema = BaseEntrySchema.extend({
|
|
395
413
|
// discriminator
|
|
396
|
-
type:
|
|
414
|
+
type: z14.literal("system"),
|
|
397
415
|
// required
|
|
398
|
-
content:
|
|
399
|
-
toolUseID:
|
|
400
|
-
level:
|
|
416
|
+
content: z14.string(),
|
|
417
|
+
toolUseID: z14.string(),
|
|
418
|
+
level: z14.enum(["info"])
|
|
401
419
|
});
|
|
402
420
|
|
|
403
421
|
// src/lib/conversation-schema/entry/UserEntrySchema.ts
|
|
404
|
-
import { z as
|
|
422
|
+
import { z as z17 } from "zod";
|
|
405
423
|
|
|
406
424
|
// src/lib/conversation-schema/message/UserMessageSchema.ts
|
|
407
|
-
import { z as
|
|
425
|
+
import { z as z16 } from "zod";
|
|
408
426
|
|
|
409
427
|
// src/lib/conversation-schema/content/DocumentContentSchema.ts
|
|
410
|
-
import { z as
|
|
411
|
-
var DocumentContentSchema =
|
|
412
|
-
type:
|
|
413
|
-
source:
|
|
414
|
-
|
|
415
|
-
media_type:
|
|
416
|
-
type:
|
|
417
|
-
data:
|
|
428
|
+
import { z as z15 } from "zod";
|
|
429
|
+
var DocumentContentSchema = z15.object({
|
|
430
|
+
type: z15.literal("document"),
|
|
431
|
+
source: z15.union([
|
|
432
|
+
z15.object({
|
|
433
|
+
media_type: z15.literal("text/plain"),
|
|
434
|
+
type: z15.literal("text"),
|
|
435
|
+
data: z15.string()
|
|
418
436
|
}),
|
|
419
|
-
|
|
420
|
-
media_type:
|
|
421
|
-
type:
|
|
422
|
-
data:
|
|
437
|
+
z15.object({
|
|
438
|
+
media_type: z15.enum(["application/pdf"]),
|
|
439
|
+
type: z15.literal("base64"),
|
|
440
|
+
data: z15.string()
|
|
423
441
|
})
|
|
424
442
|
])
|
|
425
443
|
});
|
|
426
444
|
|
|
427
445
|
// src/lib/conversation-schema/message/UserMessageSchema.ts
|
|
428
|
-
var UserMessageContentSchema =
|
|
429
|
-
|
|
446
|
+
var UserMessageContentSchema = z16.union([
|
|
447
|
+
z16.string(),
|
|
430
448
|
TextContentSchema,
|
|
431
449
|
ToolResultContentSchema,
|
|
432
450
|
ImageContentSchema,
|
|
433
451
|
DocumentContentSchema
|
|
434
452
|
]);
|
|
435
|
-
var UserMessageSchema =
|
|
436
|
-
role:
|
|
437
|
-
content:
|
|
438
|
-
|
|
439
|
-
|
|
453
|
+
var UserMessageSchema = z16.object({
|
|
454
|
+
role: z16.literal("user"),
|
|
455
|
+
content: z16.union([
|
|
456
|
+
z16.string(),
|
|
457
|
+
z16.array(z16.union([z16.string(), UserMessageContentSchema]))
|
|
440
458
|
])
|
|
441
459
|
});
|
|
442
460
|
|
|
443
461
|
// src/lib/conversation-schema/entry/UserEntrySchema.ts
|
|
444
462
|
var UserEntrySchema = BaseEntrySchema.extend({
|
|
445
463
|
// discriminator
|
|
446
|
-
type:
|
|
464
|
+
type: z17.literal("user"),
|
|
447
465
|
// required
|
|
448
466
|
message: UserMessageSchema
|
|
449
467
|
});
|
|
450
468
|
|
|
451
469
|
// src/lib/conversation-schema/index.ts
|
|
452
|
-
var ConversationSchema =
|
|
470
|
+
var ConversationSchema = z18.union([
|
|
453
471
|
UserEntrySchema,
|
|
454
472
|
AssistantEntrySchema,
|
|
455
473
|
SummaryEntrySchema,
|
|
456
474
|
SystemEntrySchema,
|
|
457
|
-
FileHistorySnapshotEntrySchema
|
|
475
|
+
FileHistorySnapshotEntrySchema,
|
|
476
|
+
QueueOperationEntrySchema
|
|
458
477
|
]);
|
|
459
478
|
|
|
460
479
|
// src/server/core/claude-code/functions/parseJsonl.ts
|
|
@@ -475,7 +494,7 @@ var parseJsonl = (content) => {
|
|
|
475
494
|
};
|
|
476
495
|
|
|
477
496
|
// src/server/core/project/services/ProjectMetaService.ts
|
|
478
|
-
var ProjectPathSchema =
|
|
497
|
+
var ProjectPathSchema = z19.string().nullable();
|
|
479
498
|
var LayerImpl4 = Effect5.gen(function* () {
|
|
480
499
|
const fs = yield* FileSystem2.FileSystem;
|
|
481
500
|
const path = yield* Path3.Path;
|
|
@@ -491,7 +510,7 @@ var LayerImpl4 = Effect5.gen(function* () {
|
|
|
491
510
|
let cwd = null;
|
|
492
511
|
for (const line of lines) {
|
|
493
512
|
const conversation = parseJsonl(line).at(0);
|
|
494
|
-
if (conversation === void 0 || conversation.type === "summary" || conversation.type === "x-error" || conversation.type === "file-history-snapshot") {
|
|
513
|
+
if (conversation === void 0 || conversation.type === "summary" || conversation.type === "x-error" || conversation.type === "file-history-snapshot" || conversation.type === "queue-operation") {
|
|
495
514
|
continue;
|
|
496
515
|
}
|
|
497
516
|
cwd = conversation.cwd;
|
|
@@ -649,12 +668,12 @@ var ProjectRepository = class extends Context5.Tag("ProjectRepository")() {
|
|
|
649
668
|
};
|
|
650
669
|
|
|
651
670
|
// src/server/core/claude-code/models/ClaudeCodeVersion.ts
|
|
652
|
-
import { z as
|
|
671
|
+
import { z as z20 } from "zod";
|
|
653
672
|
var versionRegex = /^(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)/;
|
|
654
|
-
var versionSchema =
|
|
655
|
-
major:
|
|
656
|
-
minor:
|
|
657
|
-
patch:
|
|
673
|
+
var versionSchema = z20.object({
|
|
674
|
+
major: z20.string().transform((value) => Number.parseInt(value, 10)),
|
|
675
|
+
minor: z20.string().transform((value) => Number.parseInt(value, 10)),
|
|
676
|
+
patch: z20.string().transform((value) => Number.parseInt(value, 10))
|
|
658
677
|
}).refine(
|
|
659
678
|
(data) => [data.major, data.minor, data.patch].every((value) => !Number.isNaN(value))
|
|
660
679
|
);
|
|
@@ -700,7 +719,9 @@ var parseMcpListOutput = (output) => {
|
|
|
700
719
|
|
|
701
720
|
// src/server/core/claude-code/models/ClaudeCode.ts
|
|
702
721
|
import { query as agentSdkQuery } from "@anthropic-ai/claude-agent-sdk";
|
|
703
|
-
import {
|
|
722
|
+
import {
|
|
723
|
+
query as claudeCodeQuery
|
|
724
|
+
} from "@anthropic-ai/claude-code";
|
|
704
725
|
import { Command, Path as Path5 } from "@effect/platform";
|
|
705
726
|
import { Data, Effect as Effect7 } from "effect";
|
|
706
727
|
var ClaudeCodePathNotFoundError = class extends Data.TaggedError(
|
|
@@ -818,9 +839,27 @@ var query = (prompt, options) => {
|
|
|
818
839
|
}
|
|
819
840
|
});
|
|
820
841
|
}
|
|
842
|
+
const fallbackCanUseTool = (() => {
|
|
843
|
+
const canUseTool2 = options2.canUseTool;
|
|
844
|
+
if (canUseTool2 === void 0) {
|
|
845
|
+
return void 0;
|
|
846
|
+
}
|
|
847
|
+
const fn = async (toolName, input, canUseToolOptions) => {
|
|
848
|
+
const response = await canUseTool2(toolName, input, {
|
|
849
|
+
signal: canUseToolOptions.signal,
|
|
850
|
+
suggestions: canUseToolOptions.suggestions,
|
|
851
|
+
toolUseID: void 0
|
|
852
|
+
});
|
|
853
|
+
return response;
|
|
854
|
+
};
|
|
855
|
+
return fn;
|
|
856
|
+
})();
|
|
821
857
|
return claudeCodeQuery({
|
|
822
858
|
prompt,
|
|
823
|
-
options:
|
|
859
|
+
options: {
|
|
860
|
+
...options2,
|
|
861
|
+
canUseTool: fallbackCanUseTool
|
|
862
|
+
}
|
|
824
863
|
});
|
|
825
864
|
});
|
|
826
865
|
};
|
|
@@ -1145,7 +1184,7 @@ import { Context as Context11, Effect as Effect13, Layer as Layer12, Ref as Ref5
|
|
|
1145
1184
|
var LayerImpl10 = Effect13.gen(function* () {
|
|
1146
1185
|
const configRef = yield* Ref5.make({
|
|
1147
1186
|
hideNoUserMessageSession: true,
|
|
1148
|
-
unifySameTitleSession:
|
|
1187
|
+
unifySameTitleSession: false,
|
|
1149
1188
|
enterKeyBehavior: "shift-enter-send",
|
|
1150
1189
|
permissionMode: "default",
|
|
1151
1190
|
locale: "ja",
|
|
@@ -1204,26 +1243,26 @@ import { FileSystem as FileSystem6, Path as Path7 } from "@effect/platform";
|
|
|
1204
1243
|
import { Context as Context14, Effect as Effect16, Layer as Layer15, Option as Option3 } from "effect";
|
|
1205
1244
|
|
|
1206
1245
|
// src/server/core/claude-code/functions/parseUserMessage.ts
|
|
1207
|
-
import { z as
|
|
1246
|
+
import { z as z21 } from "zod";
|
|
1208
1247
|
var regExp = /<(?<tag>[^>]+)>(?<content>\s*[^<]*?\s*)<\/\k<tag>>/g;
|
|
1209
|
-
var matchSchema =
|
|
1210
|
-
tag:
|
|
1211
|
-
content:
|
|
1248
|
+
var matchSchema = z21.object({
|
|
1249
|
+
tag: z21.string(),
|
|
1250
|
+
content: z21.string()
|
|
1212
1251
|
});
|
|
1213
|
-
var parsedUserMessageSchema =
|
|
1214
|
-
|
|
1215
|
-
kind:
|
|
1216
|
-
commandName:
|
|
1217
|
-
commandArgs:
|
|
1218
|
-
commandMessage:
|
|
1252
|
+
var parsedUserMessageSchema = z21.union([
|
|
1253
|
+
z21.object({
|
|
1254
|
+
kind: z21.literal("command"),
|
|
1255
|
+
commandName: z21.string(),
|
|
1256
|
+
commandArgs: z21.string().optional(),
|
|
1257
|
+
commandMessage: z21.string().optional()
|
|
1219
1258
|
}),
|
|
1220
|
-
|
|
1221
|
-
kind:
|
|
1222
|
-
stdout:
|
|
1259
|
+
z21.object({
|
|
1260
|
+
kind: z21.literal("local-command"),
|
|
1261
|
+
stdout: z21.string()
|
|
1223
1262
|
}),
|
|
1224
|
-
|
|
1225
|
-
kind:
|
|
1226
|
-
content:
|
|
1263
|
+
z21.object({
|
|
1264
|
+
kind: z21.literal("text"),
|
|
1265
|
+
content: z21.string()
|
|
1227
1266
|
})
|
|
1228
1267
|
]);
|
|
1229
1268
|
var parseUserMessage = (content) => {
|
|
@@ -1741,6 +1780,31 @@ var createMessageGenerator = () => {
|
|
|
1741
1780
|
};
|
|
1742
1781
|
};
|
|
1743
1782
|
|
|
1783
|
+
// src/server/core/claude-code/functions/fallbackSdkMessage.ts
|
|
1784
|
+
var fallbackSdkMessage = (message) => {
|
|
1785
|
+
if (message.type === "system") {
|
|
1786
|
+
if (message.subtype === "init") {
|
|
1787
|
+
return {
|
|
1788
|
+
...message,
|
|
1789
|
+
plugins: []
|
|
1790
|
+
};
|
|
1791
|
+
}
|
|
1792
|
+
return message;
|
|
1793
|
+
}
|
|
1794
|
+
if (message.type === "result") {
|
|
1795
|
+
if (message.subtype === "success") {
|
|
1796
|
+
return {
|
|
1797
|
+
...message
|
|
1798
|
+
};
|
|
1799
|
+
}
|
|
1800
|
+
return {
|
|
1801
|
+
...message,
|
|
1802
|
+
errors: []
|
|
1803
|
+
};
|
|
1804
|
+
}
|
|
1805
|
+
return message;
|
|
1806
|
+
};
|
|
1807
|
+
|
|
1744
1808
|
// src/server/core/claude-code/models/CCSessionProcess.ts
|
|
1745
1809
|
import { Effect as Effect17 } from "effect";
|
|
1746
1810
|
var isPublic = (process2) => {
|
|
@@ -2318,8 +2382,9 @@ var LayerImpl13 = Effect19.gen(function* () {
|
|
|
2318
2382
|
setNextMessage(input);
|
|
2319
2383
|
try {
|
|
2320
2384
|
for await (const message of messageIter) {
|
|
2385
|
+
const fallbackMessage = fallbackSdkMessage(message);
|
|
2321
2386
|
const result = await Runtime2.runPromise(runtime)(
|
|
2322
|
-
handleMessage(
|
|
2387
|
+
handleMessage(fallbackMessage)
|
|
2323
2388
|
).catch((error) => {
|
|
2324
2389
|
Effect19.runFork(
|
|
2325
2390
|
sessionProcessService.changeTaskState({
|
|
@@ -2664,11 +2729,11 @@ var SSEController = class extends Context19.Tag("SSEController")() {
|
|
|
2664
2729
|
import { watch } from "node:fs";
|
|
2665
2730
|
import { Path as Path8 } from "@effect/platform";
|
|
2666
2731
|
import { Context as Context20, Effect as Effect23, Layer as Layer21, Ref as Ref9 } from "effect";
|
|
2667
|
-
import
|
|
2732
|
+
import z22 from "zod";
|
|
2668
2733
|
var fileRegExp = /(?<projectId>.*?)\/(?<sessionId>.*?)\.jsonl/;
|
|
2669
|
-
var fileRegExpGroupSchema =
|
|
2670
|
-
projectId:
|
|
2671
|
-
sessionId:
|
|
2734
|
+
var fileRegExpGroupSchema = z22.object({
|
|
2735
|
+
projectId: z22.string(),
|
|
2736
|
+
sessionId: z22.string()
|
|
2672
2737
|
});
|
|
2673
2738
|
var FileWatcherService = class extends Context20.Tag("FileWatcherService")() {
|
|
2674
2739
|
static {
|
|
@@ -2824,7 +2889,7 @@ import { Context as Context22, Effect as Effect25, Layer as Layer23 } from "effe
|
|
|
2824
2889
|
import { existsSync } from "node:fs";
|
|
2825
2890
|
import { readdir } from "node:fs/promises";
|
|
2826
2891
|
import { dirname as dirname2, join, resolve as resolve3 } from "node:path";
|
|
2827
|
-
var getDirectoryListing = async (rootPath, basePath = "/") => {
|
|
2892
|
+
var getDirectoryListing = async (rootPath, basePath = "/", showHidden = false) => {
|
|
2828
2893
|
const normalizedBasePath = basePath === "/" ? "" : basePath.startsWith("/") ? basePath.slice(1) : basePath;
|
|
2829
2894
|
const targetPath = resolve3(rootPath, normalizedBasePath);
|
|
2830
2895
|
if (!targetPath.startsWith(resolve3(rootPath))) {
|
|
@@ -2849,7 +2914,7 @@ var getDirectoryListing = async (rootPath, basePath = "/") => {
|
|
|
2849
2914
|
});
|
|
2850
2915
|
}
|
|
2851
2916
|
for (const dirent of dirents) {
|
|
2852
|
-
if (dirent.name.startsWith(".")) {
|
|
2917
|
+
if (!showHidden && dirent.name.startsWith(".")) {
|
|
2853
2918
|
continue;
|
|
2854
2919
|
}
|
|
2855
2920
|
const entryPath = normalizedBasePath ? join(normalizedBasePath, dirent.name) : dirent.name;
|
|
@@ -2980,13 +3045,17 @@ var LayerImpl17 = Effect25.gen(function* () {
|
|
|
2980
3045
|
}
|
|
2981
3046
|
});
|
|
2982
3047
|
const getDirectoryListingRoute = (options) => Effect25.promise(async () => {
|
|
2983
|
-
const { currentPath } = options;
|
|
3048
|
+
const { currentPath, showHidden = false } = options;
|
|
2984
3049
|
const rootPath = "/";
|
|
2985
3050
|
const defaultPath = homedir3();
|
|
2986
3051
|
try {
|
|
2987
3052
|
const targetPath = currentPath ?? defaultPath;
|
|
2988
3053
|
const relativePath = targetPath.startsWith(rootPath) ? targetPath.slice(rootPath.length) : targetPath;
|
|
2989
|
-
const result = await getDirectoryListing(
|
|
3054
|
+
const result = await getDirectoryListing(
|
|
3055
|
+
rootPath,
|
|
3056
|
+
relativePath,
|
|
3057
|
+
showHidden
|
|
3058
|
+
);
|
|
2990
3059
|
return {
|
|
2991
3060
|
response: result,
|
|
2992
3061
|
status: 200
|
|
@@ -3590,6 +3659,114 @@ var LayerImpl18 = Effect26.gen(function* () {
|
|
|
3590
3659
|
console.log("[GitService.push] Push succeeded");
|
|
3591
3660
|
return { branch, output: "success" };
|
|
3592
3661
|
});
|
|
3662
|
+
const getBranchHash = (cwd, branchName) => Effect26.gen(function* () {
|
|
3663
|
+
const result = yield* execGitCommand(["rev-parse", branchName], cwd).pipe(
|
|
3664
|
+
Effect26.map((output) => output.trim().split("\n")[0] ?? null)
|
|
3665
|
+
);
|
|
3666
|
+
return result;
|
|
3667
|
+
});
|
|
3668
|
+
const getBranchNamesByCommitHash = (cwd, hash) => Effect26.gen(function* () {
|
|
3669
|
+
const result = yield* execGitCommand(
|
|
3670
|
+
["branch", "--contains", hash, "--format=%(refname:short)"],
|
|
3671
|
+
cwd
|
|
3672
|
+
);
|
|
3673
|
+
return result.split("\n").map((line) => line.trim()).filter((line) => line !== "");
|
|
3674
|
+
});
|
|
3675
|
+
const compareCommitHash = (cwd, targetHash, compareHash) => Effect26.gen(function* () {
|
|
3676
|
+
const aheadResult = yield* execGitCommand(
|
|
3677
|
+
["rev-list", `${targetHash}..${compareHash}`],
|
|
3678
|
+
cwd
|
|
3679
|
+
);
|
|
3680
|
+
const aheadCounts = aheadResult.split("\n").map((line) => line.trim()).filter((line) => line !== "").length;
|
|
3681
|
+
const behindResult = yield* execGitCommand(
|
|
3682
|
+
["rev-list", `${compareHash}..${targetHash}`],
|
|
3683
|
+
cwd
|
|
3684
|
+
);
|
|
3685
|
+
const behindCounts = behindResult.split("\n").map((line) => line.trim()).filter((line) => line !== "").length;
|
|
3686
|
+
if (aheadCounts === 0 && behindCounts === 0) {
|
|
3687
|
+
return "un-related";
|
|
3688
|
+
}
|
|
3689
|
+
if (aheadCounts > 0) {
|
|
3690
|
+
return "ahead";
|
|
3691
|
+
}
|
|
3692
|
+
if (behindCounts > 0) {
|
|
3693
|
+
return "behind";
|
|
3694
|
+
}
|
|
3695
|
+
return "un-related";
|
|
3696
|
+
});
|
|
3697
|
+
const getCommitsWithParent = (cwd, options) => Effect26.gen(function* () {
|
|
3698
|
+
const { offset, limit } = options;
|
|
3699
|
+
const result = yield* execGitCommand(
|
|
3700
|
+
[
|
|
3701
|
+
"log",
|
|
3702
|
+
"-n",
|
|
3703
|
+
String(limit),
|
|
3704
|
+
"--skip",
|
|
3705
|
+
String(offset),
|
|
3706
|
+
"--graph",
|
|
3707
|
+
"--pretty=format:%h %p"
|
|
3708
|
+
],
|
|
3709
|
+
cwd
|
|
3710
|
+
);
|
|
3711
|
+
const lines = result.split("\n").map((line) => line.trim()).filter((line) => line !== "");
|
|
3712
|
+
const commits = [];
|
|
3713
|
+
for (const line of lines) {
|
|
3714
|
+
const match = /^\* (?<current>.+) (?<parent>.+)$/.exec(line);
|
|
3715
|
+
if (match?.groups?.current && match.groups.parent) {
|
|
3716
|
+
commits.push({
|
|
3717
|
+
current: match.groups.current,
|
|
3718
|
+
parent: match.groups.parent
|
|
3719
|
+
});
|
|
3720
|
+
}
|
|
3721
|
+
}
|
|
3722
|
+
return commits;
|
|
3723
|
+
});
|
|
3724
|
+
const findBaseBranch = (cwd, targetBranch) => Effect26.gen(function* () {
|
|
3725
|
+
let offset = 0;
|
|
3726
|
+
const limit = 20;
|
|
3727
|
+
while (offset < 100) {
|
|
3728
|
+
const commits = yield* getCommitsWithParent(cwd, { offset, limit });
|
|
3729
|
+
for (const commit2 of commits) {
|
|
3730
|
+
const branchNames = yield* getBranchNamesByCommitHash(
|
|
3731
|
+
cwd,
|
|
3732
|
+
commit2.current
|
|
3733
|
+
);
|
|
3734
|
+
if (!branchNames.includes(targetBranch)) {
|
|
3735
|
+
continue;
|
|
3736
|
+
}
|
|
3737
|
+
const otherBranchNames = branchNames.filter(
|
|
3738
|
+
(branchName) => branchName !== targetBranch
|
|
3739
|
+
);
|
|
3740
|
+
if (otherBranchNames.length === 0) {
|
|
3741
|
+
continue;
|
|
3742
|
+
}
|
|
3743
|
+
for (const branchName of otherBranchNames) {
|
|
3744
|
+
const comparison = yield* compareCommitHash(
|
|
3745
|
+
cwd,
|
|
3746
|
+
targetBranch,
|
|
3747
|
+
branchName
|
|
3748
|
+
);
|
|
3749
|
+
if (comparison === "behind") {
|
|
3750
|
+
return { branch: branchName, hash: commit2.current };
|
|
3751
|
+
}
|
|
3752
|
+
}
|
|
3753
|
+
}
|
|
3754
|
+
offset += limit;
|
|
3755
|
+
}
|
|
3756
|
+
return null;
|
|
3757
|
+
});
|
|
3758
|
+
const getCommitsBetweenBranches = (cwd, baseBranch, targetBranch) => Effect26.gen(function* () {
|
|
3759
|
+
const result = yield* execGitCommand(
|
|
3760
|
+
[
|
|
3761
|
+
"log",
|
|
3762
|
+
`${baseBranch}..${targetBranch}`,
|
|
3763
|
+
"--format=%H|%s|%an|%ad",
|
|
3764
|
+
"--date=iso"
|
|
3765
|
+
],
|
|
3766
|
+
cwd
|
|
3767
|
+
);
|
|
3768
|
+
return parseGitCommitsOutput(result);
|
|
3769
|
+
});
|
|
3593
3770
|
return {
|
|
3594
3771
|
getBranches,
|
|
3595
3772
|
getCurrentBranch,
|
|
@@ -3597,7 +3774,13 @@ var LayerImpl18 = Effect26.gen(function* () {
|
|
|
3597
3774
|
getCommits,
|
|
3598
3775
|
stageFiles,
|
|
3599
3776
|
commit,
|
|
3600
|
-
push
|
|
3777
|
+
push,
|
|
3778
|
+
getBranchHash,
|
|
3779
|
+
getBranchNamesByCommitHash,
|
|
3780
|
+
compareCommitHash,
|
|
3781
|
+
getCommitsWithParent,
|
|
3782
|
+
findBaseBranch,
|
|
3783
|
+
getCommitsBetweenBranches
|
|
3601
3784
|
};
|
|
3602
3785
|
});
|
|
3603
3786
|
var GitService = class extends Context23.Tag("GitService")() {
|
|
@@ -3610,56 +3793,6 @@ var GitService = class extends Context23.Tag("GitService")() {
|
|
|
3610
3793
|
var LayerImpl19 = Effect27.gen(function* () {
|
|
3611
3794
|
const gitService = yield* GitService;
|
|
3612
3795
|
const projectRepository = yield* ProjectRepository;
|
|
3613
|
-
const getGitBranches = (options) => Effect27.gen(function* () {
|
|
3614
|
-
const { projectId } = options;
|
|
3615
|
-
const { project } = yield* projectRepository.getProject(projectId);
|
|
3616
|
-
if (project.meta.projectPath === null) {
|
|
3617
|
-
return {
|
|
3618
|
-
response: { error: "Project path not found" },
|
|
3619
|
-
status: 400
|
|
3620
|
-
};
|
|
3621
|
-
}
|
|
3622
|
-
const projectPath = project.meta.projectPath;
|
|
3623
|
-
const branches = yield* Effect27.either(
|
|
3624
|
-
gitService.getBranches(projectPath)
|
|
3625
|
-
);
|
|
3626
|
-
if (Either2.isLeft(branches)) {
|
|
3627
|
-
return {
|
|
3628
|
-
response: {
|
|
3629
|
-
success: false
|
|
3630
|
-
},
|
|
3631
|
-
status: 200
|
|
3632
|
-
};
|
|
3633
|
-
}
|
|
3634
|
-
return {
|
|
3635
|
-
response: branches.right,
|
|
3636
|
-
status: 200
|
|
3637
|
-
};
|
|
3638
|
-
});
|
|
3639
|
-
const getGitCommits = (options) => Effect27.gen(function* () {
|
|
3640
|
-
const { projectId } = options;
|
|
3641
|
-
const { project } = yield* projectRepository.getProject(projectId);
|
|
3642
|
-
if (project.meta.projectPath === null) {
|
|
3643
|
-
return {
|
|
3644
|
-
response: { error: "Project path not found" },
|
|
3645
|
-
status: 400
|
|
3646
|
-
};
|
|
3647
|
-
}
|
|
3648
|
-
const projectPath = project.meta.projectPath;
|
|
3649
|
-
const commits = yield* Effect27.either(gitService.getCommits(projectPath));
|
|
3650
|
-
if (Either2.isLeft(commits)) {
|
|
3651
|
-
return {
|
|
3652
|
-
response: {
|
|
3653
|
-
success: false
|
|
3654
|
-
},
|
|
3655
|
-
status: 200
|
|
3656
|
-
};
|
|
3657
|
-
}
|
|
3658
|
-
return {
|
|
3659
|
-
response: commits.right,
|
|
3660
|
-
status: 200
|
|
3661
|
-
};
|
|
3662
|
-
});
|
|
3663
3796
|
const getGitDiff = (options) => Effect27.gen(function* () {
|
|
3664
3797
|
const { projectId, fromRef, toRef } = options;
|
|
3665
3798
|
const { project } = yield* projectRepository.getProject(projectId);
|
|
@@ -3854,13 +3987,86 @@ var LayerImpl19 = Effect27.gen(function* () {
|
|
|
3854
3987
|
status: 200
|
|
3855
3988
|
};
|
|
3856
3989
|
});
|
|
3990
|
+
const getCurrentRevisions = (options) => Effect27.gen(function* () {
|
|
3991
|
+
const { projectId } = options;
|
|
3992
|
+
const { project } = yield* projectRepository.getProject(projectId);
|
|
3993
|
+
if (project.meta.projectPath === null) {
|
|
3994
|
+
return {
|
|
3995
|
+
response: { error: "Project path not found" },
|
|
3996
|
+
status: 400
|
|
3997
|
+
};
|
|
3998
|
+
}
|
|
3999
|
+
const projectPath = project.meta.projectPath;
|
|
4000
|
+
const currentBranchResult = yield* Effect27.either(
|
|
4001
|
+
gitService.getCurrentBranch(projectPath)
|
|
4002
|
+
);
|
|
4003
|
+
if (Either2.isLeft(currentBranchResult)) {
|
|
4004
|
+
return {
|
|
4005
|
+
response: {
|
|
4006
|
+
success: false
|
|
4007
|
+
},
|
|
4008
|
+
status: 200
|
|
4009
|
+
};
|
|
4010
|
+
}
|
|
4011
|
+
const currentBranch = currentBranchResult.right;
|
|
4012
|
+
const baseBranchResult = yield* Effect27.either(
|
|
4013
|
+
gitService.findBaseBranch(projectPath, currentBranch)
|
|
4014
|
+
);
|
|
4015
|
+
const allBranchesResult = yield* Effect27.either(
|
|
4016
|
+
gitService.getBranches(projectPath)
|
|
4017
|
+
);
|
|
4018
|
+
if (Either2.isLeft(allBranchesResult)) {
|
|
4019
|
+
return {
|
|
4020
|
+
response: {
|
|
4021
|
+
success: false
|
|
4022
|
+
},
|
|
4023
|
+
status: 200
|
|
4024
|
+
};
|
|
4025
|
+
}
|
|
4026
|
+
const allBranches = allBranchesResult.right.data;
|
|
4027
|
+
const currentBranchDetails = allBranches.find(
|
|
4028
|
+
(branch) => branch.name === currentBranch
|
|
4029
|
+
);
|
|
4030
|
+
let baseBranchDetails;
|
|
4031
|
+
if (Either2.isRight(baseBranchResult) && baseBranchResult.right !== null) {
|
|
4032
|
+
const baseBranchName = baseBranchResult.right.branch;
|
|
4033
|
+
baseBranchDetails = allBranches.find(
|
|
4034
|
+
(branch) => branch.name === baseBranchName
|
|
4035
|
+
);
|
|
4036
|
+
}
|
|
4037
|
+
let commits = [];
|
|
4038
|
+
if (Either2.isRight(baseBranchResult) && baseBranchResult.right !== null) {
|
|
4039
|
+
const baseBranchHash = baseBranchResult.right.hash;
|
|
4040
|
+
const commitsResult = yield* Effect27.either(
|
|
4041
|
+
gitService.getCommitsBetweenBranches(
|
|
4042
|
+
projectPath,
|
|
4043
|
+
baseBranchHash,
|
|
4044
|
+
"HEAD"
|
|
4045
|
+
)
|
|
4046
|
+
);
|
|
4047
|
+
if (Either2.isRight(commitsResult)) {
|
|
4048
|
+
commits = commitsResult.right.data;
|
|
4049
|
+
}
|
|
4050
|
+
}
|
|
4051
|
+
return {
|
|
4052
|
+
response: {
|
|
4053
|
+
success: true,
|
|
4054
|
+
data: {
|
|
4055
|
+
baseBranch: baseBranchDetails ?? null,
|
|
4056
|
+
currentBranch: currentBranchDetails ?? null,
|
|
4057
|
+
head: currentBranchDetails?.commit ?? null,
|
|
4058
|
+
commits
|
|
4059
|
+
}
|
|
4060
|
+
},
|
|
4061
|
+
status: 200
|
|
4062
|
+
};
|
|
4063
|
+
});
|
|
3857
4064
|
return {
|
|
3858
|
-
getGitBranches,
|
|
3859
|
-
getGitCommits,
|
|
3860
4065
|
getGitDiff,
|
|
3861
4066
|
commitFiles,
|
|
3862
4067
|
pushCommits,
|
|
3863
|
-
commitAndPush
|
|
4068
|
+
commitAndPush,
|
|
4069
|
+
getCurrentRevisions
|
|
3864
4070
|
};
|
|
3865
4071
|
});
|
|
3866
4072
|
function parsePushError(stderr) {
|
|
@@ -3901,6 +4107,7 @@ var GitController = class extends Context24.Tag("GitController")() {
|
|
|
3901
4107
|
};
|
|
3902
4108
|
|
|
3903
4109
|
// src/server/core/project/presentation/ProjectController.ts
|
|
4110
|
+
import { FileSystem as FileSystem8, Path as Path11 } from "@effect/platform";
|
|
3904
4111
|
import { Context as Context25, Effect as Effect29, Layer as Layer26 } from "effect";
|
|
3905
4112
|
|
|
3906
4113
|
// src/server/core/claude-code/functions/computeClaudeProjectFilePath.ts
|
|
@@ -3922,6 +4129,8 @@ var LayerImpl20 = Effect29.gen(function* () {
|
|
|
3922
4129
|
const userConfigService = yield* UserConfigService;
|
|
3923
4130
|
const sessionRepository = yield* SessionRepository;
|
|
3924
4131
|
const context = yield* ApplicationContext;
|
|
4132
|
+
const fileSystem = yield* FileSystem8.FileSystem;
|
|
4133
|
+
const path = yield* Path11.Path;
|
|
3925
4134
|
const getProjects = () => Effect29.gen(function* () {
|
|
3926
4135
|
const { projects } = yield* projectRepository.getProjects();
|
|
3927
4136
|
return {
|
|
@@ -4003,6 +4212,8 @@ var LayerImpl20 = Effect29.gen(function* () {
|
|
|
4003
4212
|
});
|
|
4004
4213
|
const projectId = encodeProjectId(claudeProjectFilePath);
|
|
4005
4214
|
const userConfig = yield* userConfigService.getUserConfig();
|
|
4215
|
+
const claudeMdPath = path.join(projectPath, "CLAUDE.md");
|
|
4216
|
+
const claudeMdExists = yield* fileSystem.exists(claudeMdPath);
|
|
4006
4217
|
const result = yield* claudeCodeLifeCycleService.startTask({
|
|
4007
4218
|
baseSession: {
|
|
4008
4219
|
cwd: projectPath,
|
|
@@ -4011,7 +4222,7 @@ var LayerImpl20 = Effect29.gen(function* () {
|
|
|
4011
4222
|
},
|
|
4012
4223
|
userConfig,
|
|
4013
4224
|
input: {
|
|
4014
|
-
text: "/init"
|
|
4225
|
+
text: claudeMdExists ? "describe this project" : "/init"
|
|
4015
4226
|
}
|
|
4016
4227
|
});
|
|
4017
4228
|
const { sessionId } = yield* result.yieldSessionFileCreated();
|
|
@@ -4038,43 +4249,43 @@ var ProjectController = class extends Context25.Tag("ProjectController")() {
|
|
|
4038
4249
|
|
|
4039
4250
|
// src/server/core/scheduler/config.ts
|
|
4040
4251
|
import { homedir as homedir4 } from "node:os";
|
|
4041
|
-
import { FileSystem as
|
|
4252
|
+
import { FileSystem as FileSystem9, Path as Path12 } from "@effect/platform";
|
|
4042
4253
|
import { Context as Context26, Data as Data5, Effect as Effect30, Layer as Layer27 } from "effect";
|
|
4043
4254
|
|
|
4044
4255
|
// src/server/core/scheduler/schema.ts
|
|
4045
|
-
import { z as
|
|
4046
|
-
var concurrencyPolicySchema =
|
|
4047
|
-
var cronScheduleSchema =
|
|
4048
|
-
type:
|
|
4049
|
-
expression:
|
|
4256
|
+
import { z as z23 } from "zod";
|
|
4257
|
+
var concurrencyPolicySchema = z23.enum(["skip", "run"]);
|
|
4258
|
+
var cronScheduleSchema = z23.object({
|
|
4259
|
+
type: z23.literal("cron"),
|
|
4260
|
+
expression: z23.string(),
|
|
4050
4261
|
concurrencyPolicy: concurrencyPolicySchema
|
|
4051
4262
|
});
|
|
4052
|
-
var reservedScheduleSchema =
|
|
4053
|
-
type:
|
|
4054
|
-
reservedExecutionTime:
|
|
4263
|
+
var reservedScheduleSchema = z23.object({
|
|
4264
|
+
type: z23.literal("reserved"),
|
|
4265
|
+
reservedExecutionTime: z23.iso.datetime()
|
|
4055
4266
|
});
|
|
4056
|
-
var scheduleSchema =
|
|
4267
|
+
var scheduleSchema = z23.discriminatedUnion("type", [
|
|
4057
4268
|
cronScheduleSchema,
|
|
4058
4269
|
reservedScheduleSchema
|
|
4059
4270
|
]);
|
|
4060
|
-
var messageConfigSchema =
|
|
4061
|
-
content:
|
|
4062
|
-
projectId:
|
|
4063
|
-
baseSessionId:
|
|
4271
|
+
var messageConfigSchema = z23.object({
|
|
4272
|
+
content: z23.string(),
|
|
4273
|
+
projectId: z23.string(),
|
|
4274
|
+
baseSessionId: z23.string().nullable()
|
|
4064
4275
|
});
|
|
4065
|
-
var jobStatusSchema =
|
|
4066
|
-
var schedulerJobSchema =
|
|
4067
|
-
id:
|
|
4068
|
-
name:
|
|
4276
|
+
var jobStatusSchema = z23.enum(["success", "failed"]);
|
|
4277
|
+
var schedulerJobSchema = z23.object({
|
|
4278
|
+
id: z23.string(),
|
|
4279
|
+
name: z23.string(),
|
|
4069
4280
|
schedule: scheduleSchema,
|
|
4070
4281
|
message: messageConfigSchema,
|
|
4071
|
-
enabled:
|
|
4072
|
-
createdAt:
|
|
4073
|
-
lastRunAt:
|
|
4282
|
+
enabled: z23.boolean(),
|
|
4283
|
+
createdAt: z23.string().datetime(),
|
|
4284
|
+
lastRunAt: z23.string().datetime().nullable(),
|
|
4074
4285
|
lastRunStatus: jobStatusSchema.nullable()
|
|
4075
4286
|
});
|
|
4076
|
-
var schedulerConfigSchema =
|
|
4077
|
-
jobs:
|
|
4287
|
+
var schedulerConfigSchema = z23.object({
|
|
4288
|
+
jobs: z23.array(schedulerJobSchema)
|
|
4078
4289
|
});
|
|
4079
4290
|
var newSchedulerJobSchema = schedulerJobSchema.omit({
|
|
4080
4291
|
id: true,
|
|
@@ -4082,7 +4293,7 @@ var newSchedulerJobSchema = schedulerJobSchema.omit({
|
|
|
4082
4293
|
lastRunAt: true,
|
|
4083
4294
|
lastRunStatus: true
|
|
4084
4295
|
}).extend({
|
|
4085
|
-
enabled:
|
|
4296
|
+
enabled: z23.boolean().default(true)
|
|
4086
4297
|
});
|
|
4087
4298
|
var updateSchedulerJobSchema = schedulerJobSchema.partial().pick({
|
|
4088
4299
|
name: true,
|
|
@@ -4108,12 +4319,12 @@ var SchedulerConfigBaseDir = class extends Context26.Tag(
|
|
|
4108
4319
|
}
|
|
4109
4320
|
};
|
|
4110
4321
|
var getConfigPath = Effect30.gen(function* () {
|
|
4111
|
-
const path = yield*
|
|
4322
|
+
const path = yield* Path12.Path;
|
|
4112
4323
|
const baseDir = yield* SchedulerConfigBaseDir;
|
|
4113
4324
|
return path.join(baseDir, CONFIG_DIR, CONFIG_FILE);
|
|
4114
4325
|
});
|
|
4115
4326
|
var readConfig = Effect30.gen(function* () {
|
|
4116
|
-
const fs = yield*
|
|
4327
|
+
const fs = yield* FileSystem9.FileSystem;
|
|
4117
4328
|
const configPath = yield* getConfigPath;
|
|
4118
4329
|
const exists = yield* fs.exists(configPath);
|
|
4119
4330
|
if (!exists) {
|
|
@@ -4141,8 +4352,8 @@ var readConfig = Effect30.gen(function* () {
|
|
|
4141
4352
|
return parsed.data;
|
|
4142
4353
|
});
|
|
4143
4354
|
var writeConfig = (config) => Effect30.gen(function* () {
|
|
4144
|
-
const fs = yield*
|
|
4145
|
-
const path = yield*
|
|
4355
|
+
const fs = yield* FileSystem9.FileSystem;
|
|
4356
|
+
const path = yield* Path12.Path;
|
|
4146
4357
|
const configPath = yield* getConfigPath;
|
|
4147
4358
|
const configDir = path.dirname(configPath);
|
|
4148
4359
|
yield* fs.makeDirectory(configDir, { recursive: true });
|
|
@@ -4660,12 +4871,12 @@ import { Effect as Effect37, Runtime as Runtime3 } from "effect";
|
|
|
4660
4871
|
import { setCookie as setCookie2 } from "hono/cookie";
|
|
4661
4872
|
import { streamSSE } from "hono/streaming";
|
|
4662
4873
|
import prexit from "prexit";
|
|
4663
|
-
import { z as
|
|
4874
|
+
import { z as z28 } from "zod";
|
|
4664
4875
|
|
|
4665
4876
|
// package.json
|
|
4666
4877
|
var package_default = {
|
|
4667
4878
|
name: "@kimuson/claude-code-viewer",
|
|
4668
|
-
version: "0.4.2
|
|
4879
|
+
version: "0.4.2",
|
|
4669
4880
|
type: "module",
|
|
4670
4881
|
license: "MIT",
|
|
4671
4882
|
repository: {
|
|
@@ -4702,10 +4913,11 @@ var package_default = {
|
|
|
4702
4913
|
e2e: "./scripts/e2e/exec_e2e.sh",
|
|
4703
4914
|
"e2e:start-server": "./scripts/e2e/start_server.sh",
|
|
4704
4915
|
"e2e:capture-snapshots": "./scripts/e2e/capture_snapshots.sh",
|
|
4916
|
+
"lingui:extract": "lingui extract --clean",
|
|
4705
4917
|
"lingui:compile": "lingui compile --typescript"
|
|
4706
4918
|
},
|
|
4707
4919
|
dependencies: {
|
|
4708
|
-
"@anthropic-ai/claude-agent-sdk": "0.1.
|
|
4920
|
+
"@anthropic-ai/claude-agent-sdk": "0.1.30",
|
|
4709
4921
|
"@anthropic-ai/claude-code": "2.0.24",
|
|
4710
4922
|
"@anthropic-ai/sdk": "0.67.0",
|
|
4711
4923
|
"@effect/platform": "0.92.1",
|
|
@@ -4719,6 +4931,7 @@ var package_default = {
|
|
|
4719
4931
|
"@radix-ui/react-collapsible": "1.1.12",
|
|
4720
4932
|
"@radix-ui/react-dialog": "1.1.15",
|
|
4721
4933
|
"@radix-ui/react-hover-card": "1.1.15",
|
|
4934
|
+
"@radix-ui/react-popover": "^1.1.15",
|
|
4722
4935
|
"@radix-ui/react-select": "2.2.6",
|
|
4723
4936
|
"@radix-ui/react-slot": "1.2.3",
|
|
4724
4937
|
"@radix-ui/react-tabs": "1.1.13",
|
|
@@ -4741,6 +4954,7 @@ var package_default = {
|
|
|
4741
4954
|
react: "19.2.0",
|
|
4742
4955
|
"react-dom": "19.2.0",
|
|
4743
4956
|
"react-error-boundary": "6.0.0",
|
|
4957
|
+
"react-helmet-async": "^2.0.5",
|
|
4744
4958
|
"react-markdown": "10.1.0",
|
|
4745
4959
|
"react-syntax-highlighter": "15.6.6",
|
|
4746
4960
|
"remark-gfm": "4.0.1",
|
|
@@ -4781,49 +4995,62 @@ var package_default = {
|
|
|
4781
4995
|
};
|
|
4782
4996
|
|
|
4783
4997
|
// src/server/core/claude-code/schema.ts
|
|
4784
|
-
import { z as
|
|
4785
|
-
var
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4998
|
+
import { z as z24 } from "zod";
|
|
4999
|
+
var mediaTypeSchema = z24.enum([
|
|
5000
|
+
"image/png",
|
|
5001
|
+
"image/jpeg",
|
|
5002
|
+
"image/gif",
|
|
5003
|
+
"image/webp"
|
|
5004
|
+
]);
|
|
5005
|
+
var imageBlockSchema = z24.object({
|
|
5006
|
+
type: z24.literal("image"),
|
|
5007
|
+
source: z24.object({
|
|
5008
|
+
type: z24.literal("base64"),
|
|
5009
|
+
media_type: mediaTypeSchema,
|
|
5010
|
+
data: z24.string()
|
|
4791
5011
|
})
|
|
4792
5012
|
});
|
|
4793
|
-
var documentBlockSchema =
|
|
4794
|
-
type:
|
|
4795
|
-
source:
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
5013
|
+
var documentBlockSchema = z24.object({
|
|
5014
|
+
type: z24.literal("document"),
|
|
5015
|
+
source: z24.union([
|
|
5016
|
+
z24.object({
|
|
5017
|
+
type: z24.literal("text"),
|
|
5018
|
+
media_type: z24.enum(["text/plain"]),
|
|
5019
|
+
data: z24.string()
|
|
5020
|
+
}),
|
|
5021
|
+
z24.object({
|
|
5022
|
+
type: z24.literal("base64"),
|
|
5023
|
+
media_type: z24.enum(["application/pdf"]),
|
|
5024
|
+
data: z24.string()
|
|
5025
|
+
})
|
|
5026
|
+
])
|
|
4800
5027
|
});
|
|
4801
|
-
var userMessageInputSchema =
|
|
4802
|
-
text:
|
|
4803
|
-
images:
|
|
4804
|
-
documents:
|
|
5028
|
+
var userMessageInputSchema = z24.object({
|
|
5029
|
+
text: z24.string().min(1),
|
|
5030
|
+
images: z24.array(imageBlockSchema).optional(),
|
|
5031
|
+
documents: z24.array(documentBlockSchema).optional()
|
|
4805
5032
|
});
|
|
4806
5033
|
|
|
4807
5034
|
// src/server/core/git/schema.ts
|
|
4808
|
-
import { z as
|
|
4809
|
-
var CommitRequestSchema =
|
|
4810
|
-
projectId:
|
|
4811
|
-
files:
|
|
4812
|
-
message:
|
|
5035
|
+
import { z as z25 } from "zod";
|
|
5036
|
+
var CommitRequestSchema = z25.object({
|
|
5037
|
+
projectId: z25.string().min(1),
|
|
5038
|
+
files: z25.array(z25.string().min(1)).min(1),
|
|
5039
|
+
message: z25.string().trim().min(1)
|
|
4813
5040
|
});
|
|
4814
|
-
var PushRequestSchema =
|
|
4815
|
-
projectId:
|
|
5041
|
+
var PushRequestSchema = z25.object({
|
|
5042
|
+
projectId: z25.string().min(1)
|
|
4816
5043
|
});
|
|
4817
|
-
var CommitResultSuccessSchema =
|
|
4818
|
-
success:
|
|
4819
|
-
commitSha:
|
|
4820
|
-
filesCommitted:
|
|
4821
|
-
message:
|
|
5044
|
+
var CommitResultSuccessSchema = z25.object({
|
|
5045
|
+
success: z25.literal(true),
|
|
5046
|
+
commitSha: z25.string().length(40),
|
|
5047
|
+
filesCommitted: z25.number().int().positive(),
|
|
5048
|
+
message: z25.string()
|
|
4822
5049
|
});
|
|
4823
|
-
var CommitResultErrorSchema =
|
|
4824
|
-
success:
|
|
4825
|
-
error:
|
|
4826
|
-
errorCode:
|
|
5050
|
+
var CommitResultErrorSchema = z25.object({
|
|
5051
|
+
success: z25.literal(false),
|
|
5052
|
+
error: z25.string(),
|
|
5053
|
+
errorCode: z25.enum([
|
|
4827
5054
|
"EMPTY_MESSAGE",
|
|
4828
5055
|
"NO_FILES",
|
|
4829
5056
|
"PROJECT_NOT_FOUND",
|
|
@@ -4831,22 +5058,22 @@ var CommitResultErrorSchema = z24.object({
|
|
|
4831
5058
|
"HOOK_FAILED",
|
|
4832
5059
|
"GIT_COMMAND_ERROR"
|
|
4833
5060
|
]),
|
|
4834
|
-
details:
|
|
5061
|
+
details: z25.string().optional()
|
|
4835
5062
|
});
|
|
4836
|
-
var CommitResultSchema =
|
|
5063
|
+
var CommitResultSchema = z25.discriminatedUnion("success", [
|
|
4837
5064
|
CommitResultSuccessSchema,
|
|
4838
5065
|
CommitResultErrorSchema
|
|
4839
5066
|
]);
|
|
4840
|
-
var PushResultSuccessSchema =
|
|
4841
|
-
success:
|
|
4842
|
-
remote:
|
|
4843
|
-
branch:
|
|
4844
|
-
objectsPushed:
|
|
5067
|
+
var PushResultSuccessSchema = z25.object({
|
|
5068
|
+
success: z25.literal(true),
|
|
5069
|
+
remote: z25.string(),
|
|
5070
|
+
branch: z25.string(),
|
|
5071
|
+
objectsPushed: z25.number().int().optional()
|
|
4845
5072
|
});
|
|
4846
|
-
var PushResultErrorSchema =
|
|
4847
|
-
success:
|
|
4848
|
-
error:
|
|
4849
|
-
errorCode:
|
|
5073
|
+
var PushResultErrorSchema = z25.object({
|
|
5074
|
+
success: z25.literal(false),
|
|
5075
|
+
error: z25.string(),
|
|
5076
|
+
errorCode: z25.enum([
|
|
4850
5077
|
"PROJECT_NOT_FOUND",
|
|
4851
5078
|
"NOT_A_REPOSITORY",
|
|
4852
5079
|
"NO_UPSTREAM",
|
|
@@ -4856,26 +5083,26 @@ var PushResultErrorSchema = z24.object({
|
|
|
4856
5083
|
"TIMEOUT",
|
|
4857
5084
|
"GIT_COMMAND_ERROR"
|
|
4858
5085
|
]),
|
|
4859
|
-
details:
|
|
5086
|
+
details: z25.string().optional()
|
|
4860
5087
|
});
|
|
4861
|
-
var PushResultSchema =
|
|
5088
|
+
var PushResultSchema = z25.discriminatedUnion("success", [
|
|
4862
5089
|
PushResultSuccessSchema,
|
|
4863
5090
|
PushResultErrorSchema
|
|
4864
5091
|
]);
|
|
4865
|
-
var CommitAndPushResultSuccessSchema =
|
|
4866
|
-
success:
|
|
4867
|
-
commitSha:
|
|
4868
|
-
filesCommitted:
|
|
4869
|
-
message:
|
|
4870
|
-
remote:
|
|
4871
|
-
branch:
|
|
5092
|
+
var CommitAndPushResultSuccessSchema = z25.object({
|
|
5093
|
+
success: z25.literal(true),
|
|
5094
|
+
commitSha: z25.string().length(40),
|
|
5095
|
+
filesCommitted: z25.number().int().positive(),
|
|
5096
|
+
message: z25.string(),
|
|
5097
|
+
remote: z25.string(),
|
|
5098
|
+
branch: z25.string()
|
|
4872
5099
|
});
|
|
4873
|
-
var CommitAndPushResultErrorSchema =
|
|
4874
|
-
success:
|
|
4875
|
-
commitSucceeded:
|
|
4876
|
-
commitSha:
|
|
4877
|
-
error:
|
|
4878
|
-
errorCode:
|
|
5100
|
+
var CommitAndPushResultErrorSchema = z25.object({
|
|
5101
|
+
success: z25.literal(false),
|
|
5102
|
+
commitSucceeded: z25.boolean(),
|
|
5103
|
+
commitSha: z25.string().length(40).optional(),
|
|
5104
|
+
error: z25.string(),
|
|
5105
|
+
errorCode: z25.enum([
|
|
4879
5106
|
"EMPTY_MESSAGE",
|
|
4880
5107
|
"NO_FILES",
|
|
4881
5108
|
"PROJECT_NOT_FOUND",
|
|
@@ -4888,28 +5115,28 @@ var CommitAndPushResultErrorSchema = z24.object({
|
|
|
4888
5115
|
"NETWORK_ERROR",
|
|
4889
5116
|
"TIMEOUT"
|
|
4890
5117
|
]),
|
|
4891
|
-
details:
|
|
5118
|
+
details: z25.string().optional()
|
|
4892
5119
|
});
|
|
4893
|
-
var CommitAndPushResultSchema =
|
|
5120
|
+
var CommitAndPushResultSchema = z25.discriminatedUnion("success", [
|
|
4894
5121
|
CommitAndPushResultSuccessSchema,
|
|
4895
5122
|
CommitAndPushResultErrorSchema
|
|
4896
5123
|
]);
|
|
4897
5124
|
|
|
4898
5125
|
// src/server/lib/config/config.ts
|
|
4899
|
-
import
|
|
5126
|
+
import z27 from "zod";
|
|
4900
5127
|
|
|
4901
5128
|
// src/lib/i18n/schema.ts
|
|
4902
|
-
import
|
|
4903
|
-
var localeSchema =
|
|
5129
|
+
import z26 from "zod";
|
|
5130
|
+
var localeSchema = z26.enum(["ja", "en"]);
|
|
4904
5131
|
|
|
4905
5132
|
// src/server/lib/config/config.ts
|
|
4906
|
-
var userConfigSchema =
|
|
4907
|
-
hideNoUserMessageSession:
|
|
4908
|
-
unifySameTitleSession:
|
|
4909
|
-
enterKeyBehavior:
|
|
4910
|
-
permissionMode:
|
|
5133
|
+
var userConfigSchema = z27.object({
|
|
5134
|
+
hideNoUserMessageSession: z27.boolean().optional().default(true),
|
|
5135
|
+
unifySameTitleSession: z27.boolean().optional().default(false),
|
|
5136
|
+
enterKeyBehavior: z27.enum(["shift-enter-send", "enter-send", "command-enter-send"]).optional().default("shift-enter-send"),
|
|
5137
|
+
permissionMode: z27.enum(["acceptEdits", "bypassPermissions", "default", "plan"]).optional().default("default"),
|
|
4911
5138
|
locale: localeSchema.optional().default("en"),
|
|
4912
|
-
theme:
|
|
5139
|
+
theme: z27.enum(["light", "dark", "system"]).optional().default("system")
|
|
4913
5140
|
});
|
|
4914
5141
|
|
|
4915
5142
|
// src/server/lib/effect/toEffectResponse.ts
|
|
@@ -5012,7 +5239,7 @@ var routes = (app) => Effect37.gen(function* () {
|
|
|
5012
5239
|
return response;
|
|
5013
5240
|
}).get(
|
|
5014
5241
|
"/api/projects/:projectId",
|
|
5015
|
-
zValidator("query",
|
|
5242
|
+
zValidator("query", z28.object({ cursor: z28.string().optional() })),
|
|
5016
5243
|
async (c) => {
|
|
5017
5244
|
const response = await effectToResponse(
|
|
5018
5245
|
c,
|
|
@@ -5027,8 +5254,8 @@ var routes = (app) => Effect37.gen(function* () {
|
|
|
5027
5254
|
"/api/projects",
|
|
5028
5255
|
zValidator(
|
|
5029
5256
|
"json",
|
|
5030
|
-
|
|
5031
|
-
projectPath:
|
|
5257
|
+
z28.object({
|
|
5258
|
+
projectPath: z28.string().min(1, "Project path is required")
|
|
5032
5259
|
})
|
|
5033
5260
|
),
|
|
5034
5261
|
async (c) => {
|
|
@@ -5054,18 +5281,10 @@ var routes = (app) => Effect37.gen(function* () {
|
|
|
5054
5281
|
sessionController.getSession({ ...c.req.param() }).pipe(Effect37.provide(runtime))
|
|
5055
5282
|
);
|
|
5056
5283
|
return response;
|
|
5057
|
-
}).get("/api/projects/:projectId/git/
|
|
5058
|
-
const response = await effectToResponse(
|
|
5059
|
-
c,
|
|
5060
|
-
gitController.getGitBranches({
|
|
5061
|
-
...c.req.param()
|
|
5062
|
-
}).pipe(Effect37.provide(runtime))
|
|
5063
|
-
);
|
|
5064
|
-
return response;
|
|
5065
|
-
}).get("/api/projects/:projectId/git/commits", async (c) => {
|
|
5284
|
+
}).get("/api/projects/:projectId/git/current-revisions", async (c) => {
|
|
5066
5285
|
const response = await effectToResponse(
|
|
5067
5286
|
c,
|
|
5068
|
-
gitController.
|
|
5287
|
+
gitController.getCurrentRevisions({
|
|
5069
5288
|
...c.req.param()
|
|
5070
5289
|
}).pipe(Effect37.provide(runtime))
|
|
5071
5290
|
);
|
|
@@ -5074,9 +5293,9 @@ var routes = (app) => Effect37.gen(function* () {
|
|
|
5074
5293
|
"/api/projects/:projectId/git/diff",
|
|
5075
5294
|
zValidator(
|
|
5076
5295
|
"json",
|
|
5077
|
-
|
|
5078
|
-
fromRef:
|
|
5079
|
-
toRef:
|
|
5296
|
+
z28.object({
|
|
5297
|
+
fromRef: z28.string().min(1, "fromRef is required"),
|
|
5298
|
+
toRef: z28.string().min(1, "toRef is required")
|
|
5080
5299
|
})
|
|
5081
5300
|
),
|
|
5082
5301
|
async (c) => {
|
|
@@ -5166,10 +5385,10 @@ var routes = (app) => Effect37.gen(function* () {
|
|
|
5166
5385
|
"/api/cc/session-processes",
|
|
5167
5386
|
zValidator(
|
|
5168
5387
|
"json",
|
|
5169
|
-
|
|
5170
|
-
projectId:
|
|
5388
|
+
z28.object({
|
|
5389
|
+
projectId: z28.string(),
|
|
5171
5390
|
input: userMessageInputSchema,
|
|
5172
|
-
baseSessionId:
|
|
5391
|
+
baseSessionId: z28.string().optional()
|
|
5173
5392
|
})
|
|
5174
5393
|
),
|
|
5175
5394
|
async (c) => {
|
|
@@ -5185,10 +5404,10 @@ var routes = (app) => Effect37.gen(function* () {
|
|
|
5185
5404
|
"/api/cc/session-processes/:sessionProcessId/continue",
|
|
5186
5405
|
zValidator(
|
|
5187
5406
|
"json",
|
|
5188
|
-
|
|
5189
|
-
projectId:
|
|
5407
|
+
z28.object({
|
|
5408
|
+
projectId: z28.string(),
|
|
5190
5409
|
input: userMessageInputSchema,
|
|
5191
|
-
baseSessionId:
|
|
5410
|
+
baseSessionId: z28.string()
|
|
5192
5411
|
})
|
|
5193
5412
|
),
|
|
5194
5413
|
async (c) => {
|
|
@@ -5203,7 +5422,7 @@ var routes = (app) => Effect37.gen(function* () {
|
|
|
5203
5422
|
}
|
|
5204
5423
|
).post(
|
|
5205
5424
|
"/api/cc/session-processes/:sessionProcessId/abort",
|
|
5206
|
-
zValidator("json",
|
|
5425
|
+
zValidator("json", z28.object({ projectId: z28.string() })),
|
|
5207
5426
|
async (c) => {
|
|
5208
5427
|
const { sessionProcessId } = c.req.param();
|
|
5209
5428
|
void Effect37.runFork(
|
|
@@ -5215,9 +5434,9 @@ var routes = (app) => Effect37.gen(function* () {
|
|
|
5215
5434
|
"/api/cc/permission-response",
|
|
5216
5435
|
zValidator(
|
|
5217
5436
|
"json",
|
|
5218
|
-
|
|
5219
|
-
permissionRequestId:
|
|
5220
|
-
decision:
|
|
5437
|
+
z28.object({
|
|
5438
|
+
permissionRequestId: z28.string(),
|
|
5439
|
+
decision: z28.enum(["allow", "deny"])
|
|
5221
5440
|
})
|
|
5222
5441
|
),
|
|
5223
5442
|
async (c) => {
|
|
@@ -5284,9 +5503,9 @@ var routes = (app) => Effect37.gen(function* () {
|
|
|
5284
5503
|
"/api/fs/file-completion",
|
|
5285
5504
|
zValidator(
|
|
5286
5505
|
"query",
|
|
5287
|
-
|
|
5288
|
-
projectId:
|
|
5289
|
-
basePath:
|
|
5506
|
+
z28.object({
|
|
5507
|
+
projectId: z28.string(),
|
|
5508
|
+
basePath: z28.string().optional().default("/api/")
|
|
5290
5509
|
})
|
|
5291
5510
|
),
|
|
5292
5511
|
async (c) => {
|
|
@@ -5302,8 +5521,9 @@ var routes = (app) => Effect37.gen(function* () {
|
|
|
5302
5521
|
"/api/fs/directory-browser",
|
|
5303
5522
|
zValidator(
|
|
5304
5523
|
"query",
|
|
5305
|
-
|
|
5306
|
-
currentPath:
|
|
5524
|
+
z28.object({
|
|
5525
|
+
currentPath: z28.string().optional(),
|
|
5526
|
+
showHidden: z28.string().optional().transform((val) => val === "true")
|
|
5307
5527
|
})
|
|
5308
5528
|
),
|
|
5309
5529
|
async (c) => {
|