claudeship 0.2.14 → 0.2.15

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 (59) hide show
  1. package/README.md +18 -0
  2. package/apps/server/dist/app.module.js +2 -0
  3. package/apps/server/dist/app.module.js.map +1 -1
  4. package/apps/server/dist/env/env.controller.d.ts +14 -0
  5. package/apps/server/dist/env/env.controller.js +84 -0
  6. package/apps/server/dist/env/env.controller.js.map +1 -0
  7. package/apps/server/dist/env/env.module.d.ts +2 -0
  8. package/apps/server/dist/env/env.module.js +25 -0
  9. package/apps/server/dist/env/env.module.js.map +1 -0
  10. package/apps/server/dist/env/env.service.d.ts +21 -0
  11. package/apps/server/dist/env/env.service.js +194 -0
  12. package/apps/server/dist/env/env.service.js.map +1 -0
  13. package/apps/server/dist/tsconfig.tsbuildinfo +1 -1
  14. package/apps/server/package.json +1 -1
  15. package/apps/web/.next/BUILD_ID +1 -1
  16. package/apps/web/.next/app-build-manifest.json +7 -7
  17. package/apps/web/.next/app-path-routes-manifest.json +2 -2
  18. package/apps/web/.next/build-manifest.json +2 -2
  19. package/apps/web/.next/cache/.previewinfo +1 -1
  20. package/apps/web/.next/cache/.rscinfo +1 -1
  21. package/apps/web/.next/cache/.tsbuildinfo +1 -1
  22. package/apps/web/.next/cache/config.json +3 -3
  23. package/apps/web/.next/cache/eslint/.cache_j3uhuz +1 -1
  24. package/apps/web/.next/cache/webpack/client-production/0.pack +0 -0
  25. package/apps/web/.next/cache/webpack/client-production/index.pack +0 -0
  26. package/apps/web/.next/cache/webpack/edge-server-production/index.pack +0 -0
  27. package/apps/web/.next/cache/webpack/server-production/0.pack +0 -0
  28. package/apps/web/.next/cache/webpack/server-production/index.pack +0 -0
  29. package/apps/web/.next/prerender-manifest.json +13 -13
  30. package/apps/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  31. package/apps/web/.next/server/app/_not-found.html +1 -1
  32. package/apps/web/.next/server/app/_not-found.rsc +2 -2
  33. package/apps/web/.next/server/app/index.html +1 -1
  34. package/apps/web/.next/server/app/index.rsc +3 -3
  35. package/apps/web/.next/server/app/page.js +2 -2
  36. package/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
  37. package/apps/web/.next/server/app/project/[id]/page.js +2 -2
  38. package/apps/web/.next/server/app/project/[id]/page_client-reference-manifest.js +1 -1
  39. package/apps/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  40. package/apps/web/.next/server/app/settings.html +1 -1
  41. package/apps/web/.next/server/app/settings.rsc +2 -2
  42. package/apps/web/.next/server/app-paths-manifest.json +2 -2
  43. package/apps/web/.next/server/pages/404.html +1 -1
  44. package/apps/web/.next/server/pages/500.html +1 -1
  45. package/apps/web/.next/server/server-reference-manifest.json +1 -1
  46. package/apps/web/.next/static/chunks/574-1fe2bcd6cfb41646.js +1 -0
  47. package/apps/web/.next/static/chunks/app/page-f19cfa58541ca83d.js +1 -0
  48. package/apps/web/.next/static/chunks/app/project/[id]/page-dffaa1d02f012216.js +1 -0
  49. package/apps/web/.next/static/css/0a24552d9794f8c8.css +3 -0
  50. package/apps/web/.next/trace +18 -18
  51. package/apps/web/package.json +1 -1
  52. package/apps/web/src/components/workspace/WorkspaceLayout.tsx +66 -4
  53. package/package.json +1 -1
  54. package/apps/web/.next/static/chunks/712-11fca77fb30a2a06.js +0 -1
  55. package/apps/web/.next/static/chunks/app/page-0db1c152fbd48359.js +0 -1
  56. package/apps/web/.next/static/chunks/app/project/[id]/page-7c44ae18c8984726.js +0 -1
  57. package/apps/web/.next/static/css/d0f1b036f222bc16.css +0 -3
  58. /package/apps/web/.next/static/{tV_Qc76rupeogXvWEMw6p → mkY_TTl_ho_ehDKiX10AN}/_buildManifest.js +0 -0
  59. /package/apps/web/.next/static/{tV_Qc76rupeogXvWEMw6p → mkY_TTl_ho_ehDKiX10AN}/_ssgManifest.js +0 -0
