repoburg 1.3.273 → 1.3.274

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.
@@ -20,7 +20,8 @@ function isUnder(child, parent) {
20
20
  /**
21
21
  * Validate a workspace path before a backend is started for it:
22
22
  * - must be absolute,
23
- * - must exist and be a directory,
23
+ * - must be a directory; a missing one is created (mkdir -p), because
24
+ * sessions can name a workspace path nobody has made yet,
24
25
  * - must not be $HOME or a filesystem root,
25
26
  * - must not overlap another service workspace (nested either way).
26
27
  * Returns the resolved absolute path; throws WorkspaceValidationError
@@ -36,7 +37,15 @@ function validateWorkspacePath(projectPath, existingServices) {
36
37
  stat = (0, fs_1.statSync)(resolved);
37
38
  }
38
39
  catch {
39
- throw new WorkspaceValidationError(`Workspace directory does not exist: ${resolved}`);
40
+ // The path may simply not exist yet (a session was created for a
41
+ // workspace nobody has made): create it instead of failing the start.
42
+ try {
43
+ (0, fs_1.mkdirSync)(resolved, { recursive: true });
44
+ stat = (0, fs_1.statSync)(resolved);
45
+ }
46
+ catch {
47
+ throw new WorkspaceValidationError(`Workspace directory does not exist and could not be created: ${resolved}`);
48
+ }
40
49
  }
41
50
  if (!stat.isDirectory()) {
42
51
  throw new WorkspaceValidationError(`Workspace path is not a directory: ${resolved}`);
@@ -31,8 +31,14 @@ describe('validateWorkspacePath', () => {
31
31
  expect(() => (0, workspace_validation_1.validateWorkspacePath)('relative/path', [])).toThrow(workspace_validation_1.WorkspaceValidationError);
32
32
  expect(() => (0, workspace_validation_1.validateWorkspacePath)('', [])).toThrow(workspace_validation_1.WorkspaceValidationError);
33
33
  });
34
- it('rejects paths that do not exist', () => {
35
- expect(() => (0, workspace_validation_1.validateWorkspacePath)((0, path_1.join)(dir, 'missing'), [])).toThrow(/Workspace directory does not exist/);
34
+ it('creates a missing workspace directory and returns the resolved path', () => {
35
+ const missing = (0, path_1.join)(dir, 'created-by-test');
36
+ expect((0, workspace_validation_1.validateWorkspacePath)(missing, [])).toBe((0, path_1.resolve)(missing));
37
+ expect((0, fs_1.statSync)(missing).isDirectory()).toBe(true);
38
+ (0, fs_1.rmSync)(missing, { recursive: true, force: true });
39
+ });
40
+ it('rejects a missing path that cannot be created', () => {
41
+ expect(() => (0, workspace_validation_1.validateWorkspacePath)((0, path_1.join)(filePath, 'deeper'), [])).toThrow(/could not be created/);
36
42
  });
37
43
  it('rejects paths that are not directories', () => {
38
44
  expect(() => (0, workspace_validation_1.validateWorkspacePath)(filePath, [])).toThrow(/not a directory/);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repoburg",
3
- "version": "1.3.273",
3
+ "version": "1.3.274",
4
4
  "description": "A local AI-powered software developer assistant that runs on your own machine.",
5
5
  "author": "Celal Ertug",
6
6
  "license": "SEE LICENSE IN LICENSE",