claudeship 0.2.12 → 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 (128) hide show
  1. package/README.md +18 -0
  2. package/apps/server/dist/app.module.js +10 -0
  3. package/apps/server/dist/app.module.js.map +1 -1
  4. package/apps/server/dist/chat/prompts/fullstack-express-prompt.d.ts +1 -1
  5. package/apps/server/dist/chat/prompts/fullstack-express-prompt.js +109 -1
  6. package/apps/server/dist/chat/prompts/fullstack-express-prompt.js.map +1 -1
  7. package/apps/server/dist/chat/prompts/fullstack-fastapi-prompt.d.ts +1 -1
  8. package/apps/server/dist/chat/prompts/fullstack-fastapi-prompt.js +109 -1
  9. package/apps/server/dist/chat/prompts/fullstack-fastapi-prompt.js.map +1 -1
  10. package/apps/server/dist/chat/prompts/web-system-prompt.d.ts +1 -1
  11. package/apps/server/dist/chat/prompts/web-system-prompt.js +156 -0
  12. package/apps/server/dist/chat/prompts/web-system-prompt.js.map +1 -1
  13. package/apps/server/dist/checkpoint/checkpoint.controller.d.ts +19 -0
  14. package/apps/server/dist/checkpoint/checkpoint.controller.js +93 -0
  15. package/apps/server/dist/checkpoint/checkpoint.controller.js.map +1 -0
  16. package/apps/server/dist/checkpoint/checkpoint.module.d.ts +2 -0
  17. package/apps/server/dist/checkpoint/checkpoint.module.js +25 -0
  18. package/apps/server/dist/checkpoint/checkpoint.module.js.map +1 -0
  19. package/apps/server/dist/checkpoint/checkpoint.service.d.ts +41 -0
  20. package/apps/server/dist/checkpoint/checkpoint.service.js +261 -0
  21. package/apps/server/dist/checkpoint/checkpoint.service.js.map +1 -0
  22. package/apps/server/dist/database/database.controller.d.ts +23 -0
  23. package/apps/server/dist/database/database.controller.js +109 -0
  24. package/apps/server/dist/database/database.controller.js.map +1 -0
  25. package/apps/server/dist/database/database.module.d.ts +2 -0
  26. package/apps/server/dist/database/database.module.js +25 -0
  27. package/apps/server/dist/database/database.module.js.map +1 -0
  28. package/apps/server/dist/database/database.service.d.ts +32 -0
  29. package/apps/server/dist/database/database.service.js +238 -0
  30. package/apps/server/dist/database/database.service.js.map +1 -0
  31. package/apps/server/dist/env/env.controller.d.ts +14 -0
  32. package/apps/server/dist/env/env.controller.js +84 -0
  33. package/apps/server/dist/env/env.controller.js.map +1 -0
  34. package/apps/server/dist/env/env.module.d.ts +2 -0
  35. package/apps/server/dist/env/env.module.js +25 -0
  36. package/apps/server/dist/env/env.module.js.map +1 -0
  37. package/apps/server/dist/env/env.service.d.ts +21 -0
  38. package/apps/server/dist/env/env.service.js +194 -0
  39. package/apps/server/dist/env/env.service.js.map +1 -0
  40. package/apps/server/dist/preview/preview.controller.d.ts +5 -0
  41. package/apps/server/dist/preview/preview.controller.js +41 -0
  42. package/apps/server/dist/preview/preview.controller.js.map +1 -1
  43. package/apps/server/dist/preview/preview.service.d.ts +20 -0
  44. package/apps/server/dist/preview/preview.service.js +51 -2
  45. package/apps/server/dist/preview/preview.service.js.map +1 -1
  46. package/apps/server/dist/project/project.controller.d.ts +10 -1
  47. package/apps/server/dist/project/project.controller.js +57 -0
  48. package/apps/server/dist/project/project.controller.js.map +1 -1
  49. package/apps/server/dist/project/project.service.d.ts +15 -0
  50. package/apps/server/dist/project/project.service.js +111 -0
  51. package/apps/server/dist/project/project.service.js.map +1 -1
  52. package/apps/server/dist/project-context/project-context.controller.d.ts +42 -0
  53. package/apps/server/dist/project-context/project-context.controller.js +127 -0
  54. package/apps/server/dist/project-context/project-context.controller.js.map +1 -0
  55. package/apps/server/dist/project-context/project-context.module.d.ts +2 -0
  56. package/apps/server/dist/project-context/project-context.module.js +25 -0
  57. package/apps/server/dist/project-context/project-context.module.js.map +1 -0
  58. package/apps/server/dist/project-context/project-context.service.d.ts +36 -0
  59. package/apps/server/dist/project-context/project-context.service.js +260 -0
  60. package/apps/server/dist/project-context/project-context.service.js.map +1 -0
  61. package/apps/server/dist/testing/testing.controller.d.ts +24 -0
  62. package/apps/server/dist/testing/testing.controller.js +126 -0
  63. package/apps/server/dist/testing/testing.controller.js.map +1 -0
  64. package/apps/server/dist/testing/testing.module.d.ts +2 -0
  65. package/apps/server/dist/testing/testing.module.js +26 -0
  66. package/apps/server/dist/testing/testing.module.js.map +1 -0
  67. package/apps/server/dist/testing/testing.service.d.ts +62 -0
  68. package/apps/server/dist/testing/testing.service.js +269 -0
  69. package/apps/server/dist/testing/testing.service.js.map +1 -0
  70. package/apps/server/dist/tsconfig.tsbuildinfo +1 -1
  71. package/apps/server/package.json +1 -1
  72. package/apps/web/.next/BUILD_ID +1 -1
  73. package/apps/web/.next/app-build-manifest.json +5 -5
  74. package/apps/web/.next/build-manifest.json +2 -2
  75. package/apps/web/.next/cache/.previewinfo +1 -1
  76. package/apps/web/.next/cache/.rscinfo +1 -1
  77. package/apps/web/.next/cache/.tsbuildinfo +1 -1
  78. package/apps/web/.next/cache/config.json +3 -3
  79. package/apps/web/.next/cache/eslint/.cache_j3uhuz +1 -1
  80. package/apps/web/.next/cache/webpack/client-production/0.pack +0 -0
  81. package/apps/web/.next/cache/webpack/client-production/index.pack +0 -0
  82. package/apps/web/.next/cache/webpack/edge-server-production/index.pack +0 -0
  83. package/apps/web/.next/cache/webpack/server-production/0.pack +0 -0
  84. package/apps/web/.next/cache/webpack/server-production/index.pack +0 -0
  85. package/apps/web/.next/prerender-manifest.json +10 -10
  86. package/apps/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  87. package/apps/web/.next/server/app/_not-found.html +1 -1
  88. package/apps/web/.next/server/app/_not-found.rsc +2 -2
  89. package/apps/web/.next/server/app/index.html +1 -1
  90. package/apps/web/.next/server/app/index.rsc +3 -3
  91. package/apps/web/.next/server/app/page.js +2 -2
  92. package/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
  93. package/apps/web/.next/server/app/project/[id]/page.js +2 -2
  94. package/apps/web/.next/server/app/project/[id]/page_client-reference-manifest.js +1 -1
  95. package/apps/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  96. package/apps/web/.next/server/app/settings.html +1 -1
  97. package/apps/web/.next/server/app/settings.rsc +3 -3
  98. package/apps/web/.next/server/chunks/392.js +1 -1
  99. package/apps/web/.next/server/pages/404.html +1 -1
  100. package/apps/web/.next/server/pages/500.html +1 -1
  101. package/apps/web/.next/server/server-reference-manifest.json +1 -1
  102. package/apps/web/.next/static/chunks/574-1fe2bcd6cfb41646.js +1 -0
  103. package/apps/web/.next/static/chunks/app/page-f19cfa58541ca83d.js +1 -0
  104. package/apps/web/.next/static/chunks/app/project/[id]/page-dffaa1d02f012216.js +1 -0
  105. package/apps/web/.next/static/chunks/app/settings/page-d1318c2fd58729a5.js +1 -0
  106. package/apps/web/.next/static/css/0a24552d9794f8c8.css +3 -0
  107. package/apps/web/.next/trace +18 -17
  108. package/apps/web/node_modules/.bin/eslint +2 -2
  109. package/apps/web/package.json +2 -1
  110. package/apps/web/src/components/checkpoint/CheckpointPanel.tsx +384 -0
  111. package/apps/web/src/components/database/DatabasePanel.tsx +405 -0
  112. package/apps/web/src/components/env/EnvPanel.tsx +356 -0
  113. package/apps/web/src/components/preview/ConsoleViewer.tsx +270 -0
  114. package/apps/web/src/components/preview/ErrorOverlay.tsx +189 -0
  115. package/apps/web/src/components/preview/PreviewPanel.tsx +148 -6
  116. package/apps/web/src/components/testing/TestRunner.tsx +481 -0
  117. package/apps/web/src/components/ui/tabs.tsx +55 -0
  118. package/apps/web/src/components/visual-editor/VisualEditor.tsx +382 -0
  119. package/apps/web/src/components/workspace/WorkspaceLayout.tsx +66 -4
  120. package/apps/web/src/lib/api.ts +5 -2
  121. package/package.json +1 -1
  122. package/apps/web/.next/static/chunks/298-6f3d6b321c288cd3.js +0 -1
  123. package/apps/web/.next/static/chunks/app/page-3d093f7f480a8599.js +0 -1
  124. package/apps/web/.next/static/chunks/app/project/[id]/page-e5cda6f9050b0a52.js +0 -1
  125. package/apps/web/.next/static/chunks/app/settings/page-92d28565c3d8c755.js +0 -1
  126. package/apps/web/.next/static/css/8f946046a2047594.css +0 -3
  127. /package/apps/web/.next/static/{aXT20mSdxaem1-z8VH2F1 → mkY_TTl_ho_ehDKiX10AN}/_buildManifest.js +0 -0
  128. /package/apps/web/.next/static/{aXT20mSdxaem1-z8VH2F1 → mkY_TTl_ho_ehDKiX10AN}/_ssgManifest.js +0 -0