package/README.md CHANGED
@@ -95,6 +95,24 @@ Browse your project structure in a tree view. Click any file to view its content
95
95
  ### 🌐 Internationalization
96
96
  English and Korean UI support. Switch languages anytime from the header.
97
97
 
98
+ ### 📱 Responsive Preview
99
+ Test your app on different device sizes. Switch between Desktop, Tablet (768px), and Mobile (375px) views instantly.
100
+
101
+ ### 🖥 Console & Error Overlay
102
+ View real-time server logs and browser console output. Build errors are displayed directly on the preview with file location and stack trace.
103
+
104
+ ### 🗄 Database Viewer
105
+ Browse and manage your SQLite database directly in the UI. View tables, execute SQL queries, and edit data without leaving ClaudeShip.
106
+
107
+ ### ⏪ Checkpoint System
108
+ Git-based checkpoint system for easy rollback. Create snapshots of your work and restore to any previous state with one click.
109
+
110
+ ### 🧪 Browser Testing
111
+ Create and run automated browser tests using Playwright. Define test scenarios with clicks, form fills, and assertions.
112
+
113
+ ### 🔐 Environment Variables
114
+ Manage `.env` files through a visual editor. Sensitive values are masked by default for security.
115
+
98
116
  ---
99
117
 
100
118
  ## Quick Start
@@ -21,6 +21,7 @@ const database_module_1 = require("./database/database.module");
21
21
  const testing_module_1 = require("./testing/testing.module");
22
22
  const checkpoint_module_1 = require("./checkpoint/checkpoint.module");
23
23
  const project_context_module_1 = require("./project-context/project-context.module");
24
+ const env_module_1 = require("./env/env.module");
24
25
  let AppModule = class AppModule {
25
26
  };
26
27
  exports.AppModule = AppModule;
