git-drive 0.1.5 → 0.1.6

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 (93) hide show
  1. package/dist/__tests__/commands/init.test.js +123 -0
  2. package/dist/__tests__/commands/list.test.js +91 -0
  3. package/dist/__tests__/commands/push.test.js +128 -0
  4. package/dist/__tests__/commands/restore.test.js +99 -0
  5. package/dist/__tests__/commands/status.test.js +151 -0
  6. package/dist/__tests__/config.test.js +150 -0
  7. package/dist/__tests__/e2e.test.js +107 -0
  8. package/dist/__tests__/errors.test.js +56 -0
  9. package/dist/__tests__/git.test.js +184 -0
  10. package/dist/__tests__/server.test.js +310 -0
  11. package/dist/commands/archive.js +32 -0
  12. package/dist/commands/init.js +55 -0
  13. package/dist/commands/link.js +175 -0
  14. package/dist/commands/list.js +83 -0
  15. package/dist/commands/push.js +112 -0
  16. package/dist/commands/restore.js +30 -0
  17. package/dist/commands/status.js +116 -0
  18. package/dist/config.js +62 -0
  19. package/dist/errors.js +30 -0
  20. package/dist/git.js +67 -0
  21. package/dist/index.js +108 -0
  22. package/dist/server.js +535 -0
  23. package/package.json +55 -20
  24. package/.github/workflows/ci.yml +0 -77
  25. package/.planning/codebase/ARCHITECTURE.md +0 -151
  26. package/.planning/codebase/CONCERNS.md +0 -191
  27. package/.planning/codebase/CONVENTIONS.md +0 -169
  28. package/.planning/codebase/INTEGRATIONS.md +0 -94
  29. package/.planning/codebase/STACK.md +0 -77
  30. package/.planning/codebase/STRUCTURE.md +0 -157
  31. package/.planning/codebase/TESTING.md +0 -156
  32. package/Dockerfile.cli +0 -30
  33. package/Dockerfile.server +0 -32
  34. package/README.md +0 -121
  35. package/docker-compose.yml +0 -48
  36. package/packages/cli/Dockerfile +0 -26
  37. package/packages/cli/jest.config.js +0 -26
  38. package/packages/cli/package.json +0 -65
  39. package/packages/cli/src/__tests__/commands/init.test.ts +0 -154
  40. package/packages/cli/src/__tests__/commands/list.test.ts +0 -118
  41. package/packages/cli/src/__tests__/commands/push.test.ts +0 -155
  42. package/packages/cli/src/__tests__/commands/restore.test.ts +0 -134
  43. package/packages/cli/src/__tests__/commands/status.test.ts +0 -195
  44. package/packages/cli/src/__tests__/config.test.ts +0 -198
  45. package/packages/cli/src/__tests__/e2e.test.ts +0 -125
  46. package/packages/cli/src/__tests__/errors.test.ts +0 -66
  47. package/packages/cli/src/__tests__/git.test.ts +0 -226
  48. package/packages/cli/src/__tests__/server.test.ts +0 -368
  49. package/packages/cli/src/commands/archive.ts +0 -39
  50. package/packages/cli/src/commands/init.ts +0 -64
  51. package/packages/cli/src/commands/link.ts +0 -151
  52. package/packages/cli/src/commands/list.ts +0 -94
  53. package/packages/cli/src/commands/push.ts +0 -77
  54. package/packages/cli/src/commands/restore.ts +0 -36
  55. package/packages/cli/src/commands/status.ts +0 -127
  56. package/packages/cli/src/config.ts +0 -73
  57. package/packages/cli/src/errors.ts +0 -23
  58. package/packages/cli/src/git.ts +0 -55
  59. package/packages/cli/src/index.ts +0 -122
  60. package/packages/cli/src/server.ts +0 -573
  61. package/packages/cli/tsconfig.json +0 -13
  62. package/packages/git-drive-docker/package.json +0 -15
  63. package/packages/server/package.json +0 -44
  64. package/packages/server/src/index.ts +0 -569
  65. package/packages/server/tsconfig.json +0 -9
  66. package/packages/ui/README.md +0 -73
  67. package/packages/ui/eslint.config.js +0 -23
  68. package/packages/ui/index.html +0 -13
  69. package/packages/ui/package.json +0 -52
  70. package/packages/ui/postcss.config.js +0 -6
  71. package/packages/ui/public/vite.svg +0 -1
  72. package/packages/ui/src/App.css +0 -23
  73. package/packages/ui/src/App.test.tsx +0 -242
  74. package/packages/ui/src/App.tsx +0 -755
  75. package/packages/ui/src/assets/react.svg +0 -8
  76. package/packages/ui/src/assets/vite.svg +0 -3
  77. package/packages/ui/src/index.css +0 -37
  78. package/packages/ui/src/main.tsx +0 -14
  79. package/packages/ui/src/test/setup.ts +0 -1
  80. package/packages/ui/tailwind.config.js +0 -11
  81. package/packages/ui/tsconfig.app.json +0 -28
  82. package/packages/ui/tsconfig.json +0 -26
  83. package/packages/ui/tsconfig.node.json +0 -12
  84. package/packages/ui/vite.config.ts +0 -7
  85. package/packages/ui/vitest.config.ts +0 -20
  86. package/pnpm-workspace.yaml +0 -4
  87. package/rewrite_app.js +0 -731
  88. package/tsconfig.json +0 -14
  89. /package/{packages/cli/ui → ui}/assets/index-Br8xQbJz.js +0 -0
  90. /package/{packages/cli/ui → ui}/assets/index-Cc2q1t5k.js +0 -0
  91. /package/{packages/cli/ui → ui}/assets/index-DrL7ojPA.css +0 -0
  92. /package/{packages/cli/ui → ui}/index.html +0 -0
  93. /package/{packages/cli/ui → ui}/vite.svg +0 -0