@@ -1,6 +1,14 @@
1
1
  import { PrismaService } from "../prisma/prisma.service";
2
2
  import { CreateProjectDto } from "./dto/create-project.dto";
3
3
  import { SettingsService } from "../settings/settings.service";
4
+ export interface EnvVariable {
5
+ key: string;
6
+ value: string;
7
+ }
8
+ export interface EnvFile {
9
+ path: string;
10
+ variables: EnvVariable[];
11
+ }
4
12
  export declare class ProjectService {
5
13
  private prisma;
6
14
  private settingsService;
@@ -36,4 +44,11 @@ export declare class ProjectService {
36
44
  }>;
37
45
  remove(id: string): Promise<void>;
38
46
  getProjectPath(id: string): Promise<string>;
47
+ getEnvFiles(projectId: string): Promise<EnvFile[]>;
48
+ private findEnvFilesInDir;
49
+ private parseEnvFile;
50
+ getEnvFile(projectId: string, envPath: string): Promise<EnvFile>;
51
+ updateEnvFile(projectId: string, envPath: string, variables: EnvVariable[]): Promise<EnvFile>;
52
+ createEnvFile(projectId: string, envPath: string, variables: EnvVariable[]): Promise<EnvFile>;
53
+ deleteEnvVariable(projectId: string, envPath: string, key: string): Promise<EnvFile>;
39
54
  }