@@ -40,6 +41,7 @@ exports.AppModule = AppModule = __decorate([
40
41
  testing_module_1.TestingModule,
41
42
  checkpoint_module_1.CheckpointModule,
42
43
  project_context_module_1.ProjectContextModule,
44
+ env_module_1.EnvModule,
43
45
  ],
44
46
  controllers: [app_controller_1.AppController],
45
47
  providers: [app_service_1.AppService],
@@ -1 +1 @@
1
- {"version":3,"file":"app.module.js","sourceRoot":"","sources":["../src/app.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,2CAA8C;AAC9C,qDAAiD;AACjD,+CAA2C;AAC3C,0DAAsD;AACtD,6DAAyD;AACzD,oDAAgD;AAChD,6DAAyD;AACzD,oDAAgD;AAChD,gEAA4D;AAC5D,gEAA4D;AAC5D,6DAAyD;AACzD,sEAAkE;AAClE,qFAAgF;AAqBzE,IAAM,SAAS,GAAf,MAAM,SAAS;CAAG,CAAA;AAAZ,8BAAS;oBAAT,SAAS;IAnBrB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,qBAAY,CAAC,OAAO,CAAC;gBACnB,QAAQ,EAAE,IAAI;aACf,CAAC;YACF,4BAAY;YACZ,8BAAa;YACb,wBAAU;YACV,8BAAa;YACb,wBAAU;YACV,gCAAc;YACd,gCAAc;YACd,8BAAa;YACb,oCAAgB;YAChB,6CAAoB;SACrB;QACD,WAAW,EAAE,CAAC,8BAAa,CAAC;QAC5B,SAAS,EAAE,CAAC,wBAAU,CAAC;KACxB,CAAC;GACW,SAAS,CAAG"}
1
+ {"version":3,"file":"app.module.js","sourceRoot":"","sources":["../src/app.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,2CAA8C;AAC9C,qDAAiD;AACjD,+CAA2C;AAC3C,0DAAsD;AACtD,6DAAyD;AACzD,oDAAgD;AAChD,6DAAyD;AACzD,oDAAgD;AAChD,gEAA4D;AAC5D,gEAA4D;AAC5D,6DAAyD;AACzD,sEAAkE;AAClE,qFAAgF;AAChF,iDAA6C;AAsBtC,IAAM,SAAS,GAAf,MAAM,SAAS;CAAG,CAAA;AAAZ,8BAAS;oBAAT,SAAS;IApBrB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,qBAAY,CAAC,OAAO,CAAC;gBACnB,QAAQ,EAAE,IAAI;aACf,CAAC;YACF,4BAAY;YACZ,8BAAa;YACb,wBAAU;YACV,8BAAa;YACb,wBAAU;YACV,gCAAc;YACd,gCAAc;YACd,8BAAa;YACb,oCAAgB;YAChB,6CAAoB;YACpB,sBAAS;SACV;QACD,WAAW,EAAE,CAAC,8BAAa,CAAC;QAC5B,SAAS,EAAE,CAAC,wBAAU,CAAC;KACxB,CAAC;GACW,SAAS,CAAG"}
@@ -0,0 +1,14 @@
1
+ import { EnvService, EnvVariable } from "./env.service";
2
+ export declare class EnvController {
3
+ private readonly envService;
4
+ constructor(envService: EnvService);
5
+ getEnvFiles(projectId: string): Promise<import("./env.service").EnvFile[]>;
6
+ getEnvFile(projectId: string, filePath: string): Promise<import("./env.service").EnvFile>;
7
+ updateEnvFile(projectId: string, filePath: string, body: {
8
+ variables: EnvVariable[];
9
+ }): Promise<import("./env.service").EnvFile>;
10
+ createEnvFile(projectId: string, filePath: string, body: {
11
+ variables: EnvVariable[];
12
+ }): Promise<import("./env.service").EnvFile>;
13
+ deleteEnvFile(projectId: string, filePath: string): Promise<void>;
14
+ }
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.EnvController = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const env_service_1 = require("./env.service");
18
+ let EnvController = class EnvController {
19
+ constructor(envService) {
20
+ this.envService = envService;
21
+ }
22
+ getEnvFiles(projectId) {
23
+ return this.envService.getEnvFiles(projectId);
24
+ }
25
+ getEnvFile(projectId, filePath) {
26
+ return this.envService.getEnvFile(projectId, filePath);
27
+ }
28
+ updateEnvFile(projectId, filePath, body) {
29
+ return this.envService.updateEnvFile(projectId, filePath, body.variables);
30
+ }
31
+ createEnvFile(projectId, filePath, body) {
32
+ return this.envService.createEnvFile(projectId, filePath, body.variables);
33
+ }
34
+ deleteEnvFile(projectId, filePath) {
35
+ return this.envService.deleteEnvFile(projectId, filePath);
36
+ }
37
+ };
38
+ exports.EnvController = EnvController;
39
+ __decorate([
40
+ (0, common_1.Get)(),
41
+ __param(0, (0, common_1.Param)("projectId")),
42
+ __metadata("design:type", Function),
43
+ __metadata("design:paramtypes", [String]),
44
+ __metadata("design:returntype", void 0)
45
+ ], EnvController.prototype, "getEnvFiles", null);
46
+ __decorate([
47
+ (0, common_1.Get)("file"),
48
+ __param(0, (0, common_1.Param)("projectId")),
49
+ __param(1, (0, common_1.Query)("path")),
50
+ __metadata("design:type", Function),
51
+ __metadata("design:paramtypes", [String, String]),
52
+ __metadata("design:returntype", void 0)
53
+ ], EnvController.prototype, "getEnvFile", null);
54
+ __decorate([
55
+ (0, common_1.Put)("file"),
56
+ __param(0, (0, common_1.Param)("projectId")),
57
+ __param(1, (0, common_1.Query)("path")),
58
+ __param(2, (0, common_1.Body)()),
59
+ __metadata("design:type", Function),
60
+ __metadata("design:paramtypes", [String, String, Object]),
61
+ __metadata("design:returntype", void 0)
62
+ ], EnvController.prototype, "updateEnvFile", null);
63
+ __decorate([
64
+ (0, common_1.Post)("file"),
65
+ __param(0, (0, common_1.Param)("projectId")),
66
+ __param(1, (0, common_1.Query)("path")),
67
+ __param(2, (0, common_1.Body)()),
68
+ __metadata("design:type", Function),
69
+ __metadata("design:paramtypes", [String, String, Object]),
70
+ __metadata("design:returntype", void 0)
71
+ ], EnvController.prototype, "createEnvFile", null);
72
+ __decorate([
73
+ (0, common_1.Delete)("file"),
74
+ __param(0, (0, common_1.Param)("projectId")),
75
+ __param(1, (0, common_1.Query)("path")),
76
+ __metadata("design:type", Function),
77
+ __metadata("design:paramtypes", [String, String]),
78
+ __metadata("design:returntype", void 0)
79
+ ], EnvController.prototype, "deleteEnvFile", null);
80
+ exports.EnvController = EnvController = __decorate([
81
+ (0, common_1.Controller)("projects/:projectId/env"),
82
+ __metadata("design:paramtypes", [env_service_1.EnvService])
83
+ ], EnvController);
84
+ //# sourceMappingURL=env.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.controller.js","sourceRoot":"","sources":["../../src/env/env.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CASwB;AACxB,+CAAwD;AAGjD,IAAM,aAAa,GAAnB,MAAM,aAAa;IACxB,YAA6B,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAAG,CAAC;IAGvD,WAAW,CAAqB,SAAiB;QAC/C,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IAChD,CAAC;IAGD,UAAU,CACY,SAAiB,EACtB,QAAgB;QAE/B,OAAO,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACzD,CAAC;IAGD,aAAa,CACS,SAAiB,EACtB,QAAgB,EACvB,IAAkC;QAE1C,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,SAAS,EAAE,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAC5E,CAAC;IAGD,aAAa,CACS,SAAiB,EACtB,QAAgB,EACvB,IAAkC;QAE1C,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,SAAS,EAAE,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAC5E,CAAC;IAGD,aAAa,CACS,SAAiB,EACtB,QAAgB;QAE/B,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAC5D,CAAC;CACF,CAAA;AAzCY,sCAAa;AAIxB;IADC,IAAA,YAAG,GAAE;IACO,WAAA,IAAA,cAAK,EAAC,WAAW,CAAC,CAAA;;;;gDAE9B;AAGD;IADC,IAAA,YAAG,EAAC,MAAM,CAAC;IAET,WAAA,IAAA,cAAK,EAAC,WAAW,CAAC,CAAA;IAClB,WAAA,IAAA,cAAK,EAAC,MAAM,CAAC,CAAA;;;;+CAGf;AAGD;IADC,IAAA,YAAG,EAAC,MAAM,CAAC;IAET,WAAA,IAAA,cAAK,EAAC,WAAW,CAAC,CAAA;IAClB,WAAA,IAAA,cAAK,EAAC,MAAM,CAAC,CAAA;IACb,WAAA,IAAA,aAAI,GAAE,CAAA;;;;kDAGR;AAGD;IADC,IAAA,aAAI,EAAC,MAAM,CAAC;IAEV,WAAA,IAAA,cAAK,EAAC,WAAW,CAAC,CAAA;IAClB,WAAA,IAAA,cAAK,EAAC,MAAM,CAAC,CAAA;IACb,WAAA,IAAA,aAAI,GAAE,CAAA;;;;kDAGR;AAGD;IADC,IAAA,eAAM,EAAC,MAAM,CAAC;IAEZ,WAAA,IAAA,cAAK,EAAC,WAAW,CAAC,CAAA;IAClB,WAAA,IAAA,cAAK,EAAC,MAAM,CAAC,CAAA;;;;kDAGf;wBAxCU,aAAa;IADzB,IAAA,mBAAU,EAAC,yBAAyB,CAAC;qCAEK,wBAAU;GADxC,aAAa,CAyCzB"}
@@ -0,0 +1,2 @@
1
+ export declare class EnvModule {
2
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.EnvModule = void 0;
10
+ const common_1 = require("@nestjs/common");
11
+ const env_controller_1 = require("./env.controller");
12
+ const env_service_1 = require("./env.service");
13
+ const project_module_1 = require("../project/project.module");
14
+ let EnvModule = class EnvModule {
15
+ };
16
+ exports.EnvModule = EnvModule;
17
+ exports.EnvModule = EnvModule = __decorate([
18
+ (0, common_1.Module)({
19
+ imports: [project_module_1.ProjectModule],
20
+ controllers: [env_controller_1.EnvController],
21
+ providers: [env_service_1.EnvService],
22
+ exports: [env_service_1.EnvService],
23
+ })
24
+ ], EnvModule);
25
+ //# sourceMappingURL=env.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.module.js","sourceRoot":"","sources":["../../src/env/env.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,qDAAiD;AACjD,+CAA2C;AAC3C,8DAA0D;AAQnD,IAAM,SAAS,GAAf,MAAM,SAAS;CAAG,CAAA;AAAZ,8BAAS;oBAAT,SAAS;IANrB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,8BAAa,CAAC;QACxB,WAAW,EAAE,CAAC,8BAAa,CAAC;QAC5B,SAAS,EAAE,CAAC,wBAAU,CAAC;QACvB,OAAO,EAAE,CAAC,wBAAU,CAAC;KACtB,CAAC;GACW,SAAS,CAAG"}
@@ -0,0 +1,21 @@
1
+ import { ProjectService } from "../project/project.service";
2
+ export interface EnvVariable {
3
+ key: string;
4
+ value: string;
5
+ }
6
+ export interface EnvFile {
7
+ path: string;
8
+ variables: EnvVariable[];
9
+ }
10
+ export declare class EnvService {
11
+ private projectService;
12
+ private readonly logger;
13
+ constructor(projectService: ProjectService);
14
+ private parseEnvContent;
15
+ private formatEnvContent;
16
+ getEnvFiles(projectId: string): Promise<EnvFile[]>;
17
+ getEnvFile(projectId: string, filePath: string): Promise<EnvFile>;
18
+ updateEnvFile(projectId: string, filePath: string, variables: EnvVariable[]): Promise<EnvFile>;
19
+ createEnvFile(projectId: string, filePath: string, variables?: EnvVariable[]): Promise<EnvFile>;
20
+ deleteEnvFile(projectId: string, filePath: string): Promise<void>;
21
+ }
@@ -0,0 +1,194 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var EnvService_1;
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.EnvService = void 0;
14
+ const common_1 = require("@nestjs/common");
15
+ const project_service_1 = require("../project/project.service");
16
+ const path = require("path");
17
+ const fs = require("fs/promises");
18
+ const fs_1 = require("fs");
19
+ let EnvService = EnvService_1 = class EnvService {
20
+ constructor(projectService) {
21
+ this.projectService = projectService;
22
+ this.logger = new common_1.Logger(EnvService_1.name);
23
+ }
24
+ parseEnvContent(content) {
25
+ const variables = [];
26
+ const lines = content.split("\n");
27
+ for (const line of lines) {
28
+ const trimmed = line.trim();
29
+ if (!trimmed || trimmed.startsWith("#")) {
30
+ continue;
31
+ }
32
+ const equalsIndex = trimmed.indexOf("=");
33
+ if (equalsIndex > 0) {
34
+ const key = trimmed.substring(0, equalsIndex).trim();
35
+ let value = trimmed.substring(equalsIndex + 1).trim();
36
+ if ((value.startsWith('"') && value.endsWith('"')) ||
37
+ (value.startsWith("'") && value.endsWith("'"))) {
38
+ value = value.slice(1, -1);
39
+ }
40
+ variables.push({ key, value });
41
+ }
42
+ }
43
+ return variables;
44
+ }
45
+ formatEnvContent(variables) {
46
+ return variables
47
+ .map(({ key, value }) => {
48
+ const needsQuotes = /[\s#=]/.test(value) || value.includes('"');
49
+ const formattedValue = needsQuotes
50
+ ? `"${value.replace(/"/g, '\\"')}"`
51
+ : value;
52
+ return `${key}=${formattedValue}`;
53
+ })
54
+ .join("\n");
55
+ }
56
+ async getEnvFiles(projectId) {
57
+ const projectPath = await this.projectService.getProjectPath(projectId);
58
+ const envFiles = [];
59
+ const envPatterns = [
60
+ ".env",
61
+ ".env.local",
62
+ ".env.development",
63
+ ".env.development.local",
64
+ ".env.production",
65
+ ".env.production.local",
66
+ ".env.test",
67
+ ".env.test.local",
68
+ ".env.example",
69
+ ];
70
+ const searchDirs = [projectPath, path.join(projectPath, "backend")];
71
+ for (const dir of searchDirs) {
72
+ if (!(0, fs_1.existsSync)(dir))
73
+ continue;
74
+ for (const pattern of envPatterns) {
75
+ const filePath = path.join(dir, pattern);
76
+ if ((0, fs_1.existsSync)(filePath)) {
77
+ try {
78
+ const content = await fs.readFile(filePath, "utf-8");
79
+ const relativePath = path.relative(projectPath, filePath);
80
+ envFiles.push({
81
+ path: relativePath,
82
+ variables: this.parseEnvContent(content),
83
+ });
84
+ }
85
+ catch (error) {
86
+ this.logger.warn(`Failed to read ${filePath}: ${error}`);
87
+ }
88
+ }
89
+ }
90
+ }
91
+ return envFiles;
92
+ }
93
+ async getEnvFile(projectId, filePath) {
94
+ const projectPath = await this.projectService.getProjectPath(projectId);
95
+ const fullPath = path.join(projectPath, filePath);
96
+ const resolvedPath = path.resolve(fullPath);
97
+ const resolvedProjectPath = path.resolve(projectPath);
98
+ if (!resolvedPath.startsWith(resolvedProjectPath)) {
99
+ throw new common_1.BadRequestException("Invalid file path");
100
+ }
101
+ if (!(0, fs_1.existsSync)(fullPath)) {
102
+ throw new common_1.NotFoundException(`File not found: ${filePath}`);
103
+ }
104
+ try {
105
+ const content = await fs.readFile(fullPath, "utf-8");
106
+ return {
107
+ path: filePath,
108
+ variables: this.parseEnvContent(content),
109
+ };
110
+ }
111
+ catch (error) {
112
+ this.logger.error(`Failed to read env file: ${error}`);
113
+ throw new common_1.BadRequestException("Failed to read file");
114
+ }
115
+ }
116
+ async updateEnvFile(projectId, filePath, variables) {
117
+ const projectPath = await this.projectService.getProjectPath(projectId);
118
+ const fullPath = path.join(projectPath, filePath);
119
+ const resolvedPath = path.resolve(fullPath);
120
+ const resolvedProjectPath = path.resolve(projectPath);
121
+ if (!resolvedPath.startsWith(resolvedProjectPath)) {
122
+ throw new common_1.BadRequestException("Invalid file path");
123
+ }
124
+ const fileName = path.basename(filePath);
125
+ if (!fileName.startsWith(".env")) {
126
+ throw new common_1.BadRequestException("File must be a .env file");
127
+ }
128
+ try {
129
+ const content = this.formatEnvContent(variables);
130
+ await fs.writeFile(fullPath, content + "\n", "utf-8");
131
+ return {
132
+ path: filePath,
133
+ variables,
134
+ };
135
+ }
136
+ catch (error) {
137
+ this.logger.error(`Failed to write env file: ${error}`);
138
+ throw new common_1.BadRequestException("Failed to write file");
139
+ }
140
+ }
141
+ async createEnvFile(projectId, filePath, variables = []) {
142
+ const projectPath = await this.projectService.getProjectPath(projectId);
143
+ const fullPath = path.join(projectPath, filePath);
144
+ const resolvedPath = path.resolve(fullPath);
145
+ const resolvedProjectPath = path.resolve(projectPath);
146
+ if (!resolvedPath.startsWith(resolvedProjectPath)) {
147
+ throw new common_1.BadRequestException("Invalid file path");
148
+ }
149
+ const fileName = path.basename(filePath);
150
+ if (!fileName.startsWith(".env")) {
151
+ throw new common_1.BadRequestException("File name must start with .env");
152
+ }
153
+ if ((0, fs_1.existsSync)(fullPath)) {
154
+ throw new common_1.BadRequestException("File already exists");
155
+ }
156
+ try {
157
+ const content = this.formatEnvContent(variables);
158
+ await fs.writeFile(fullPath, content + "\n", "utf-8");
159
+ return {
160
+ path: filePath,
161
+ variables,
162
+ };
163
+ }
164
+ catch (error) {
165
+ this.logger.error(`Failed to create env file: ${error}`);
166
+ throw new common_1.BadRequestException("Failed to create file");
167
+ }
168
+ }
169
+ async deleteEnvFile(projectId, filePath) {
170
+ const projectPath = await this.projectService.getProjectPath(projectId);
171
+ const fullPath = path.join(projectPath, filePath);
172
+ const resolvedPath = path.resolve(fullPath);
173
+ const resolvedProjectPath = path.resolve(projectPath);
174
+ if (!resolvedPath.startsWith(resolvedProjectPath)) {
175
+ throw new common_1.BadRequestException("Invalid file path");
176
+ }
177
+ if (!(0, fs_1.existsSync)(fullPath)) {
178
+ throw new common_1.NotFoundException("File not found");
179
+ }
180
+ try {
181
+ await fs.unlink(fullPath);
182
+ }
183
+ catch (error) {
184
+ this.logger.error(`Failed to delete env file: ${error}`);
185
+ throw new common_1.BadRequestException("Failed to delete file");
186
+ }
187
+ }
188
+ };
189
+ exports.EnvService = EnvService;
190
+ exports.EnvService = EnvService = EnvService_1 = __decorate([
191
+ (0, common_1.Injectable)(),
192
+ __metadata("design:paramtypes", [project_service_1.ProjectService])
193
+ ], EnvService);
194
+ //# sourceMappingURL=env.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.service.js","sourceRoot":"","sources":["../../src/env/env.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAA4F;AAC5F,gEAA4D;AAC5D,6BAA6B;AAC7B,kCAAkC;AAClC,2BAAgC;AAazB,IAAM,UAAU,kBAAhB,MAAM,UAAU;IAGrB,YAAoB,cAA8B;QAA9B,mBAAc,GAAd,cAAc,CAAgB;QAFjC,WAAM,GAAG,IAAI,eAAM,CAAC,YAAU,CAAC,IAAI,CAAC,CAAC;IAED,CAAC;IAK9C,eAAe,CAAC,OAAe;QACrC,MAAM,SAAS,GAAkB,EAAE,CAAC;QACpC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAElC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;YAG5B,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;gBACxC,SAAS;YACX,CAA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