claudeship 0.2.11 → 0.2.14
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.
- package/apps/server/dist/app.module.js +8 -0
- package/apps/server/dist/app.module.js.map +1 -1
- package/apps/server/dist/chat/prompts/fullstack-express-prompt.d.ts +1 -1
- package/apps/server/dist/chat/prompts/fullstack-express-prompt.js +110 -1
- package/apps/server/dist/chat/prompts/fullstack-express-prompt.js.map +1 -1
- package/apps/server/dist/chat/prompts/fullstack-fastapi-prompt.d.ts +1 -1
- package/apps/server/dist/chat/prompts/fullstack-fastapi-prompt.js +110 -1
- package/apps/server/dist/chat/prompts/fullstack-fastapi-prompt.js.map +1 -1
- package/apps/server/dist/chat/prompts/web-system-prompt.d.ts +1 -1
- package/apps/server/dist/chat/prompts/web-system-prompt.js +157 -0
- package/apps/server/dist/chat/prompts/web-system-prompt.js.map +1 -1
- package/apps/server/dist/checkpoint/checkpoint.controller.d.ts +19 -0
- package/apps/server/dist/checkpoint/checkpoint.controller.js +93 -0
- package/apps/server/dist/checkpoint/checkpoint.controller.js.map +1 -0
- package/apps/server/dist/checkpoint/checkpoint.module.d.ts +2 -0
- package/apps/server/dist/checkpoint/checkpoint.module.js +25 -0
- package/apps/server/dist/checkpoint/checkpoint.module.js.map +1 -0
- package/apps/server/dist/checkpoint/checkpoint.service.d.ts +41 -0
- package/apps/server/dist/checkpoint/checkpoint.service.js +261 -0
- package/apps/server/dist/checkpoint/checkpoint.service.js.map +1 -0
- package/apps/server/dist/database/database.controller.d.ts +23 -0
- package/apps/server/dist/database/database.controller.js +109 -0
- package/apps/server/dist/database/database.controller.js.map +1 -0
- package/apps/server/dist/database/database.module.d.ts +2 -0
- package/apps/server/dist/database/database.module.js +25 -0
- package/apps/server/dist/database/database.module.js.map +1 -0
- package/apps/server/dist/database/database.service.d.ts +32 -0
- package/apps/server/dist/database/database.service.js +238 -0
- package/apps/server/dist/database/database.service.js.map +1 -0
- package/apps/server/dist/preview/preview.controller.d.ts +5 -0
- package/apps/server/dist/preview/preview.controller.js +41 -0
- package/apps/server/dist/preview/preview.controller.js.map +1 -1
- package/apps/server/dist/preview/preview.service.d.ts +20 -0
- package/apps/server/dist/preview/preview.service.js +51 -2
- package/apps/server/dist/preview/preview.service.js.map +1 -1
- package/apps/server/dist/project/project.controller.d.ts +10 -1
- package/apps/server/dist/project/project.controller.js +57 -0
- package/apps/server/dist/project/project.controller.js.map +1 -1
- package/apps/server/dist/project/project.service.d.ts +15 -0
- package/apps/server/dist/project/project.service.js +111 -0
- package/apps/server/dist/project/project.service.js.map +1 -1
- package/apps/server/dist/project-context/project-context.controller.d.ts +42 -0
- package/apps/server/dist/project-context/project-context.controller.js +127 -0
- package/apps/server/dist/project-context/project-context.controller.js.map +1 -0
- package/apps/server/dist/project-context/project-context.module.d.ts +2 -0
- package/apps/server/dist/project-context/project-context.module.js +25 -0
- package/apps/server/dist/project-context/project-context.module.js.map +1 -0
- package/apps/server/dist/project-context/project-context.service.d.ts +36 -0
- package/apps/server/dist/project-context/project-context.service.js +260 -0
- package/apps/server/dist/project-context/project-context.service.js.map +1 -0
- package/apps/server/dist/testing/testing.controller.d.ts +24 -0
- package/apps/server/dist/testing/testing.controller.js +126 -0
- package/apps/server/dist/testing/testing.controller.js.map +1 -0
- package/apps/server/dist/testing/testing.module.d.ts +2 -0
- package/apps/server/dist/testing/testing.module.js +26 -0
- package/apps/server/dist/testing/testing.module.js.map +1 -0
- package/apps/server/dist/testing/testing.service.d.ts +62 -0
- package/apps/server/dist/testing/testing.service.js +269 -0
- package/apps/server/dist/testing/testing.service.js.map +1 -0
- package/apps/server/dist/tsconfig.tsbuildinfo +1 -1
- package/apps/server/package.json +1 -1
- package/apps/web/.next/BUILD_ID +1 -1
- package/apps/web/.next/app-build-manifest.json +7 -7
- package/apps/web/.next/app-path-routes-manifest.json +2 -2
- package/apps/web/.next/build-manifest.json +2 -2
- package/apps/web/.next/cache/.previewinfo +1 -1
- package/apps/web/.next/cache/.rscinfo +1 -1
- package/apps/web/.next/cache/.tsbuildinfo +1 -1
- package/apps/web/.next/cache/config.json +3 -3
- package/apps/web/.next/cache/eslint/.cache_j3uhuz +1 -1
- package/apps/web/.next/cache/webpack/client-production/0.pack +0 -0
- package/apps/web/.next/cache/webpack/client-production/index.pack +0 -0
- package/apps/web/.next/cache/webpack/edge-server-production/index.pack +0 -0
- package/apps/web/.next/cache/webpack/server-production/0.pack +0 -0
- package/apps/web/.next/cache/webpack/server-production/index.pack +0 -0
- package/apps/web/.next/prerender-manifest.json +13 -13
- package/apps/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/apps/web/.next/server/app/_not-found.html +1 -1
- package/apps/web/.next/server/app/_not-found.rsc +2 -2
- package/apps/web/.next/server/app/index.html +1 -1
- package/apps/web/.next/server/app/index.rsc +3 -3
- package/apps/web/.next/server/app/page.js +2 -2
- package/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/apps/web/.next/server/app/project/[id]/page.js +2 -2
- package/apps/web/.next/server/app/project/[id]/page_client-reference-manifest.js +1 -1
- package/apps/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/apps/web/.next/server/app/settings.html +1 -1
- package/apps/web/.next/server/app/settings.rsc +3 -3
- package/apps/web/.next/server/app-paths-manifest.json +2 -2
- package/apps/web/.next/server/chunks/392.js +1 -1
- package/apps/web/.next/server/pages/404.html +1 -1
- package/apps/web/.next/server/pages/500.html +1 -1
- package/apps/web/.next/server/server-reference-manifest.json +1 -1
- package/apps/web/.next/static/chunks/712-11fca77fb30a2a06.js +1 -0
- package/apps/web/.next/static/chunks/app/page-0db1c152fbd48359.js +1 -0
- package/apps/web/.next/static/chunks/app/project/[id]/page-7c44ae18c8984726.js +1 -0
- package/apps/web/.next/static/chunks/app/settings/page-d1318c2fd58729a5.js +1 -0
- package/apps/web/.next/static/css/d0f1b036f222bc16.css +3 -0
- package/apps/web/.next/trace +18 -17
- package/apps/web/node_modules/.bin/eslint +2 -2
- package/apps/web/package.json +2 -1
- package/apps/web/src/components/checkpoint/CheckpointPanel.tsx +384 -0
- package/apps/web/src/components/database/DatabasePanel.tsx +405 -0
- package/apps/web/src/components/env/EnvPanel.tsx +356 -0
- package/apps/web/src/components/preview/ConsoleViewer.tsx +270 -0
- package/apps/web/src/components/preview/ErrorOverlay.tsx +189 -0
- package/apps/web/src/components/preview/PreviewPanel.tsx +148 -6
- package/apps/web/src/components/testing/TestRunner.tsx +481 -0
- package/apps/web/src/components/ui/tabs.tsx +55 -0
- package/apps/web/src/components/visual-editor/VisualEditor.tsx +382 -0
- package/apps/web/src/lib/api.ts +5 -2
- package/package.json +1 -1
- package/apps/web/.next/static/chunks/298-6f3d6b321c288cd3.js +0 -1
- package/apps/web/.next/static/chunks/app/page-3d093f7f480a8599.js +0 -1
- package/apps/web/.next/static/chunks/app/project/[id]/page-e5cda6f9050b0a52.js +0 -1
- package/apps/web/.next/static/chunks/app/settings/page-92d28565c3d8c755.js +0 -1
- package/apps/web/.next/static/css/8f946046a2047594.css +0 -3
- /package/apps/web/.next/static/{zw4FcukMOho6_dzgpEdNW → tV_Qc76rupeogXvWEMw6p}/_buildManifest.js +0 -0
- /package/apps/web/.next/static/{zw4FcukMOho6_dzgpEdNW → tV_Qc76rupeogXvWEMw6p}/_ssgManifest.js +0 -0
|
@@ -10,6 +10,78 @@ exports.WEB_SYSTEM_PROMPT = `You are an expert web developer building production
|
|
|
10
10
|
3. **Complete Implementation**: Include all necessary files, not just snippets
|
|
11
11
|
4. **User Experience First**: Add loading states, error handling, and smooth interactions
|
|
12
12
|
|
|
13
|
+
## Requirements Clarification (IMPORTANT)
|
|
14
|
+
|
|
15
|
+
Before implementing any feature, ask clarifying questions to understand the full requirements:
|
|
16
|
+
|
|
17
|
+
### When to Ask
|
|
18
|
+
- New feature requests that could be implemented multiple ways
|
|
19
|
+
- Ambiguous requirements without clear specifications
|
|
20
|
+
- Features that affect user experience or data structure
|
|
21
|
+
|
|
22
|
+
### What to Clarify
|
|
23
|
+
1. **Purpose**: "What is the main use case for this feature?"
|
|
24
|
+
2. **Scope**: "Which pages/components should this apply to?"
|
|
25
|
+
3. **Design Direction**: "Any preference for style? (minimal/expressive/premium)"
|
|
26
|
+
4. **Data Structure**: "What data does this need to handle?"
|
|
27
|
+
|
|
28
|
+
### Example Response
|
|
29
|
+
\`\`\`
|
|
30
|
+
Before implementing the login feature, I need to clarify:
|
|
31
|
+
- Do you need social login (Google, GitHub)?
|
|
32
|
+
- Should there be a "Forgot Password" feature?
|
|
33
|
+
- Where should users be redirected after login?
|
|
34
|
+
\`\`\`
|
|
35
|
+
|
|
36
|
+
## Incremental Building Strategy
|
|
37
|
+
|
|
38
|
+
Build applications step by step, not all at once:
|
|
39
|
+
|
|
40
|
+
### Build Order
|
|
41
|
+
1. **Foundation First**: Layout, navigation, basic structure
|
|
42
|
+
2. **Core Features**: Main user flows
|
|
43
|
+
3. **Polish**: Error handling, loading states
|
|
44
|
+
4. **Finish**: Style refinements, optimization
|
|
45
|
+
|
|
46
|
+
### Checkpoints
|
|
47
|
+
After completing each phase:
|
|
48
|
+
- Summarize completed work
|
|
49
|
+
- Outline next steps
|
|
50
|
+
- Ask for user feedback
|
|
51
|
+
|
|
52
|
+
### Example Checkpoint
|
|
53
|
+
\`\`\`markdown
|
|
54
|
+
## Phase 1 Complete: Basic Layout
|
|
55
|
+
|
|
56
|
+
Completed:
|
|
57
|
+
- ✅ Header/Navigation
|
|
58
|
+
- ✅ Main layout
|
|
59
|
+
- ✅ Footer
|
|
60
|
+
|
|
61
|
+
Next: Should I implement the login/signup feature?
|
|
62
|
+
\`\`\`
|
|
63
|
+
|
|
64
|
+
## Component-First Building
|
|
65
|
+
|
|
66
|
+
Build individual components, not entire pages at once:
|
|
67
|
+
|
|
68
|
+
### Instead of:
|
|
69
|
+
"Create the entire landing page"
|
|
70
|
+
|
|
71
|
+
### Do This:
|
|
72
|
+
Build in sequence:
|
|
73
|
+
1. Hero section (title, subtitle, CTA button)
|
|
74
|
+
2. Feature grid (3-4 cards)
|
|
75
|
+
3. Testimonials slider
|
|
76
|
+
4. Pricing table
|
|
77
|
+
5. FAQ accordion
|
|
78
|
+
6. Footer
|
|
79
|
+
|
|
80
|
+
Each component should be:
|
|
81
|
+
- Independently testable
|
|
82
|
+
- Reusable with props
|
|
83
|
+
- Responsive by default
|
|
84
|
+
|
|
13
85
|
## Technology Stack (REQUIRED)
|
|
14
86
|
|
|
15
87
|
| Category | Technology | Notes |
|
|
@@ -63,6 +135,60 @@ hooks/ # Custom React hooks
|
|
|
63
135
|
types/ # TypeScript type definitions
|
|
64
136
|
\`\`\`
|
|
65
137
|
|
|
138
|
+
## SEO Best Practices (Auto-Include)
|
|
139
|
+
|
|
140
|
+
Every page MUST include proper SEO elements:
|
|
141
|
+
|
|
142
|
+
### Metadata
|
|
143
|
+
\`\`\`tsx
|
|
144
|
+
export const metadata: Metadata = {
|
|
145
|
+
title: "Page Title | Site Name", // Max 60 chars
|
|
146
|
+
description: "Page description", // Max 160 chars
|
|
147
|
+
openGraph: {
|
|
148
|
+
title: "...",
|
|
149
|
+
description: "...",
|
|
150
|
+
images: ["/og-image.png"],
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
\`\`\`
|
|
154
|
+
|
|
155
|
+
### Semantic HTML
|
|
156
|
+
- One \`<h1>\` per page
|
|
157
|
+
- Hierarchical headings (h1 → h2 → h3)
|
|
158
|
+
- Use \`<main>\`, \`<nav>\`, \`<article>\`, \`<section>\`
|
|
159
|
+
- Alt text for all images
|
|
160
|
+
|
|
161
|
+
### Accessibility
|
|
162
|
+
- Keyboard navigation support
|
|
163
|
+
- ARIA labels where needed
|
|
164
|
+
- Color contrast ratio 4.5:1 minimum
|
|
165
|
+
|
|
166
|
+
## Content Guidelines
|
|
167
|
+
|
|
168
|
+
### Never Use Dummy Text
|
|
169
|
+
- ❌ "Lorem ipsum dolor sit amet"
|
|
170
|
+
- ❌ "Feature 1", "Feature 2"
|
|
171
|
+
- ❌ "Click here"
|
|
172
|
+
|
|
173
|
+
### Always Use Meaningful Content
|
|
174
|
+
- ✅ Actual feature descriptions
|
|
175
|
+
- ✅ Clear CTA text
|
|
176
|
+
- ✅ Realistic example data
|
|
177
|
+
|
|
178
|
+
### Example
|
|
179
|
+
\`\`\`tsx
|
|
180
|
+
// BAD
|
|
181
|
+
<Button>Click here</Button>
|
|
182
|
+
<Card title="Feature 1" description="Lorem ipsum..." />
|
|
183
|
+
|
|
184
|
+
// GOOD
|
|
185
|
+
<Button>Get Started Free</Button>
|
|
186
|
+
<Card
|
|
187
|
+
title="Real-time Collaboration"
|
|
188
|
+
description="Edit documents together with your team and see changes instantly."
|
|
189
|
+
/>
|
|
190
|
+
\`\`\`
|
|
191
|
+
|
|
66
192
|
## UI/UX Requirements
|
|
67
193
|
|
|
68
194
|
### Layout
|
|
@@ -254,10 +380,41 @@ The marker will automatically trigger a restart and won't be visible to the user
|
|
|
254
380
|
- [ ] Proper file structure followed
|
|
255
381
|
- [ ] No placeholder comments like "// TODO" or "// implement later"
|
|
256
382
|
|
|
383
|
+
## Debugging Process
|
|
384
|
+
|
|
385
|
+
When errors occur, follow this order:
|
|
386
|
+
|
|
387
|
+
### 1. Check Console Logs
|
|
388
|
+
- Browser console errors
|
|
389
|
+
- Server log errors (use Console tab in preview)
|
|
390
|
+
|
|
391
|
+
### 2. Check Network Requests
|
|
392
|
+
- API response status
|
|
393
|
+
- Request/response data
|
|
394
|
+
|
|
395
|
+
### 3. Review Code
|
|
396
|
+
- TypeScript errors
|
|
397
|
+
- Runtime exceptions
|
|
398
|
+
- Async handling issues
|
|
399
|
+
|
|
400
|
+
### 4. Check Environment
|
|
401
|
+
- Environment variables
|
|
402
|
+
- Dependency versions
|
|
403
|
+
|
|
404
|
+
### Error Report Format
|
|
405
|
+
\`\`\`
|
|
406
|
+
Error detected:
|
|
407
|
+
- Location: \`src/components/UserList.tsx:15\`
|
|
408
|
+
- Error: \`Cannot read property 'map' of undefined\`
|
|
409
|
+
- Cause: users data rendered before loading complete
|
|
410
|
+
- Fix: Added loading state check
|
|
411
|
+
\`\`\`
|
|
412
|
+
|
|
257
413
|
## What NOT to Do
|
|
258
414
|
|
|
259
415
|
- **NEVER run \`npm run dev\`, \`npm start\`, or any server-starting commands** - The preview system handles this automatically
|
|
260
416
|
- **NEVER run long-running processes or commands that don't terminate**
|
|
417
|
+
- **NEVER use process control commands** like \`kill\`, \`pkill\`, \`fuser -k\`, \`lsof\` to manage servers - Use \`<restart-preview />\` marker instead
|
|
261
418
|
- Never create CLI tools or scripts
|
|
262
419
|
- Never use inline styles (use Tailwind)
|
|
263
420
|
- Never skip error handling
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-system-prompt.js","sourceRoot":"","sources":["../../../src/chat/prompts/web-system-prompt.ts"],"names":[],"mappings":";;;AAMa,QAAA,iBAAiB,GAAG
|
|
1
|
+
{"version":3,"file":"web-system-prompt.js","sourceRoot":"","sources":["../../../src/chat/prompts/web-system-prompt.ts"],"names":[],"mappings":";;;AAMa,QAAA,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+JAgiB8H,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CheckpointService } from "./checkpoint.service";
|
|
2
|
+
export declare class CheckpointController {
|
|
3
|
+
private readonly checkpointService;
|
|
4
|
+
constructor(checkpointService: CheckpointService);
|
|
5
|
+
getCheckpoints(projectId: string, limit?: string): Promise<import("./checkpoint.service").Checkpoint[]>;
|
|
6
|
+
getStatus(projectId: string): Promise<{
|
|
7
|
+
hasChanges: boolean;
|
|
8
|
+
files: {
|
|
9
|
+
path: string;
|
|
10
|
+
status: string;
|
|
11
|
+
}[];
|
|
12
|
+
}>;
|
|
13
|
+
createCheckpoint(projectId: string, body: {
|
|
14
|
+
message: string;
|
|
15
|
+
}): Promise<import("./checkpoint.service").Checkpoint>;
|
|
16
|
+
autoCheckpoint(projectId: string): Promise<import("./checkpoint.service").Checkpoint | null>;
|
|
17
|
+
getDiff(projectId: string, fromHash: string, toHash?: string): Promise<import("./checkpoint.service").CheckpointDiff>;
|
|
18
|
+
restoreCheckpoint(projectId: string, hash: string): Promise<void>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
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.CheckpointController = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const checkpoint_service_1 = require("./checkpoint.service");
|
|
18
|
+
let CheckpointController = class CheckpointController {
|
|
19
|
+
constructor(checkpointService) {
|
|
20
|
+
this.checkpointService = checkpointService;
|
|
21
|
+
}
|
|
22
|
+
getCheckpoints(projectId, limit) {
|
|
23
|
+
return this.checkpointService.getCheckpoints(projectId, limit ? parseInt(limit, 10) : 50);
|
|
24
|
+
}
|
|
25
|
+
getStatus(projectId) {
|
|
26
|
+
return this.checkpointService.getStatus(projectId);
|
|
27
|
+
}
|
|
28
|
+
createCheckpoint(projectId, body) {
|
|
29
|
+
return this.checkpointService.createCheckpoint(projectId, body.message);
|
|
30
|
+
}
|
|
31
|
+
autoCheckpoint(projectId) {
|
|
32
|
+
return this.checkpointService.autoCheckpoint(projectId);
|
|
33
|
+
}
|
|
34
|
+
getDiff(projectId, fromHash, toHash) {
|
|
35
|
+
return this.checkpointService.getDiff(projectId, fromHash, toHash);
|
|
36
|
+
}
|
|
37
|
+
restoreCheckpoint(projectId, hash) {
|
|
38
|
+
return this.checkpointService.restoreCheckpoint(projectId, hash);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
exports.CheckpointController = CheckpointController;
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, common_1.Get)(),
|
|
44
|
+
__param(0, (0, common_1.Param)("projectId")),
|
|
45
|
+
__param(1, (0, common_1.Query)("limit")),
|
|
46
|
+
__metadata("design:type", Function),
|
|
47
|
+
__metadata("design:paramtypes", [String, String]),
|
|
48
|
+
__metadata("design:returntype", void 0)
|
|
49
|
+
], CheckpointController.prototype, "getCheckpoints", null);
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, common_1.Get)("status"),
|
|
52
|
+
__param(0, (0, common_1.Param)("projectId")),
|
|
53
|
+
__metadata("design:type", Function),
|
|
54
|
+
__metadata("design:paramtypes", [String]),
|
|
55
|
+
__metadata("design:returntype", void 0)
|
|
56
|
+
], CheckpointController.prototype, "getStatus", null);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, common_1.Post)(),
|
|
59
|
+
__param(0, (0, common_1.Param)("projectId")),
|
|
60
|
+
__param(1, (0, common_1.Body)()),
|
|
61
|
+
__metadata("design:type", Function),
|
|
62
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
63
|
+
__metadata("design:returntype", void 0)
|
|
64
|
+
], CheckpointController.prototype, "createCheckpoint", null);
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, common_1.Post)("auto"),
|
|
67
|
+
__param(0, (0, common_1.Param)("projectId")),
|
|
68
|
+
__metadata("design:type", Function),
|
|
69
|
+
__metadata("design:paramtypes", [String]),
|
|
70
|
+
__metadata("design:returntype", void 0)
|
|
71
|
+
], CheckpointController.prototype, "autoCheckpoint", null);
|
|
72
|
+
__decorate([
|
|
73
|
+
(0, common_1.Get)("diff"),
|
|
74
|
+
__param(0, (0, common_1.Param)("projectId")),
|
|
75
|
+
__param(1, (0, common_1.Query)("from")),
|
|
76
|
+
__param(2, (0, common_1.Query)("to")),
|
|
77
|
+
__metadata("design:type", Function),
|
|
78
|
+
__metadata("design:paramtypes", [String, String, String]),
|
|
79
|
+
__metadata("design:returntype", void 0)
|
|
80
|
+
], CheckpointController.prototype, "getDiff", null);
|
|
81
|
+
__decorate([
|
|
82
|
+
(0, common_1.Post)(":hash/restore"),
|
|
83
|
+
__param(0, (0, common_1.Param)("projectId")),
|
|
84
|
+
__param(1, (0, common_1.Param)("hash")),
|
|
85
|
+
__metadata("design:type", Function),
|
|
86
|
+
__metadata("design:paramtypes", [String, String]),
|
|
87
|
+
__metadata("design:returntype", void 0)
|
|
88
|
+
], CheckpointController.prototype, "restoreCheckpoint", null);
|
|
89
|
+
exports.CheckpointController = CheckpointController = __decorate([
|
|
90
|
+
(0, common_1.Controller)("projects/:projectId/checkpoints"),
|
|
91
|
+
__metadata("design:paramtypes", [checkpoint_service_1.CheckpointService])
|
|
92
|
+
], CheckpointController);
|
|
93
|
+
//# sourceMappingURL=checkpoint.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkpoint.controller.js","sourceRoot":"","sources":["../../src/checkpoint/checkpoint.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAOwB;AACxB,6DAAyD;AAGlD,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAC/B,YAA6B,iBAAoC;QAApC,sBAAiB,GAAjB,iBAAiB,CAAmB;IAAG,CAAC;IAGrE,cAAc,CACQ,SAAiB,EACrB,KAAc;QAE9B,OAAO,IAAI,CAAC,iBAAiB,CAAC,cAAc,CAC1C,SAAS,EACT,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CACjC,CAAC;IACJ,CAAC;IAGD,SAAS,CAAqB,SAAiB;QAC7C,OAAO,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IACrD,CAAC;IAGD,gBAAgB,CACM,SAAiB,EAC7B,IAAyB;QAEjC,OAAO,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAC1E,CAAC;IAGD,cAAc,CAAqB,SAAiB;QAClD,OAAO,IAAI,CAAC,iBAAiB,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;IAC1D,CAAC;IAGD,OAAO,CACe,SAAiB,EACtB,QAAgB,EAClB,MAAe;QAE5B,OAAO,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,SAAS,EAA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= 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.CheckpointModule = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
const checkpoint_controller_1 = require("./checkpoint.controller");
|
|
12
|
+
const checkpoint_service_1 = require("./checkpoint.service");
|
|
13
|
+
const project_module_1 = require("../project/project.module");
|
|
14
|
+
let CheckpointModule = class CheckpointModule {
|
|
15
|
+
};
|
|
16
|
+
exports.CheckpointModule = CheckpointModule;
|
|
17
|
+
exports.CheckpointModule = CheckpointModule = __decorate([
|
|
18
|
+
(0, common_1.Module)({
|
|
19
|
+
imports: [project_module_1.ProjectModule],
|
|
20
|
+
controllers: [checkpoint_controller_1.CheckpointController],
|
|
21
|
+
providers: [checkpoint_service_1.CheckpointService],
|
|
22
|
+
exports: [checkpoint_service_1.CheckpointService],
|
|
23
|
+
})
|
|
24
|
+
], CheckpointModule);
|
|
25
|
+
//# sourceMappingURL=checkpoint.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkpoint.module.js","sourceRoot":"","sources":["../../src/checkpoint/checkpoint.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,mEAA+D;AAC/D,6DAAyD;AACzD,8DAA0D;AAQnD,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAAG,CAAA;AAAnB,4CAAgB;2BAAhB,gBAAgB;IAN5B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,8BAAa,CAAC;QACxB,WAAW,EAAE,CAAC,4CAAoB,CAAC;QACnC,SAAS,EAAE,CAAC,sCAAiB,CAAC;QAC9B,OAAO,EAAE,CAAC,sCAAiB,CAAC;KAC7B,CAAC;GACW,gBAAgB,CAAG"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ProjectService } from "../project/project.service";
|
|
2
|
+
export interface Checkpoint {
|
|
3
|
+
id: string;
|
|
4
|
+
hash: string;
|
|
5
|
+
message: string;
|
|
6
|
+
author: string;
|
|
7
|
+
timestamp: number;
|
|
8
|
+
filesChanged: number;
|
|
9
|
+
insertions: number;
|
|
10
|
+
deletions: number;
|
|
11
|
+
}
|
|
12
|
+
export interface CheckpointDiff {
|
|
13
|
+
files: FileDiff[];
|
|
14
|
+
}
|
|
15
|
+
export interface FileDiff {
|
|
16
|
+
path: string;
|
|
17
|
+
status: "added" | "modified" | "deleted";
|
|
18
|
+
additions: number;
|
|
19
|
+
deletions: number;
|
|
20
|
+
diff: string;
|
|
21
|
+
}
|
|
22
|
+
export declare class CheckpointService {
|
|
23
|
+
private projectService;
|
|
24
|
+
private readonly logger;
|
|
25
|
+
constructor(projectService: ProjectService);
|
|
26
|
+
private executeGit;
|
|
27
|
+
private isGitRepo;
|
|
28
|
+
initializeGit(projectId: string): Promise<void>;
|
|
29
|
+
getCheckpoints(projectId: string, limit?: number): Promise<Checkpoint[]>;
|
|
30
|
+
createCheckpoint(projectId: string, message: string): Promise<Checkpoint>;
|
|
31
|
+
autoCheckpoint(projectId: string): Promise<Checkpoint | null>;
|
|
32
|
+
getDiff(projectId: string, fromHash: string, toHash?: string): Promise<CheckpointDiff>;
|
|
33
|
+
restoreCheckpoint(projectId: string, hash: string): Promise<void>;
|
|
34
|
+
getStatus(projectId: string): Promise<{
|
|
35
|
+
hasChanges: boolean;
|
|
36
|
+
files: {
|
|
37
|
+
path: string;
|
|
38
|
+
status: string;
|
|
39
|
+
}[];
|
|
40
|
+
}>;
|
|
41
|
+
}
|
|
@@ -0,0 +1,261 @@
|
|
|
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 CheckpointService_1;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.CheckpointService = void 0;
|
|
14
|
+
const common_1 = require("@nestjs/common");
|
|
15
|
+
const project_service_1 = require("../project/project.service");
|
|
16
|
+
const child_process_1 = require("child_process");
|
|
17
|
+
const fs = require("fs/promises");
|
|
18
|
+
const path = require("path");
|
|
19
|
+
let CheckpointService = CheckpointService_1 = class CheckpointService {
|
|
20
|
+
constructor(projectService) {
|
|
21
|
+
this.projectService = projectService;
|
|
22
|
+
this.logger = new common_1.Logger(CheckpointService_1.name);
|
|
23
|
+
}
|
|
24
|
+
executeGit(projectPath, args) {
|
|
25
|
+
return new Promise((resolve, reject) => {
|
|
26
|
+
const proc = (0, child_process_1.spawn)("git", args, {
|
|
27
|
+
cwd: projectPath,
|
|
28
|
+
shell: true,
|
|
29
|
+
});
|
|
30
|
+
let stdout = "";
|
|
31
|
+
let stderr = "";
|
|
32
|
+
proc.stdout?.on("data", (data) => {
|
|
33
|
+
stdout += data.toString();
|
|
34
|
+
});
|
|
35
|
+
proc.stderr?.on("data", (data) => {
|
|
36
|
+
stderr += data.toString();
|
|
37
|
+
});
|
|
38
|
+
proc.on("close", (code) => {
|
|
39
|
+
if (code === 0) {
|
|
40
|
+
resolve(stdout.trim());
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
reject(new Error(stderr || `git exited with code ${code}`));
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
proc.on("error", (err) => {
|
|
47
|
+
reject(err);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
async isGitRepo(projectPath) {
|
|
52
|
+
const gitDir = path.join(projectPath, ".git");
|
|
53
|
+
try {
|
|
54
|
+
await fs.access(gitDir);
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
async initializeGit(projectId) {
|
|
62
|
+
const projectPath = await this.projectService.getProjectPath(projectId);
|
|
63
|
+
if (await this.isGitRepo(projectPath)) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
await this.executeGit(projectPath, ["init"]);
|
|
67
|
+
await this.executeGit(projectPath, ["config", "user.email", "claudeship@local"]);
|
|
68
|
+
await this.executeGit(projectPath, ["config", "user.name", "ClaudeShip"]);
|
|
69
|
+
await this.executeGit(projectPath, ["add", "-A"]);
|
|
70
|
+
await this.executeGit(projectPath, ["commit", "-m", "Initial checkpoint", "--allow-empty"]);
|
|
71
|
+
}
|
|
72
|
+
async getCheckpoints(projectId, limit = 50) {
|
|
73
|
+
const projectPath = await this.projectService.getProjectPath(projectId);
|
|
74
|
+
if (!(await this.isGitRepo(projectPath))) {
|
|
75
|
+
return [];
|
|
76
|
+
}
|
|
77
|
+
try {
|
|
78
|
+
const logOutput = await this.executeGit(projectPath, [
|
|
79
|
+
"log",
|
|
80
|
+
`--max-count=${limit}`,
|
|
81
|
+
"--format=%H|%s|%an|%at",
|
|
82
|
+
"--shortstat",
|
|
83
|
+
]);
|
|
84
|
+
if (!logOutput) {
|
|
85
|
+
return [];
|
|
86
|
+
}
|
|
87
|
+
const lines = logOutput.split("\n");
|
|
88
|
+
const checkpoints = [];
|
|
89
|
+
let i = 0;
|
|
90
|
+
while (i < lines.length) {
|
|
91
|
+
const line = lines[i].trim();
|
|
92
|
+
if (!line) {
|
|
93
|
+
i++;
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
const [hash, message, author, timestamp] = line.split("|");
|
|
97
|
+
if (!hash || hash.length !== 40) {
|
|
98
|
+
i++;
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
let filesChanged = 0;
|
|
102
|
+
let insertions = 0;
|
|
103
|
+
let deletions = 0;
|
|
104
|
+
if (i + 1 < lines.length) {
|
|
105
|
+
const statLine = lines[i + 1].trim();
|
|
106
|
+
const filesMatch = statLine.match(/(\d+) files? changed/);
|
|
107
|
+
const insertMatch = statLine.match(/(\d+) insertions?\(\+\)/);
|
|
108
|
+
const deleteMatch = statLine.match(/(\d+) deletions?\(-\)/);
|
|
109
|
+
if (filesMatch)
|
|
110
|
+
filesChanged = parseInt(filesMatch[1], 10);
|
|
111
|
+
if (insertMatch)
|
|
112
|
+
insertions = parseInt(insertMatch[1], 10);
|
|
113
|
+
if (deleteMatch)
|
|
114
|
+
deletions = parseInt(deleteMatch[1], 10);
|
|
115
|
+
if (filesMatch || insertMatch || deleteMatch) {
|
|
116
|
+
i++;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
checkpoints.push({
|
|
120
|
+
id: hash.slice(0, 8),
|
|
121
|
+
hash,
|
|
122
|
+
message: message || "No message",
|
|
123
|
+
author: author || "Unknown",
|
|
124
|
+
timestamp: parseInt(timestamp, 10) * 1000,
|
|
125
|
+
filesChanged,
|
|
126
|
+
insertions,
|
|
127
|
+
deletions,
|
|
128
|
+
});
|
|
129
|
+
i++;
|
|
130
|
+
}
|
|
131
|
+
return checkpoints;
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
this.logger.error(`Failed to get checkpoints: ${error}`);
|
|
135
|
+
return [];
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
async createCheckpoint(projectId, message) {
|
|
139
|
+
const projectPath = await this.projectService.getProjectPath(projectId);
|
|
140
|
+
await this.initializeGit(projectId);
|
|
141
|
+
const status = await this.executeGit(projectPath, ["status", "--porcelain"]);
|
|
142
|
+
if (!status) {
|
|
143
|
+
throw new common_1.BadRequestException("No changes to checkpoint");
|
|
144
|
+
}
|
|
145
|
+
await this.executeGit(projectPath, ["add", "-A"]);
|
|
146
|
+
await this.executeGit(projectPath, ["commit", "-m", message]);
|
|
147
|
+
const checkpoints = await this.getCheckpoints(projectId, 1);
|
|
148
|
+
return checkpoints[0];
|
|
149
|
+
}
|
|
150
|
+
async autoCheckpoint(projectId) {
|
|
151
|
+
const projectPath = await this.projectService.getProjectPath(projectId);
|
|
152
|
+
await this.initializeGit(projectId);
|
|
153
|
+
const status = await this.executeGit(projectPath, ["status", "--porcelain"]);
|
|
154
|
+
if (!status) {
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
const timestamp = new Date().toLocaleTimeString();
|
|
158
|
+
const message = `Auto checkpoint at ${timestamp}`;
|
|
159
|
+
return this.createCheckpoint(projectId, message);
|
|
160
|
+
}
|
|
161
|
+
async getDiff(projectId, fromHash, toHash) {
|
|
162
|
+
const projectPath = await this.projectService.getProjectPath(projectId);
|
|
163
|
+
const args = toHash
|
|
164
|
+
? ["diff", fromHash, toHash, "--stat", "--no-color"]
|
|
165
|
+
: ["diff", fromHash, "--stat", "--no-color"];
|
|
166
|
+
try {
|
|
167
|
+
const statOutput = await this.executeGit(projectPath, args);
|
|
168
|
+
const diffArgs = toHash
|
|
169
|
+
? ["diff", fromHash, toHash, "--no-color"]
|
|
170
|
+
: ["diff", fromHash, "--no-color"];
|
|
171
|
+
const diffOutput = await this.executeGit(projectPath, diffArgs);
|
|
172
|
+
const files = [];
|
|
173
|
+
const diffSections = diffOutput.split(/^diff --git/m).filter(Boolean);
|
|
174
|
+
for (const section of diffSections) {
|
|
175
|
+
const pathMatch = section.match(/a\/(.+?) b\//);
|
|
176
|
+
if (!pathMatch)
|
|
177
|
+
continue;
|
|
178
|
+
const filePath = pathMatch[1];
|
|
179
|
+
let status = "modified";
|
|
180
|
+
let additions = 0;
|
|
181
|
+
let deletions = 0;
|
|
182
|
+
if (section.includes("new file mode")) {
|
|
183
|
+
status = "added";
|
|
184
|
+
}
|
|
185
|
+
else if (section.includes("deleted file mode")) {
|
|
186
|
+
status = "deleted";
|
|
187
|
+
}
|
|
188
|
+
const lines = section.split("\n");
|
|
189
|
+
for (const line of lines) {
|
|
190
|
+
if (line.startsWith("+") && !line.startsWith("+++")) {
|
|
191
|
+
additions++;
|
|
192
|
+
}
|
|
193
|
+
else if (line.startsWith("-") && !line.startsWith("---")) {
|
|
194
|
+
deletions++;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
files.push({
|
|
198
|
+
path: filePath,
|
|
199
|
+
status,
|
|
200
|
+
additions,
|
|
201
|
+
deletions,
|
|
202
|
+
diff: "diff --git" + section,
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
return { files };
|
|
206
|
+
}
|
|
207
|
+
catch (error) {
|
|
208
|
+
this.logger.error(`Failed to get diff: ${error}`);
|
|
209
|
+
throw new common_1.BadRequestException("Failed to get diff");
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
async restoreCheckpoint(projectId, hash) {
|
|
213
|
+
const projectPath = await this.projectService.getProjectPath(projectId);
|
|
214
|
+
try {
|
|
215
|
+
await this.createCheckpoint(projectId, `Backup before restore to ${hash.slice(0, 8)}`);
|
|
216
|
+
}
|
|
217
|
+
catch {
|
|
218
|
+
}
|
|
219
|
+
await this.executeGit(projectPath, ["reset", "--hard", hash]);
|
|
220
|
+
}
|
|
221
|
+
async getStatus(projectId) {
|
|
222
|
+
const projectPath = await this.projectService.getProjectPath(projectId);
|
|
223
|
+
if (!(await this.isGitRepo(projectPath))) {
|
|
224
|
+
return { hasChanges: false, files: [] };
|
|
225
|
+
}
|
|
226
|
+
try {
|
|
227
|
+
const status = await this.executeGit(projectPath, ["status", "--porcelain"]);
|
|
228
|
+
if (!status) {
|
|
229
|
+
return { hasChanges: false, files: [] };
|
|
230
|
+
}
|
|
231
|
+
const files = status
|
|
232
|
+
.split("\n")
|
|
233
|
+
.filter(Boolean)
|
|
234
|
+
.map((line) => {
|
|
235
|
+
const statusCode = line.slice(0, 2).trim();
|
|
236
|
+
const filePath = line.slice(3);
|
|
237
|
+
let statusText = "modified";
|
|
238
|
+
if (statusCode === "A" || statusCode === "??") {
|
|
239
|
+
statusText = "added";
|
|
240
|
+
}
|
|
241
|
+
else if (statusCode === "D") {
|
|
242
|
+
statusText = "deleted";
|
|
243
|
+
}
|
|
244
|
+
else if (statusCode === "R") {
|
|
245
|
+
statusText = "renamed";
|
|
246
|
+
}
|
|
247
|
+
return { path: filePath, status: statusText };
|
|
248
|
+
});
|
|
249
|
+
return { hasChanges: files.length > 0, files };
|
|
250
|
+
}
|
|
251
|
+
catch {
|
|
252
|
+
return { hasChanges: false, files: [] };
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
exports.CheckpointService = CheckpointService;
|
|
257
|
+
exports.CheckpointService = CheckpointService = CheckpointService_1 = __decorate([
|
|
258
|
+
(0, common_1.Injectable)(),
|
|
259
|
+
__metadata("design:paramtypes", [project_service_1.ProjectService])
|
|
260
|
+
], CheckpointService);
|
|
261
|
+
//# sourceMappingURL=checkpoint.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkpoint.service.js","sourceRoot":"","sources":["../../src/checkpoint/checkpoint.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAA4F;AAC5F,gEAA4D;AAC5D,iDAAsC;AACtC,kCAAkC;AAClC,6BAA6B;AA0BtB,IAAM,iBAAiB,yBAAvB,MAAM,iBAAiB;IAG5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