@@ -78,6 +78,117 @@ let ProjectService = class ProjectService {
78
78
  getProjectPath(id) {
79
79
  return this.findOne(id).then((project) => project.path);
80
80
  }
81
+ async getEnvFiles(projectId) {
82
+ const project = await this.findOne(projectId);
83
+ const projectPath = project.path;
84
+ const envFiles = [];
85
+ const rootEnvFiles = await this.findEnvFilesInDir(projectPath, "");
86
+ const frontendPath = path.join(projectPath, "frontend");
87
+ const backendPath = path.join(projectPath, "backend");
88
+ try {
89
+ await fs.access(frontendPath);
90
+ const frontendEnvFiles = await this.findEnvFilesInDir(frontendPath, "frontend");
91
+ envFiles.push(...frontendEnvFiles);
92
+ }
93
+ catch {
94
+ }
95
+ try {
96
+ await fs.access(backendPath);
97
+ const backendEnvFiles = await this.findEnvFilesInDir(backendPath, "backend");
98
+ envFiles.push(...backendEnvFiles);
99
+ }
100
+ catch {
101
+ }
102
+ if (envFiles.length === 0) {
103
+ envFiles.push(...rootEnvFiles);
104
+ }
105
+ return envFiles;
106
+ }
107
+ async findEnvFilesInDir(dirPath, prefix) {
108
+ const envFiles = [];
109
+ const envFileNames = [".env", ".env.local", ".env.development", ".env.production"];
110
+ for (const fileName of envFileNames) {
111
+ const filePath = path.join(dirPath, fileName);
112
+ try {
113
+ await fs.access(filePath);
114
+ const content = await fs.readFile(filePath, "utf-8");
115
+ const variables = this.parseEnvFile(content);
116
+ envFiles.push({
117
+ path: prefix ? `${prefix}/${fileName}` : fileName,
118
+ variables,
119
+ });
120
+ }
121
+ catch {
122
+ }
123
+ }
124
+ return envFiles;
125
+ }
126
+ parseEnvFile(content) {
127
+ const variables = [];
128
+ const lines = content.split("\n");
129
+ for (const line of lines) {
130
+ const trimmed = line.trim();
131
+ if (!trimmed || trimmed.startsWith("#")) {
132
+ continue;
133
+ }
134
+ const match = trimmed.match(/^([^=]+)=(.*)$/);
135
+ if (match) {
136
+ const key = match[1].trim();
137
+ let value = match[2].trim();
138
+ if ((value.startsWith('"') && value.endsWith('"')) ||
139
+ (value.startsWith("'") && value.endsWith("'"))) {
140
+ value = value.slice(1, -1);
141
+ }
142
+ variables.push({ key, value });
143
+ }
144
+ }
145
+ return variables;
146
+ }
147
+ async getEnvFile(projectId, envPath) {
148
+ const project = await this.findOne(projectId);
149
+ const filePath = path.join(project.path, envPath);
150
+ try {
151
+ const content = await fs.readFile(filePath, "utf-8");
152
+ const variables = this.parseEnvFile(content);
153
+ return { path: envPath, variables };
154
+ }
155
+ catch {
156
+ throw new common_1.NotFoundException(`Env file not found: ${envPath}`);
157
+ }
158
+ }
159
+ async updateEnvFile(projectId, envPath, variables) {
160
+ const project = await this.findOne(projectId);
161
+ const filePath = path.join(project.path, envPath);
162
+ const content = variables
163
+ .map(({ key, value }) => {
164
+ if (value.includes(" ") || value.includes("=") || value.includes("#")) {
165
+ return `${key}="${value}"`;
166
+ }
167
+ return `${key}=${value}`;
168
+ })
169
+ .join("\n");
170
+ await fs.writeFile(filePath, content + "\n", "utf-8");
171
+ return { path: envPath, variables };
172
+ }
173
+ async createEnvFile(projectId, envPath, variables) {
174
+ const project = await this.findOne(projectId);
175
+ const filePath = path.join(project.path, envPath);
176
+ try {
177
+ await fs.access(filePath);
178
+ throw new Error(`Env file already exists: ${envPath}`);
179
+ }
180
+ catch (e) {
181
+ if (e.code !== "ENOENT") {
182
+ throw e;
183
+ }
184
+ }
185
+ return this.updateEnvFile(projectId, envPath, variables);
186
+ }
187
+ async deleteEnvVariable(projectId, envPath, key) {
188
+ const envFile = await this.getEnvFile(projectId, envPath);
189
+ const variables = envFile.variables.filter((v) => v.key !== key);
190
+ return this.updateEnvFile(projectId, envPath, variables);
191
+ }
81
192
  };
