freestyle-sync 0.1.0

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.
Files changed (39) hide show
  1. package/PUBLISHING.md +3 -0
  2. package/README.md +47 -0
  3. package/freestyle-sync.config.ts +38 -0
  4. package/package.json +28 -0
  5. package/plugins/agent-claude/package.json +8 -0
  6. package/plugins/agent-claude/src/index.ts +113 -0
  7. package/plugins/agent-codex/package.json +8 -0
  8. package/plugins/agent-codex/src/index.ts +69 -0
  9. package/plugins/agent-copilot/package.json +8 -0
  10. package/plugins/agent-copilot/src/index.ts +542 -0
  11. package/plugins/auth-aws/package.json +8 -0
  12. package/plugins/auth-aws/src/index.ts +23 -0
  13. package/plugins/auth-azure/package.json +8 -0
  14. package/plugins/auth-azure/src/index.ts +23 -0
  15. package/plugins/auth-docker/package.json +8 -0
  16. package/plugins/auth-docker/src/index.ts +23 -0
  17. package/plugins/auth-env/package.json +8 -0
  18. package/plugins/auth-env/src/index.ts +35 -0
  19. package/plugins/auth-gcloud/package.json +8 -0
  20. package/plugins/auth-gcloud/src/index.ts +23 -0
  21. package/plugins/auth-git/package.json +8 -0
  22. package/plugins/auth-git/src/index.ts +43 -0
  23. package/plugins/auth-github-cli/package.json +8 -0
  24. package/plugins/auth-github-cli/src/index.ts +33 -0
  25. package/plugins/auth-npm/package.json +8 -0
  26. package/plugins/auth-npm/src/index.ts +32 -0
  27. package/plugins/auth-ssh/package.json +8 -0
  28. package/plugins/auth-ssh/src/index.ts +36 -0
  29. package/plugins/auth-yarn/package.json +8 -0
  30. package/plugins/auth-yarn/src/index.ts +19 -0
  31. package/plugins/node-npm/package.json +8 -0
  32. package/plugins/node-npm/src/index.ts +390 -0
  33. package/plugins/shell-history/package.json +8 -0
  34. package/plugins/shell-history/src/index.ts +64 -0
  35. package/plugins/vscode/package.json +8 -0
  36. package/plugins/vscode/src/index.ts +162 -0
  37. package/src/main.ts +1136 -0
  38. package/src/plugin-api.ts +107 -0
  39. package/tsconfig.json +18 -0
