freestyle-sync 0.1.2 → 0.1.4
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 +2 -1
- package/{freestyle-sync.config.ts → dist/freestyle-sync.config.js} +2 -3
- package/dist/main.js +1319 -0
- package/{plugins/agent-claude/src/index.ts → dist/plugins/agent-claude/src/index.js} +32 -29
- package/{plugins/agent-codex/src/index.ts → dist/plugins/agent-codex/src/index.js} +13 -14
- package/{plugins/agent-copilot/src/index.ts → dist/plugins/agent-copilot/src/index.js} +151 -164
- package/{plugins/auth-aws/src/index.ts → dist/plugins/auth-aws/src/index.js} +14 -8
- package/{plugins/auth-azure/src/index.ts → dist/plugins/auth-azure/src/index.js} +14 -8
- package/dist/plugins/auth-context.js +213 -0
- package/{plugins/auth-docker/src/index.ts → dist/plugins/auth-docker/src/index.js} +14 -8
- package/{plugins/auth-env/src/index.ts → dist/plugins/auth-env/src/index.js} +11 -11
- package/{plugins/auth-gcloud/src/index.ts → dist/plugins/auth-gcloud/src/index.js} +14 -8
- package/{plugins/auth-git/src/index.ts → dist/plugins/auth-git/src/index.js} +24 -17
- package/{plugins/auth-github-cli/src/index.ts → dist/plugins/auth-github-cli/src/index.js} +20 -14
- package/{plugins/auth-npm/src/index.ts → dist/plugins/auth-npm/src/index.js} +19 -13
- package/{plugins/auth-ssh/src/index.ts → dist/plugins/auth-ssh/src/index.js} +19 -13
- package/dist/plugins/auth-yarn/src/index.js +24 -0
- package/{plugins/node-npm/src/index.ts → dist/plugins/node-npm/src/index.js} +6 -8
- package/dist/plugins/npm-native-deps.js +307 -0
- package/{plugins/shell-history/src/index.ts → dist/plugins/shell-history/src/index.js} +13 -12
- package/{plugins/vscode/src/index.ts → dist/plugins/vscode/src/index.js} +38 -40
- package/{src/main.ts → dist/src/main.js} +406 -463
- package/dist/src/plugin-api.js +6 -0
- package/dist/src/pushvm.config.js +36 -0
- package/package.json +8 -4
- package/PUBLISHING.md +0 -3
- package/plugins/agent-claude/package.json +0 -8
- package/plugins/agent-codex/package.json +0 -8
- package/plugins/agent-copilot/package.json +0 -8
- package/plugins/auth-aws/package.json +0 -8
- package/plugins/auth-azure/package.json +0 -8
- package/plugins/auth-docker/package.json +0 -8
- package/plugins/auth-env/package.json +0 -8
- package/plugins/auth-gcloud/package.json +0 -8
- package/plugins/auth-git/package.json +0 -8
- package/plugins/auth-github-cli/package.json +0 -8
- package/plugins/auth-npm/package.json +0 -8
- package/plugins/auth-ssh/package.json +0 -8
- package/plugins/auth-yarn/package.json +0 -8
- package/plugins/auth-yarn/src/index.ts +0 -19
- package/plugins/node-npm/package.json +0 -8
- package/plugins/shell-history/package.json +0 -8
- package/plugins/vscode/package.json +0 -8
- package/src/plugin-api.ts +0 -107
- package/tsconfig.json +0 -18
|
@@ -2,20 +2,22 @@ import { execFileSync } from "node:child_process";
|
|
|
2
2
|
import { stat } from "node:fs/promises";
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
4
|
import path from "node:path";
|
|
5
|
-
import { definePlugin
|
|
6
|
-
|
|
5
|
+
import { definePlugin } from "../../../src/plugin-api.js";
|
|
7
6
|
export function claudeAgentPlugin() {
|
|
8
7
|
return definePlugin({
|
|
9
8
|
name: "@freestyle-sync/agent-claude",
|
|
10
9
|
collectEnvironment({ options }) {
|
|
11
|
-
if (!options.includeAgentContext)
|
|
10
|
+
if (!options.includeAgentContext)
|
|
11
|
+
return {};
|
|
12
12
|
const apiKey = process.env.ANTHROPIC_API_KEY || claudeApiKeyFromMacKeychain();
|
|
13
|
-
const env
|
|
14
|
-
if (apiKey)
|
|
13
|
+
const env = {};
|
|
14
|
+
if (apiKey)
|
|
15
|
+
env.ANTHROPIC_API_KEY = apiKey;
|
|
15
16
|
return env;
|
|
16
17
|
},
|
|
17
18
|
async discoverContextCandidates({ options }) {
|
|
18
|
-
if (!options.includeAgentContext)
|
|
19
|
+
if (!options.includeAgentContext)
|
|
20
|
+
return [];
|
|
19
21
|
return existing([
|
|
20
22
|
candidate(path.join(homedir(), ".claude"), "~/.claude", "Claude context", "context:claude"),
|
|
21
23
|
candidate(path.join(homedir(), ".claude.json"), "~/.claude.json", "Claude config", "context:claude-json"),
|
|
@@ -26,26 +28,21 @@ export function claudeAgentPlugin() {
|
|
|
26
28
|
},
|
|
27
29
|
});
|
|
28
30
|
}
|
|
29
|
-
|
|
30
31
|
function claudeApiKeyFromMacKeychain() {
|
|
31
|
-
if (process.platform !== "darwin")
|
|
32
|
+
if (process.platform !== "darwin")
|
|
33
|
+
return undefined;
|
|
32
34
|
try {
|
|
33
35
|
const key = execFileSync("security", ["find-generic-password", "-s", "Claude Code", "-a", process.env.USER ?? "", "-w"], {
|
|
34
36
|
encoding: "utf8",
|
|
35
37
|
stdio: ["ignore", "pipe", "ignore"],
|
|
36
38
|
}).trim();
|
|
37
39
|
return key.startsWith("sk-ant-") ? key : undefined;
|
|
38
|
-
}
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
39
42
|
return undefined;
|
|
40
43
|
}
|
|
41
44
|
}
|
|
42
|
-
|
|
43
|
-
async function installAgentCli(
|
|
44
|
-
vm: RemoteVm,
|
|
45
|
-
checkedExec: PushvmPluginUtils["checkedExec"],
|
|
46
|
-
binary: string,
|
|
47
|
-
packageName: string,
|
|
48
|
-
) {
|
|
45
|
+
async function installAgentCli(vm, checkedExec, binary, packageName) {
|
|
49
46
|
await checkedExec(vm, `
|
|
50
47
|
set -e
|
|
51
48
|
export HOME="\${HOME:-/root}"
|
|
@@ -91,23 +88,29 @@ test -x /usr/local/bin/${binary}
|
|
|
91
88
|
test -x /root/.local/bin/${binary}
|
|
92
89
|
`, 600000);
|
|
93
90
|
}
|
|
94
|
-
|
|
95
|
-
function candidate(source: string, remoteRoot: string, label: string, preferenceKey: string): ContextCandidate {
|
|
91
|
+
function candidate(source, remoteRoot, label, preferenceKey) {
|
|
96
92
|
return { source, remoteRoot: expandRemoteHome(remoteRoot), label, sensitive: true, preferenceKey, promptLabel: label };
|
|
97
93
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
const
|
|
101
|
-
|
|
94
|
+
async function existing(candidates) {
|
|
95
|
+
const result = [];
|
|
96
|
+
for (const item of candidates)
|
|
97
|
+
if (await exists(item.source))
|
|
98
|
+
result.push(item);
|
|
102
99
|
return result;
|
|
103
100
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
if (value.startsWith("~/"))
|
|
101
|
+
function expandRemoteHome(value) {
|
|
102
|
+
if (value === "~")
|
|
103
|
+
return "/root";
|
|
104
|
+
if (value.startsWith("~/"))
|
|
105
|
+
return `/root/${value.slice(2)}`;
|
|
108
106
|
return value;
|
|
109
107
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
108
|
+
async function exists(filePath) {
|
|
109
|
+
try {
|
|
110
|
+
await stat(filePath);
|
|
111
|
+
return true;
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
113
116
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { stat } from "node:fs/promises";
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import { definePlugin
|
|
5
|
-
|
|
4
|
+
import { definePlugin } from "../../../src/plugin-api.js";
|
|
6
5
|
export function codexAgentPlugin() {
|
|
7
6
|
return definePlugin({
|
|
8
7
|
name: "@freestyle-sync/agent-codex",
|
|
9
8
|
async discoverContextCandidates({ options }) {
|
|
10
|
-
if (!options.includeAgentContext)
|
|
11
|
-
|
|
9
|
+
if (!options.includeAgentContext)
|
|
10
|
+
return [];
|
|
11
|
+
const item = { source: path.join(homedir(), ".codex"), remoteRoot: "/root/.codex", label: "Codex context", sensitive: true, preferenceKey: "context:codex", promptLabel: "Codex context" };
|
|
12
12
|
return await exists(item.source) ? [item] : [];
|
|
13
13
|
},
|
|
14
14
|
async afterProjectSync({ vm, utils }) {
|
|
@@ -16,13 +16,7 @@ export function codexAgentPlugin() {
|
|
|
16
16
|
},
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
async function installAgentCli(
|
|
21
|
-
vm: RemoteVm,
|
|
22
|
-
checkedExec: PushvmPluginUtils["checkedExec"],
|
|
23
|
-
binary: string,
|
|
24
|
-
packageName: string,
|
|
25
|
-
) {
|
|
19
|
+
async function installAgentCli(vm, checkedExec, binary, packageName) {
|
|
26
20
|
await checkedExec(vm, `
|
|
27
21
|
set -e
|
|
28
22
|
export HOME="\${HOME:-/root}"
|
|
@@ -63,7 +57,12 @@ fi
|
|
|
63
57
|
test -x /usr/local/bin/${binary}
|
|
64
58
|
`, 600000);
|
|
65
59
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
60
|
+
async function exists(filePath) {
|
|
61
|
+
try {
|
|
62
|
+
await stat(filePath);
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
69
68
|
}
|