82
193
  exports.ProjectService = ProjectService;
83
194
  exports.ProjectService = ProjectService = __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"project.service.js","sourceRoot":"","sources":["../../src/project/project.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA+D;AAC/D,6DAAyD;AAEzD,mEAA+D;AAC/D,mCAAoC;AACpC,6BAA6B;AAC7B,kCAAkC;AAG3B,IAAM,cAAc,GAApB,MAAM,cAAc;IACzB,YACU,MAAqB,EACrB,eAAgC;QADhC,WAAM,GAAN,MAAM,CAAe;QACrB,oBAAe,GAAf,eAAe,CAAiB;IACvC,CAAC;IAEJ,KAAK,CAAC,OAAO;QACX,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC;YAClC,OAAO,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE;YAC9B,MAAM,EAAE;gBACN,EAAE,EAAE,IAAI;gBACR,IAAI,EAAE,IAAI;gBACV,WAAW,EAAE,IAAI;gBACjB,gBAAg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D,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC;QACjE,OAAO,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;IAC3D,CAAC;CACF,CAAA;AAjPY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,mBAAU,GAAE;qCAGO,8BAAa;QACJ,kCAAe;GAH/B,cAAc,CAiP1B"}
@@ -0,0 +1,42 @@
1
+ import { ProjectContextService } from "./project-context.service";
2
+ interface CreateContextDto {
3
+ content?: string;
4
+ }
5
+ interface UpdateContextDto {
6
+ content: string;
7
+ }
8
+ interface GenerateContextDto {
9
+ name: string;
10
+ projectType: string;
11
+ backendFramework?: string;
12
+ description?: string;
13
+ }
14
+ export declare class ProjectContextController {
15
+ private readonly projectContextService;
16
+ constructor(projectContextService: ProjectContextService);
17
+ getContext(projectId: string): Promise<{
18
+ exists: boolean;
19
+ content: string | null;
20
+ }>;
21
+ getContextParsed(projectId: string): Promise<{
22
+ exists: boolean;
23
+ context: import("./project-context.service").ProjectContext | null;
24
+ }>;
25
+ hasContext(projectId: string): Promise<{
26
+ exists: boolean;
27
+ }>;
28
+ getTemplate(): {
29
+ template: string;
30
+ };
31
+ createContext(projectId: string, dto: CreateContextDto): Promise<{
32
+ content: string;
33
+ }>;
34
+ generateContext(projectId: string, dto: GenerateContextDto): Promise<{
35
+ content: string;
36
+ }>;
37
+ updateContext(projectId: string, dto: UpdateContextDto): Promise<{
38
+ content: string;
39
+ }>;
40
+ deleteContext(projectId: string): Promise<void>;
41
+ }
42
+ export {};
@@ -0,0 +1,127 @@
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.ProjectContextController = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const project_context_service_1 = require("./project-context.service");
18
+ let ProjectContextController = class ProjectContextController {
19
+ constructor(projectContextService) {
20
+ this.projectContextService = projectContextService;
21
+ }
22
+ async getContext(projectId) {
23
+ const content = await this.projectContextService.getContext(projectId);
24
+ const exists = content !== null;
25
+ return {
26
+ exists,
27
+ content,
28
+ };
29
+ }
30
+ async getContextParsed(projectId) {
31
+ const parsed = await this.projectContextService.getContextParsed(projectId);
32
+ return {
33
+ exists: parsed !== null,
34
+ context: parsed,
35
+ };
36
+ }
37
+ async hasContext(projectId) {
38
+ const exists = await this.projectContextService.hasContext(projectId);
39
+ return { exists };
40
+ }
41
+ getTemplate() {
42
+ return {
43
+ template: this.projectContextService.getDefaultTemplate(),
44
+ };
45
+ }
46
+ async createContext(projectId, dto) {
47
+ const content = await this.projectContextService.createContext(projectId, dto.content);
48
+ return { content };
49
+ }
50
+ async generateContext(projectId, dto) {
51
+ const content = this.projectContextService.generateContextFromProject(dto.name, dto.projectType, dto.backendFramework || null, dto.description);
52
+ await this.projectContextService.createContext(projectId, content);
53
+ return { content };
54
+ }
55
+ async updateContext(projectId, dto) {
56
+ const content = await this.projectContextService.updateContext(projectId, dto.content);
57
+ return { content };
58
+ }
59
+ async deleteContext(projectId) {
60
+ await this.projectContextService.deleteContext(projectId);
61
+ }
62
+ };
63
+ exports.ProjectContextController = ProjectContextController;
64
+ __decorate([
65
+ (0, common_1.Get)(),
66
+ __param(0, (0, common_1.Param)("projectId")),
67
+ __metadata("design:type", Function),
68
+ __metadata("design:paramtypes", [String]),
69
+ __metadata("design:returntype", Promise)
70
+ ], ProjectContextController.prototype, "getContext", null);
71
+ __decorate([
72
+ (0, common_1.Get)("parsed"),
73
+ __param(0, (0, common_1.Param)("projectId")),
74
+ __metadata("design:type", Function),
75
+ __metadata("design:paramtypes", [String]),
76
+ __metadata("design:returntype", Promise)
77
+ ], ProjectContextController.prototype, "getContextParsed", null);
78
+ __decorate([
79
+ (0, common_1.Get)("exists"),
80
+ __param(0, (0, common_1.Param)("projectId")),
81
+ __metadata("design:type", Function),
82
+ __metadata("design:paramtypes", [String]),
83
+ __metadata("design:returntype", Promise)
84
+ ], ProjectContextController.prototype, "hasContext", null);
85
+ __decorate([
86
+ (0, common_1.Get)("template"),
87
+ __metadata("design:type", Function),
88
+ __metadata("design:paramtypes", []),
89
+ __metadata("design:returntype", void 0)
90
+ ], ProjectContextController.prototype, "getTemplate", null);
91
+ __decorate([
92
+ (0, common_1.Post)(),
93
+ __param(0, (0, common_1.Param)("projectId")),
94
+ __param(1, (0, common_1.Body)()),
95
+ __metadata("design:type", Function),
96
+ __metadata("design:paramtypes", [String, Object]),
97
+ __metadata("design:returntype", Promise)
98
+ ], ProjectContextController.prototype, "createContext", null);
99
+ __decorate([
100
+ (0, common_1.Post)("generate"),
101
+ __param(0, (0, common_1.Param)("projectId")),
102
+ __param(1, (0, common_1.Body)()),
103
+ __metadata("design:type", Function),
104
+ __metadata("design:paramtypes", [String, Object]),
105
+ __metadata("design:returntype", Promise)
106
+ ], ProjectContextController.prototype, "generateContext", null);
107
+ __decorate([
108
+ (0, common_1.Put)(),
109
+ __param(0, (0, common_1.Param)("projectId")),
110
+ __param(1, (0, common_1.Body)()),
111
+ __metadata("design:type", Function),
112
+ __metadata("design:paramtypes", [String, Object]),
113
+ __metadata("design:returntype", Promise)
114
+ ], ProjectContextController.prototype, "updateContext", null);
115
+ __decorate([
116
+ (0, common_1.Delete)(),
117
+ (0, common_1.HttpCode)(common_1.HttpStatus.NO_CONTENT),
118
+ __param(0, (0, common_1.Param)("projectId")),
119
+ __metadata("design:type", Function),
120
+ __metadata("design:paramtypes", [String]),
121
+ __metadata("design:returntype", Promise)
122
+ ], ProjectContextController.prototype, "deleteContext", null);
123
+ exports.ProjectContextController = ProjectContextController = __decorate([
124
+ (0, common_1.Controller)("projects/:projectId/context"),
125
+ __metadata("design:paramtypes", [project_context_service_1.ProjectContextService])
126
+ ], ProjectContextController);
127
+ //# sourceMappingURL=project-context.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-context.controller.js","sourceRoot":"","sources":["../../src/project-context/project-context.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAUwB;AACxB,uEAAkE;AAkB3D,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IACnC,YAA6B,qBAA4C;QAA5C,0BAAqB,GAArB,qBAAqB,CAAuB;IAAG,CAAC;IAMvE,AAAN,KAAK,CAAC,UAAU,CAAqB,SAAiB;QACpD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QACvE,MAAM,MAAM,GAAG,OAAO,KAAK,IAAI,CAAC;QAEhC,OAAO;YACL,MAAM;YACN,OAAO;SACR,CAAC;IACJ,CAAC;IAMK,AAAN,KAAK,CAAC,gBAAgB,CAAqB,SAAiB;QAC1D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;QAC5E,OAAO;YACL,MAAM,EAAE,MAAM,KAAK,IAAI;YACvB,OAAO,EAAE,MAAM;SAChB,CAAC;IACJ,CAAC;IAMK,AAAN,KAAK,CAAC,UAAU,CAAqB,SAAiB;QACpD,MAAM,MAAM,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C,WAAW,CAAC,CAAA;;;;0DAQnC;AAMK;IADL,IAAA,YAAG,EAAC,QAAQ,CAAC;IACU,WAAA,IAAA,cAAK,EAAC,WAAW,CAAC,CAAA;;;;gEAMzC;AAMK;IADL,IAAA,YAAG,EAAC,QAAQ,CAAC;IACI,WAAA,IAAA,cAAK,EAAC,WAAW,CAAC,CAAA;;;;0DAGnC;AAMD;IADC,IAAA,YAAG,EAAC,UAAU,CAAC;;;;2DAKf;AAMK;IADL,IAAA,aAAI,GAAE;IAEJ,WAAA,IAAA,cAAK,EAAC,WAAW,CAAC,CAAA;IAClB,WAAA,IAAA,aAAI,GAAE,CAAA;;;;6DAOR;AAMK;IADL,IAAA,aAAI,EAAC,UAAU,CAAC;IAEd,WAAA,IAAA,cAAK,EAAC,WAAW,CAAC,CAAA;IAClB,WAAA,IAAA,aAAI,GAAE,CAAA;;;;+DAaR;AAMK;IADL,IAAA,YAAG,GAAE;IAEH,WAAA,IAAA,cAAK,EAAC,WAAW,CAAC,CAAA;IAClB,WAAA,IAAA,aAAI,GAAE,CAAA;;;;6DAOR;AAOK;IAFL,IAAA,eAAM,GAAE;IACR,IAAA,iBAAQ,EAAC,mBAAU,CAAC,UAAU,CAAC;IACX,WAAA,IAAA,cAAK,EAAC,WAAW,CAAC,CAAA;;;;6DAEtC;mCA1GU,wBAAwB;IADpC,IAAA,mBAAU,EAAC,6BAA6B,CAAC;qCAEY,+CAAqB;GAD9D,wBAAwB,CA2GpC"}
@@ -0,0 +1,2 @@
1
+ export declare class ProjectContextModule {
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.ProjectContextModule = void 0;
10
+ const common_1 = require("@nestjs/common");
11
+ const project_context_service_1 = require("./project-context.service");
12
+ const project_context_controller_1 = require("./project-context.controller");
13
+ const project_module_1 = require("../project/project.module");
14
+ let ProjectContextModule = class ProjectContextModule {
15
+ };
16
+ exports.ProjectContextModule = ProjectContextModule;
17
+ exports.ProjectContextModule = ProjectContextModule = __decorate([
18
+ (0, common_1.Module)({
19
+ imports: [project_module_1.ProjectModule],
20
+ controllers: [project_context_controller_1.ProjectContextController],
21
+ providers: [project_context_service_1.ProjectContextService],
22
+ exports: [project_context_service_1.ProjectContextService],
23
+ })
24
+ ], ProjectContextModule);
25
+ //# sourceMappingURL=project-context.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-context.module.js","sourceRoot":"","sources":["../../src/project-context/project-context.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,uEAAkE;AAClE,6EAAwE;AACxE,8DAA0D;AAQnD,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;CAAG,CAAA;AAAvB,oDAAoB;+BAApB,oBAAoB;IANhC,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,8BAAa,CAAC;QACxB,WAAW,EAAE,CAAC,qDAAwB,CAAC;QACvC,SAAS,EAAE,CAAC,+CAAqB,CAAC;QAClC,OAAO,EAAE,CAAC,+CAAqB,CAAC;KACjC,CAAC;GACW,oBAAoB,CAAG"}
@@ -0,0 +1,36 @@
1
+ import { ProjectService } from "../project/project.service";
2
+ export interface ProjectContext {
3
+ name: string;
4
+ overview: string;
5
+ techStack: {
6
+ frontend: string[];
7
+ backend: string[];
8
+ database: string[];
9
+ };
10
+ designDirection: {
11
+ style: string;
12
+ colorScheme: string;
13
+ tone: string;
14
+ };
15
+ coreFeatures: string[];
16
+ codingConventions: {
17
+ components: string;
18
+ functions: string;
19
+ files: string;
20
+ };
21
+ agentInstructions: string[];
22
+ }
23
+ export declare class ProjectContextService {
24
+ private projectService;
25
+ constructor(projectService: ProjectService);
26
+ getContext(projectId: string): Promise<string | null>;
27
+ getContextParsed(projectId: string): Promise<ProjectContext | null>;
28
+ createContext(projectId: string, content?: string): Promise<string>;
29
+ updateContext(projectId: string, content: string): Promise<string>;
30
+ deleteContext(projectId: string): Promise<void>;
31
+ hasContext(projectId: string): Promise<boolean>;
32
+ private parseProjectMd;
33
+ private parseListItems;
34
+ getDefaultTemplate(): string;
35
+ generateContextFromProject(name: string, projectType: string, backendFramework: string | null, description?: string): string;
36
+ }
@@ -0,0 +1,260 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ProjectContextService = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const project_service_1 = require("../project/project.service");
15
+ const fs = require("fs/promises");
16
+ const path = require("path");
17
+ const CONTEXT_FILENAME = "PROJECT.md";
18
+ const DEFAULT_CONTEXT_TEMPLATE = `# Project Name
19
+
20
+ ## Overview
21
+ [Project description]
22
+
23
+ ## Tech Stack
24
+ - Frontend: Next.js 15, TypeScript, Tailwind CSS
25
+ - Backend: Express, Prisma, SQLite
26
+ - Auth: NextAuth.js
27
+
28
+ ## Design Direction
29
+ - Style: Minimal, Clean
30
+ - Color Scheme: Blue-based primary
31
+ - Tone: Professional, Trustworthy
32
+
33
+ ## Core Features
34
+ 1. User Authentication
35
+ 2. Dashboard
36
+ 3. ...
37
+
38
+ ## Coding Conventions
39
+ - Components: PascalCase
40
+ - Functions: camelCase
41
+ - Files: kebab-case
42
+
43
+ ## Agent Instructions
44
+ - Respond in Korean
45
+ - Request confirmation at each step
46
+ - Use shadcn/ui components
47
+ `;
48
+ let ProjectContextService = class ProjectContextService {
49
+ constructor(projectService) {
50
+ this.projectService = projectService;
51
+ }
52
+ async getContext(projectId) {
53
+ const projectPath = await this.projectService.getProjectPath(projectId);
54
+ const contextPath = path.join(projectPath, CONTEXT_FILENAME);
55
+ try {
56
+ const content = await fs.readFile(contextPath, "utf-8");
57
+ return content;
58
+ }
59
+ catch {
60
+ return null;
61
+ }
62
+ }
63
+ async getContextParsed(projectId) {
64
+ const content = await this.getContext(projectId);
65
+ if (!content)
66
+ return null;
67
+ return this.parseProjectMd(content);
68
+ }
69
+ async createContext(projectId, content) {
70
+ const projectPath = await this.projectService.getProjectPath(projectId);
71
+ const contextPath = path.join(projectPath, CONTEXT_FILENAME);
72
+ const finalContent = content || DEFAULT_CONTEXT_TEMPLATE;
73
+ await fs.writeFile(contextPath, finalContent, "utf-8");
74
+ return finalContent;
75
+ }
76
+ async updateContext(projectId, content) {
77
+ const projectPath = await this.projectService.getProjectPath(projectId);
78
+ const contextPath = path.join(projectPath, CONTEXT_FILENAME);
79
+ try {
80
+ await fs.access(contextPath);
81
+ }
82
+ catch {
83
+ throw new common_1.NotFoundException(`PROJECT.md not found for project ${projectId}`);
84
+ }
85
+ await fs.writeFile(contextPath, content, "utf-8");
86
+ return content;
87
+ }
88
+ async deleteContext(projectId) {
89
+ const projectPath = await this.projectService.getProjectPath(projectId);
90
+ const contextPath = path.join(projectPath, CONTEXT_FILENAME);
91
+ try {
92
+ await fs.unlink(contextPath);
93
+ }
94
+ catch {
95
+ throw new common_1.NotFoundException(`PROJECT.md not found for project ${projectId}`);
96
+ }
97
+ }
98
+ async hasContext(projectId) {
99
+ const projectPath = await this.projectService.getProjectPath(projectId);
100
+ const contextPath = path.join(projectPath, CONTEXT_FILENAME);
101
+ try {
102
+ await fs.access(contextPath);
103
+ return true;
104
+ }
105
+ catch {
106
+ return false;
107
+ }
108
+ }
109
+ parseProjectMd(content) {
110
+ const lines = content.split("\n");
111
+ const context = {
112
+ name: "",
113
+ overview: "",
114
+ techStack: { frontend: [], backend: [], database: [] },
115
+ designDirection: { style: "", colorScheme: "", tone: "" },
116
+ coreFeatures: [],
117
+ codingConventions: { components: "", functions: "", files: "" },
118
+ agentInstructions: [],
119
+ };
120
+ let currentSection = "";
121
+ let currentContent = [];
122
+ const processSection = () => {
123
+ const text = currentContent.join("\n").trim();
124
+ switch (currentSection.toLowerCase()) {
125
+ case "overview":
126
+ context.overview = text;
127
+ break;
128
+ case "tech stack":
129
+ for (const line of currentContent) {
130
+ if (line.toLowerCase().includes("frontend:")) {
131
+ context.techStack.frontend = this.parseListItems(line.split(":")[1] || "");
132
+ }
133
+ else if (line.toLowerCase().includes("backend:")) {
134
+ context.techStack.backend = this.parseListItems(line.split(":")[1] || "");
135
+ }
136
+ else if (line.toLowerCase().includes("database:") || line.toLowerCase().includes("db:")) {
137
+ context.techStack.database = this.parseListItems(line.split(":")[1] || "");
138
+ }
139
+ }
140
+ break;
141
+ case "design direction":
142
+ for (const line of currentContent) {
143
+ if (line.toLowerCase().includes("style:")) {
144
+ context.designDirection.style = line.split(":")[1]?.trim() || "";
145
+ }
146
+ else if (line.toLowerCase().includes("color")) {
147
+ context.designDirection.colorScheme = line.split(":")[1]?.trim() || "";
148
+ }
149
+ else if (line.toLowerCase().includes("tone:")) {
150
+ context.designDirection.tone = line.split(":")[1]?.trim() || "";
151
+ }
152
+ }
153
+ break;
154
+ case "core features":
155
+ context.coreFeatures = currentContent
156
+ .filter(line => line.match(/^\s*\d+\./))
157
+ .map(line => line.replace(/^\s*\d+\.\s*/, "").trim());
158
+ break;
159
+ case "coding conventions":
160
+ for (const line of currentContent) {
161
+ if (line.toLowerCase().includes("component")) {
162
+ context.codingConventions.components = line.split(":")[1]?.trim() || "";
163
+ }
164
+ else if (line.toLowerCase().includes("function")) {
165
+ context.codingConventions.functions = line.split(":")[1]?.trim() || "";
166
+ }
167
+ else if (line.toLowerCase().includes("file")) {
168
+ context.codingConventions.files = line.split(":")[1]?.trim() || "";
169
+ }
170
+ }
171
+ break;
172
+ case "agent instructions":
173
+ context.agentInstructions = currentContent
174
+ .filter(line => line.match(/^\s*-/))
175
+ .map(line => line.replace(/^\s*-\s*/, "").trim());
176
+ break;
177
+ }
178
+ };
179
+ for (const line of lines) {
180
+ if (line.startsWith("# ") && !context.name) {
181
+ context.name = line.replace("# ", "").trim();
182
+ continue;
183
+ }
184
+ if (line.startsWith("## ")) {
185
+ if (currentSection) {
186
+ processSection();
187
+ }
188
+ currentSection = line.replace("## ", "").trim();
189
+ currentContent = [];
190
+ continue;
191
+ }
192
+ if (currentSection && line.trim()) {
193
+ currentContent.push(line);
194
+ }
195
+ }
196
+ if (currentSection) {
197
+ processSection();
198
+ }
199
+ return context;
200
+ }
201
+ parseListItems(text) {
202
+ return text
203
+ .split(",")
204
+ .map(item => item.trim())
205
+ .filter(item => item.length > 0);
206
+ }
207
+ getDefaultTemplate() {
208
+ return DEFAULT_CONTEXT_TEMPLATE;
209
+ }
210
+ generateContextFromProject(name, projectType, backendFramework, description) {
211
+ const isFullstack = backendFramework && backendFramework !== "NONE";
212
+ let techStack = "";
213
+ if (projectType === "WEB") {
214
+ techStack = "- Frontend: Next.js 15, TypeScript, Tailwind CSS, shadcn/ui";
215
+ if (isFullstack) {
216
+ if (backendFramework === "EXPRESS") {
217
+ techStack += "\n- Backend: Express, Prisma, SQLite";
218
+ }
219
+ else if (backendFramework === "FASTAPI") {
220
+ techStack += "\n- Backend: FastAPI, SQLAlchemy, SQLite";
221
+ }
222
+ }
223
+ }
224
+ return `# ${name}
225
+
226
+ ## Overview
227
+ ${description || "[Project description]"}
228
+
229
+ ## Tech Stack
230
+ ${techStack}
231
+
232
+ ## Design Direction
233
+ - Style: Minimal, Clean
234
+ - Color Scheme: Blue-based primary
235
+ - Tone: Professional, Modern
236
+
237
+ ## Core Features
238
+ 1. [Feature 1]
239
+ 2. [Feature 2]
240
+ 3. [Feature 3]
241
+
242
+ ## Coding Conventions
243
+ - Components: PascalCase
244
+ - Functions: camelCase
245
+ - Files: kebab-case
246
+
247
+ ## Agent Instructions
248
+ - Respond in Korean
249
+ - Request confirmation at each step
250
+ - Use shadcn/ui components
251
+ - Follow incremental building strategy
252
+ `;
253
+ }
254
+ };
255
+ exports.ProjectContextService = ProjectContextService;
256
+ exports.ProjectContextService = ProjectContextService = __decorate([
257
+ (0, common_1.Injectable)(),
258
+ __metadata("design:paramtypes", [project_service_1.ProjectService])
259
+ ], ProjectContextService);
260
+ //# sourceMappingURL=project-context.service.js.map