@@ -1,73 +0,0 @@
1
- # React + TypeScript + Vite
2
-
3
- This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4
-
5
- Currently, two official plugins are available:
6
-
7
- - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
8
- - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9
-
10
- ## React Compiler
11
-
12
- The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
13
-
14
- ## Expanding the ESLint configuration
15
-
16
- If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
17
-
18
- ```js
19
- export default defineConfig([
20
- globalIgnores(['dist']),
21
- {
22
- files: ['**/*.{ts,tsx}'],
23
- extends: [
24
- // Other configs...
25
-
26
- // Remove tseslint.configs.recommended and replace with this
27
- tseslint.configs.recommendedTypeChecked,
28
- // Alternatively, use this for stricter rules
29
- tseslint.configs.strictTypeChecked,
30
- // Optionally, add this for stylistic rules
31
- tseslint.configs.stylisticTypeChecked,
32
-
33
- // Other configs...
34
- ],
35
- languageOptions: {
36
- parserOptions: {
37
- project: ['./tsconfig.node.json', './tsconfig.app.json'],
38
- tsconfigRootDir: import.meta.dirname,
39
- },
40
- // other options...
41
- },
42
- },
43
- ])
44
- ```
45
-
46
- You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
47
-
48
- ```js
49
- // eslint.config.js
50
- import reactX from 'eslint-plugin-react-x'
51
- import reactDom from 'eslint-plugin-react-dom'
52
-
53
- export default defineConfig([
54
- globalIgnores(['dist']),
55
- {
56
- files: ['**/*.{ts,tsx}'],
57
- extends: [
58
- // Other configs...
59
- // Enable lint rules for React
60
- reactX.configs['recommended-typescript'],
61
- // Enable lint rules for React DOM
62
- reactDom.configs.recommended,
63
- ],
64
- languageOptions: {
65
- parserOptions: {
66
- project: ['./tsconfig.node.json', './tsconfig.app.json'],
67
- tsconfigRootDir: import.meta.dirname,
68
- },
69
- // other options...
70
- },
71
- },
72
- ])
73
- ```
@@ -1,23 +0,0 @@
1
- import js from '@eslint/js'
2
- import globals from 'globals'
3
- import reactHooks from 'eslint-plugin-react-hooks'
4
- import reactRefresh from 'eslint-plugin-react-refresh'
5
- import tseslint from 'typescript-eslint'
6
- import { defineConfig, globalIgnores } from 'eslint/config'
7
-
8
- export default defineConfig([
9
- globalIgnores(['dist']),
10
- {
11
- files: ['**/*.{ts,tsx}'],
12
- extends: [
13
- js.configs.recommended,
14
- tseslint.configs.recommended,
15
- reactHooks.configs.flat.recommended,
16
- reactRefresh.configs.vite,
17
- ],
18
- languageOptions: {
19
- ecmaVersion: 2020,
20
- globals: globals.browser,
21
- },
22
- },
23
- ])
@@ -1,13 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>Vite + React + TS</title>
8
- </head>
9
- <body>
10
- <div id="root"></div>
11
- <script type="module" src="/src/main.tsx"></script>
12
- </body>
13
- </html>
@@ -1,52 +0,0 @@
1
- {
2
- "name": "git-drive-ui",
3
- "version": "0.1.0",
4
- "private": true,
5
- "type": "module",
6
- "scripts": {
7
- "dev": "vite",
8
- "build": "vite build",
9
- "lint": "eslint .",
10
- "preview": "vite preview",
11
- "test": "vitest",
12
- "test:watch": "vitest watch",
13
- "test:coverage": "vitest run --coverage"
14
- },
15
- "dependencies": {
16
- "@radix-ui/react-icons": "^1.3.2",
17
- "@radix-ui/react-slot": "^1.2.4",
18
- "@radix-ui/react-tooltip": "^1.2.8",
19
- "autoprefixer": "^10.4.25",
20
- "axios": "^1.13.5",
21
- "class-variance-authority": "^0.7.1",
22
- "clsx": "^2.1.1",
23
- "fuse.js": "^7.1.0",
24
- "lucide-react": "^0.575.0",
25
- "postcss": "^8.5.6",
26
- "react": "^19.2.4",
27
- "react-dom": "^19.2.4",
28
- "react-query": "^3.39.3",
29
- "react-router-dom": "^7.13.1",
30
- "tailwind-merge": "^3.5.0",
31
- "tailwindcss": "^3.4.19",
32
- "valibot": "^1.2.0"
33
- },
34
- "devDependencies": {
35
- "@eslint/js": "^10.0.1",
36
- "@testing-library/jest-dom": "^6.6.3",
37
- "@testing-library/react": "^16.2.0",
38
- "@testing-library/user-event": "^14.6.1",
39
- "@types/react": "^19.2.14",
40
- "@types/react-dom": "^19.2.3",
41
- "@vitejs/plugin-react": "^5.1.4",
42
- "eslint": "^10.0.2",
43
- "eslint-plugin-react-hooks": "^7.0.1",
44
- "eslint-plugin-react-refresh": "^0.5.2",
45
- "globals": "^17.3.0",
46
- "jsdom": "^26.0.0",
47
- "msw": "^2.7.3",
48
- "typescript-eslint": "^8.56.1",
49
- "vite": "^7.3.1",
50
- "vitest": "^3.0.8"
51
- }
52
- }
@@ -1,6 +0,0 @@
1
- export default {
2
- plugins: {
3
- tailwindcss: {},
4
- autoprefixer: {},
5
- },
6
- }
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
@@ -1,23 +0,0 @@
1
- .App {
2
- text-align: center;
3
- }
4
-
5
- .App-logo {
6
- animation: App-logo-spin infinite 20s linear;
7
- height: 40vmin;
8
- pointer-events: none;
9
- }
10
-
11
- @media (prefers-reduced-motion: no-preference) {
12
- a:nth-of-type(2).logo:hover {
13
- filter: drop-shadow(0 0 2em #61dafbaa);
14
- }
15
- }
16
-
17
- .card {
18
- padding: 2em;
19
- }
20
-
21
- .read-the-docs {
22
- color: #888;
23
- }
@@ -1,242 +0,0 @@
1
- import { describe, it, expect, vi, beforeEach } from 'vitest';
2
- import { render, screen, fireEvent, waitFor } from '@testing-library/react';
3
- import { MemoryRouter } from 'react-router-dom';
4
- import App from './App';
5
-
6
- // Mock axios
7
- vi.mock('axios', () => ({
8
- default: {
9
- get: vi.fn(),
10
- post: vi.fn(),
11
- delete: vi.fn(),
12
- },
13
- }));
14
-
15
- import axios from 'axios';
16
-
17
- const mockAxios = vi.mocked(axios);
18
-
19
- // Helper to render with router
20
- const renderWithRouter = (initialRoute = '/') => {
21
- return render(
22
- <MemoryRouter initialEntries={[initialRoute]}>
23
- <App />
24
- </MemoryRouter>
25
- );
26
- };
27
-
28
- describe('App', () => {
29
- beforeEach(() => {
30
- vi.clearAllMocks();
31
- });
32
-
33
- it('should render the header with title', () => {
34
- renderWithRouter();
35
- expect(screen.getByText('Git Drive')).toBeInTheDocument();
36
- expect(screen.getByText('Turn any drive into a git remote.')).toBeInTheDocument();
37
- });
38
-
39
- it('should render drive list on home route', () => {
40
- renderWithRouter();
41
- expect(screen.getByText('Connected Drives')).toBeInTheDocument();
42
- });
43
- });
44
-
45
- describe('DriveList', () => {
46
- beforeEach(() => {
47
- vi.clearAllMocks();
48
- });
49
-
50
- it('should display loading state initially', () => {
51
- mockAxios.get.mockImplementation(() => new Promise(() => {})); // Never resolves
52
-
53
- renderWithRouter();
54
-
55
- // Check for loading state (skeleton or loading text)
56
- expect(screen.getByText('Connected Drives')).toBeInTheDocument();
57
- });
58
-
59
- it('should display drives after loading', async () => {
60
- mockAxios.get.mockResolvedValue({
61
- data: [
62
- {
63
- device: 'TestDrive',
64
- description: '/Volumes/TestDrive',
65
- size: 32000000000,
66
- isRemovable: true,
67
- isSystem: false,
68
- mountpoints: ['/Volumes/TestDrive'],
69
- hasGitDrive: true,
70
- },
71
- ],
72
- });
73
-
74
- renderWithRouter();
75
-
76
- await waitFor(() => {
77
- expect(screen.getByText('/Volumes/TestDrive')).toBeInTheDocument();
78
- });
79
- });
80
-
81
- it('should display unconfigured drive with initialize button', async () => {
82
- mockAxios.get.mockResolvedValue({
83
- data: [
84
- {
85
- device: 'NewDrive',
86
- description: '/Volumes/NewDrive',
87
- size: 64000000000,
88
- isRemovable: true,
89
- isSystem: false,
90
- mountpoints: ['/Volumes/NewDrive'],
91
- hasGitDrive: false,
92
- },
93
- ],
94
- });
95
-
96
- renderWithRouter();
97
-
98
- await waitFor(() => {
99
- expect(screen.getByText('Initialize Git Drive')).toBeInTheDocument();
100
- });
101
- });
102
-
103
- it('should initialize drive when button clicked', async () => {
104
- mockAxios.get.mockResolvedValue({
105
- data: [
106
- {
107
- device: 'NewDrive',
108
- description: '/Volumes/NewDrive',
109
- size: 64000000000,
110
- isRemovable: true,
111
- isSystem: false,
112
- mountpoints: ['/Volumes/NewDrive'],
113
- hasGitDrive: false,
114
- },
115
- ],
116
- });
117
-
118
- mockAxios.post.mockResolvedValue({ data: { message: 'Initialized' } });
119
-
120
- renderWithRouter();
121
-
122
- await waitFor(() => {
123
- expect(screen.getByText('Initialize Git Drive')).toBeInTheDocument();
124
- });
125
-
126
- fireEvent.click(screen.getByText('Initialize Git Drive'));
127
-
128
- await waitFor(() => {
129
- expect(mockAxios.post).toHaveBeenCalledWith(
130
- expect.stringContaining('/init')
131
- );
132
- });
133
- });
134
- });
135
-
136
- describe('RepoList', () => {
137
- beforeEach(() => {
138
- vi.clearAllMocks();
139
- });
140
-
141
- it('should display repos for a drive', async () => {
142
- mockAxios.get.mockResolvedValue({
143
- data: {
144
- mountpoint: '/Volumes/TestDrive',
145
- gitDrivePath: '/Volumes/TestDrive/.git-drive',
146
- initialized: true,
147
- repos: [
148
- {
149
- name: 'my-project',
150
- path: '/Volumes/TestDrive/.git-drive/my-project.git',
151
- lastModified: '2024-01-01T00:00:00.000Z',
152
- },
153
- ],
154
- },
155
- });
156
-
157
- renderWithRouter('/drives/%2FVolumes%2FTestDrive');
158
-
159
- await waitFor(() => {
160
- expect(screen.getByText('my-project')).toBeInTheDocument();
161
- });
162
- });
163
-
164
- it('should display empty state when no repos', async () => {
165
- mockAxios.get.mockResolvedValue({
166
- data: {
167
- mountpoint: '/Volumes/TestDrive',
168
- gitDrivePath: '/Volumes/TestDrive/.git-drive',
169
- initialized: true,
170
- repos: [],
171
- },
172
- });
173
-
174
- renderWithRouter('/drives/%2FVolumes%2FTestDrive');
175
-
176
- await waitFor(() => {
177
- expect(screen.getByText('No repositories yet')).toBeInTheDocument();
178
- });
179
- });
180
-
181
- it('should filter repos with search', async () => {
182
- mockAxios.get.mockResolvedValue({
183
- data: {
184
- mountpoint: '/Volumes/TestDrive',
185
- gitDrivePath: '/Volumes/TestDrive/.git-drive',
186
- initialized: true,
187
- repos: [
188
- { name: 'project-alpha', path: '/a', lastModified: '2024-01-01' },
189
- { name: 'project-beta', path: '/b', lastModified: '2024-01-02' },
190
- ],
191
- },
192
- });
193
-
194
- renderWithRouter('/drives/%2FVolumes%2FTestDrive');
195
-
196
- await waitFor(() => {
197
- expect(screen.getByText('project-alpha')).toBeInTheDocument();
198
- expect(screen.getByText('project-beta')).toBeInTheDocument();
199
- });
200
-
201
- const searchInput = screen.getByPlaceholderText('Filter repositories...');
202
- fireEvent.change(searchInput, { target: { value: 'alpha' } });
203
-
204
- await waitFor(() => {
205
- expect(screen.getByText('project-alpha')).toBeInTheDocument();
206
- expect(screen.queryByText('project-beta')).not.toBeInTheDocument();
207
- });
208
- });
209
-
210
- it('should create a new repo', async () => {
211
- mockAxios.get.mockResolvedValue({
212
- data: {
213
- mountpoint: '/Volumes/TestDrive',
214
- gitDrivePath: '/Volumes/TestDrive/.git-drive',
215
- initialized: true,
216
- repos: [],
217
- },
218
- });
219
-
220
- mockAxios.post.mockResolvedValue({
221
- data: { name: 'new-repo', path: '/path/to/new-repo.git' },
222
- });
223
-
224
- // Mock prompt
225
- vi.spyOn(window, 'prompt').mockReturnValue('new-repo');
226
-
227
- renderWithRouter('/drives/%2FVolumes%2FTestDrive');
228
-
229
- await waitFor(() => {
230
- expect(screen.getByText('New Repository')).toBeInTheDocument();
231
- });
232
-
233
- fireEvent.click(screen.getByText('New Repository'));
234
-
235
- await waitFor(() => {
236
- expect(mockAxios.post).toHaveBeenCalledWith(
237
- expect.stringContaining('/repos'),
238
- { name: 'new-repo' }
239
- );
240
- });
241
- });
242
- });