@@ -0,0 +1,107 @@
1
+ export type CliOptions = {
2
+ projectRoot: string;
3
+ cachePath: string;
4
+ remoteProjectDir: string;
5
+ name: string;
6
+ vmId?: string;
7
+ idleTimeoutSeconds?: number;
8
+ yes: boolean;
9
+ dryRun: boolean;
10
+ disablePlugins: string[];
11
+ enablePlugins: string[];
12
+ resetPluginPrefs: boolean;
13
+ listPlugins: boolean;
14
+ includeAuth: boolean;
15
+ includeAgentContext: boolean;
16
+ includeGitDir: boolean;
17
+ includeAllCopilotWorkspaces: boolean;
18
+ snapshot: boolean;
19
+ install: boolean;
20
+ autoSsh: boolean;
21
+ envKeys: string[];
22
+ };
23
+
24
+ export type ContextCandidate = {
25
+ source: string;
26
+ remoteRoot: string;
27
+ label: string;
28
+ sensitive: boolean;
29
+ preferenceKey: string;
30
+ promptLabel: string;
31
+ };
32
+
33
+ export type RemoteVm = {
34
+ exec(args: { command: string; timeoutMs?: number }): Promise<{ stdout?: string | null; stderr?: string | null; statusCode?: number | null }>;
35
+ fs: {
36
+ writeFile(path: string, content: Buffer): Promise<void>;
37
+ writeTextFile(path: string, content: string): Promise<void>;
38
+ };
39
+ };
40
+
41
+ export type UploadArchiveInChunks = (
42
+ vm: RemoteVm,
43
+ vmId: string,
44
+ archivePath: string,
45
+ remoteArchivePath: string,
46
+ label: string,
47
+ ) => Promise<void>;
48
+
49
+ export type ExecFileAsync = (file: string, args: string[]) => Promise<{ stdout: string; stderr: string }>;
50
+
51
+ export type PushvmPluginUtils = {
52
+ checkedExec(vm: RemoteVm, command: string, timeoutMs?: number): Promise<{ stdout?: string | null; stderr?: string | null; statusCode?: number | null }>;
53
+ createTar(args: string[]): Promise<void>;
54
+ uploadArchiveInChunks: UploadArchiveInChunks;
55
+ execFileAsync: ExecFileAsync;
56
+ shellQuote(value: string): string;
57
+ md5(value: string): string;
58
+ delay(ms: number): Promise<void>;
59
+ };
60
+
61
+ export type PushvmPluginContext = {
62
+ options: CliOptions;
63
+ utils: PushvmPluginUtils;
64
+ };
65
+
66
+ export type RemoteHookContext = PushvmPluginContext & {
67
+ vm: RemoteVm;
68
+ vmId: string;
69
+ };
70
+
71
+ export type EditorHookContext = RemoteHookContext & {
72
+ scheme: "vscode" | "cursor";
73
+ remoteWorkspaceUri: string;
74
+ };
75
+
76
+ export type ConnectHookContext = RemoteHookContext & {
77
+ contextCandidates: ContextCandidate[];
78
+ runBeforeOpenRemoteEditor(args: { scheme: "vscode" | "cursor"; remoteWorkspaceUri: string }): Promise<string[]>;
79
+ runAfterOpenRemoteEditor(args: { scheme: "vscode" | "cursor"; remoteWorkspaceUri: string }): Promise<string[]>;
80
+ };
81
+
82
+ export type PushvmPlugin = {
83
+ name: string;
84
+ collectEnvironment?(context: PushvmPluginContext): Record<string, string>;
85
+ discoverContextCandidates?(context: PushvmPluginContext): Promise<ContextCandidate[]> | ContextCandidate[];
86
+ shouldSkipContextDirectory?(relativePath: string, name: string): boolean;
87
+ isProtectedRemotePath?(remotePath: string): boolean;
88
+ afterProjectSync?(context: RemoteHookContext): Promise<void> | void;
89
+ afterContextSync?(context: RemoteHookContext & { changedRemotePaths: string[] }): Promise<void> | void;
90
+ beforeSnapshot?(context: RemoteHookContext): Promise<void> | void;
91
+ afterSync?(context: RemoteHookContext & { contextCandidates: ContextCandidate[] }): Promise<string[] | void> | string[] | void;
92
+ connect?(context: ConnectHookContext): Promise<boolean | void> | boolean | void;
93
+ beforeOpenRemoteEditor?(context: EditorHookContext & { contextCandidates: ContextCandidate[] }): Promise<string[] | void> | string[] | void;
94
+ afterOpenRemoteEditor?(context: EditorHookContext & { contextCandidates: ContextCandidate[] }): Promise<string[] | void> | string[] | void;
95
+ };
96
+
97
+ export type PushvmConfig = {
98
+ plugins: PushvmPlugin[];
99
+ };
100
+
101
+ export function definePlugin(plugin: PushvmPlugin): PushvmPlugin {
102
+ return plugin;
103
+ }
104
+
105
+ export function defineConfig(config: PushvmConfig): PushvmConfig {
106
+ return config;
107
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "NodeNext",
5
+ "moduleResolution": "NodeNext",
6
+ "allowImportingTsExtensions": true,
7
+ "rewriteRelativeImportExtensions": true,
8
+ "strict": true,
9
+ "esModuleInterop": true,
10
+ "forceConsistentCasingInFileNames": true,
11
+ "skipLibCheck": true,
12
+ "types": ["node"],
13
+ "erasableSyntaxOnly": true,
14
+ "outDir": "dist",
15
+ "rootDir": "."
16
+ },
17
+ "include": ["freestyle-sync.config.ts", "src/**/*.ts", "plugins/**/*.ts"]
18
+ }