codex-relay 1.0.0 → 1.0.1
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/src.js +3 -2
- package/dist/src2.js +16 -10
- package/package.json +2 -2
package/dist/src.js
CHANGED
|
@@ -181,8 +181,9 @@ const WorkspaceChangesResponseSchema = z.object({
|
|
|
181
181
|
worktreeStatus: z.string().nullable()
|
|
182
182
|
})).default([])
|
|
183
183
|
});
|
|
184
|
-
const
|
|
185
|
-
const
|
|
184
|
+
const WorkspaceSelectionRequestSchema = z.object({ workspacePath: z.string().trim().min(1).optional() });
|
|
185
|
+
const CheckoutWorkspaceBranchRequestSchema = WorkspaceSelectionRequestSchema.extend({ branch: z.string().trim().min(1).refine((branch) => !branch.startsWith("-"), "Branch name cannot start with '-'.") });
|
|
186
|
+
const CommitPushWorkspaceRequestSchema = WorkspaceSelectionRequestSchema.extend({ message: z.string().trim().min(1).max(240) });
|
|
186
187
|
const WorkspaceGitActionResponseSchema = z.object({
|
|
187
188
|
branch: z.string().nullable(),
|
|
188
189
|
message: z.string().min(1),
|
package/dist/src2.js
CHANGED
|
@@ -682,9 +682,11 @@ function createApp(options = {}) {
|
|
|
682
682
|
});
|
|
683
683
|
app.get(apiPaths.workspaceChanges, async (c) => {
|
|
684
684
|
try {
|
|
685
|
-
const
|
|
685
|
+
const selectedWorkspacePath = await validateThreadWorkspacePath(workspacePath, c.req.query("workspacePath"));
|
|
686
|
+
if (!selectedWorkspacePath.success) return secureJson(c, options.pairing, secureSessionsByTokenHash, apiError("invalid_workspace_path", selectedWorkspacePath.error), 400);
|
|
687
|
+
const changes = await readWorkspaceChanges(selectedWorkspacePath.path);
|
|
686
688
|
const response = WorkspaceChangesResponseSchema.parse({
|
|
687
|
-
workspacePath,
|
|
689
|
+
workspacePath: selectedWorkspacePath.path,
|
|
688
690
|
...changes
|
|
689
691
|
});
|
|
690
692
|
return secureJson(c, options.pairing, secureSessionsByTokenHash, response);
|
|
@@ -696,9 +698,11 @@ function createApp(options = {}) {
|
|
|
696
698
|
const parsed = await parseRequestJson(c, options.pairing, secureSessionsByTokenHash, CheckoutWorkspaceBranchRequestSchema);
|
|
697
699
|
if (!parsed.success) return secureJson(c, options.pairing, secureSessionsByTokenHash, validationError(parsed.error), 400);
|
|
698
700
|
try {
|
|
699
|
-
const
|
|
701
|
+
const selectedWorkspacePath = await validateThreadWorkspacePath(workspacePath, parsed.data.workspacePath);
|
|
702
|
+
if (!selectedWorkspacePath.success) return secureJson(c, options.pairing, secureSessionsByTokenHash, apiError("invalid_workspace_path", selectedWorkspacePath.error), 400);
|
|
703
|
+
const output = await git(selectedWorkspacePath.path, ["checkout", parsed.data.branch]);
|
|
700
704
|
const response = WorkspaceGitActionResponseSchema.parse({
|
|
701
|
-
branch: await currentGitBranch(
|
|
705
|
+
branch: await currentGitBranch(selectedWorkspacePath.path),
|
|
702
706
|
message: `Checked out ${parsed.data.branch}.`,
|
|
703
707
|
output
|
|
704
708
|
});
|
|
@@ -711,23 +715,25 @@ function createApp(options = {}) {
|
|
|
711
715
|
const parsed = await parseRequestJson(c, options.pairing, secureSessionsByTokenHash, CommitPushWorkspaceRequestSchema);
|
|
712
716
|
if (!parsed.success) return secureJson(c, options.pairing, secureSessionsByTokenHash, validationError(parsed.error), 400);
|
|
713
717
|
try {
|
|
714
|
-
await
|
|
715
|
-
|
|
718
|
+
const selectedWorkspacePath = await validateThreadWorkspacePath(workspacePath, parsed.data.workspacePath);
|
|
719
|
+
if (!selectedWorkspacePath.success) return secureJson(c, options.pairing, secureSessionsByTokenHash, apiError("invalid_workspace_path", selectedWorkspacePath.error), 400);
|
|
720
|
+
await git(selectedWorkspacePath.path, ["add", "--all"]);
|
|
721
|
+
const commitOutput = await git(selectedWorkspacePath.path, [
|
|
716
722
|
"commit",
|
|
717
723
|
"-m",
|
|
718
724
|
parsed.data.message
|
|
719
725
|
]);
|
|
720
|
-
const branch = await currentGitBranch(
|
|
721
|
-
const pushOutput = await git(
|
|
726
|
+
const branch = await currentGitBranch(selectedWorkspacePath.path);
|
|
727
|
+
const pushOutput = await git(selectedWorkspacePath.path, [
|
|
722
728
|
"rev-parse",
|
|
723
729
|
"--abbrev-ref",
|
|
724
730
|
"@{upstream}"
|
|
725
|
-
]).catch(() => null) ? await git(
|
|
731
|
+
]).catch(() => null) ? await git(selectedWorkspacePath.path, ["push"]) : branch ? await git(selectedWorkspacePath.path, [
|
|
726
732
|
"push",
|
|
727
733
|
"-u",
|
|
728
734
|
"origin",
|
|
729
735
|
branch
|
|
730
|
-
]) : await git(
|
|
736
|
+
]) : await git(selectedWorkspacePath.path, ["push"]);
|
|
731
737
|
const response = WorkspaceGitActionResponseSchema.parse({
|
|
732
738
|
branch,
|
|
733
739
|
message: "Committed and pushed workspace changes.",
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codex-relay",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Local Codex Relay CLI bridge for the Codex Relay mobile app.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
|
-
"url": "git+https://github.com/gronxb/
|
|
7
|
+
"url": "git+https://github.com/gronxb/codex-relay.git",
|
|
8
8
|
"directory": "apps/server"
|
|
9
9
|
},
|
|
10
10
|
"bin": {
|