-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodebase.txt
More file actions
4755 lines (4069 loc) · 145 KB
/
codebase.txt
File metadata and controls
4755 lines (4069 loc) · 145 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
This file is a merged representation of the entire codebase, combined into a single document by Repomix.
<file_summary>
This section contains a summary of this file.
<purpose>
This file contains a packed representation of the entire repository's contents.
It is designed to be easily consumable by AI systems for analysis, code review,
or other automated processes.
</purpose>
<file_format>
The content is organized as follows:
1. This summary section
2. Repository information
3. Directory structure
4. Repository files (if enabled)
5. Multiple file entries, each consisting of:
- File path as an attribute
- Full contents of the file
</file_format>
<usage_guidelines>
- This file should be treated as read-only. Any changes should be made to the
original repository files, not this packed version.
- When processing this file, use the file path to distinguish
between different files in the repository.
- Be aware that this file may contain sensitive information. Handle it with
the same level of security as you would the original repository.
</usage_guidelines>
<notes>
- Some files may have been excluded based on .gitignore rules and Repomix's configuration
- Binary files are not included in this packed representation. Please refer to the Repository Structure section for a complete list of file paths, including binary files
- Files matching patterns in .gitignore are excluded
- Files matching default ignore patterns are excluded
- Files are sorted by Git change count (files with more changes are at the bottom)
</notes>
</file_summary>
<directory_structure>
.agent/
rules/
frontend-architecture.md
icon-generation-rules.md
implementation-rules.md
main-rule.md
.docs/
frontend-controller-service-fsd.md
.github/
workflows/
deploy
update-codebase.yml
public/
vite.svg
src/
@types/
vite-env.d.ts
entities/
cache/
lib/
cache-service.ts
index.ts
model/
cache-model.ts
index.ts
type.d.ts
form/
lib/
form-signature-state-service.ts
index.ts
question-list-state-service.ts
question-state-service.ts
model/
form-question/
index.ts
option.ts
form-signature/
index.ts
index.ts
type.d.ts
store/
index.ts
use-form-question-list-store.ts
use-form-signature-store.ts
ui/
LongTextQuestionCard/
index.tsx
MultipleChoiceQuestionCard/
index.tsx
ShortTextQuestionCard/
index.tsx
SingleChoiceQuestionCard/
index.tsx
index.ts
README.md
features/
authenticate/
ui/
login-button/
kakao/
index.tsx
index.tsx
index.ts
edit-form/
ui/
FormSignatureEditSection/
hook.ts
index.tsx
QuestionAddSection/
hook.ts
index.tsx
QuestionList/
index.tsx
use-question-list.ts
index.ts
toggle-theme/
ui/
dark-mode-button/
index.tsx
index.ts
pages/
kakao-redirect/
hook.ts
index.tsx
landing/
hook.ts
index.tsx
new-form/
hook.ts
index.tsx
shared/
context/
ToastContext/
index.tsx
index.ts
lib/
axios-manager/
index.ts
env-manager/
index.ts
type-guard/
index.ts
uuid/
index.ts
index.ts
model/
custom-model/
index.ts
index.ts
ui/
iconography/
logo/
kakao-talk/
index.tsx
index.tsx
stroke/
angry/
index.tsx
balance/
index.tsx
dizzy/
index.tsx
Document/
index.tsx
flash/
index.tsx
graduation/
index.tsx
minus/
index.tsx
monitor/
index.tsx
moon/
index.tsx
plus/
index.tsx
rocket/
index.tsx
sad/
index.tsx
sparkles/
index.tsx
sun/
index.tsx
trash/
index.tsx
users/
index.tsx
index.tsx
index.tsx
Toast/
index.tsx
index.ts
styles/
border-radius.css
border-width.css
break-point.css
colors.css
font-weight.css
index.css
App.tsx
main.tsx
.gitignore
.prettierignore
.prettierrc
eslint.config.js
index.html
package.json
README.md
tsconfig.json
vite.config.ts
</directory_structure>
<files>
This section contains the contents of the repository's files.
<file path=".agent/rules/frontend-architecture.md">
---
trigger: always_on
---
# Frontend Architecture Rules (FSD-based)
## 1.0 Core Architectural Principles: Controller-Service Separation (FSD-Based)
The strategic application of a Controller-Service architectural pattern, inspired by backend design and aligned with Feature-Sliced Design (FSD), is a non-negotiable foundation of this project. This separation of concerns is critical for maintaining a scalable, testable, and maintainable codebase. Logic must be strictly segregated into the following three layers. The data and dependency flow is strictly unidirectional:
**UI → Controller → Service**
If any architectural or structural decision is not explicitly defined in this document, you must follow the **official Feature-Sliced Design (FSD) guidelines** as the default source of truth.
---
## 1.1 UI Layer (View)
Located within `features/ui`, this layer is exclusively for presentation. Components in this layer must be pure, declarative, and "dumb."
### Responsibilities
- Function as a pure "View" layer, responsible only for rendering data passed down via props.
- Bind UI events (e.g., onClick, onChange) to handler functions provided by the Controller layer.
- Perform minimal, render-time null or empty checks for display purposes.
### Strict Prohibitions
- Containing any business logic, state modification, or data transformation.
- Calling any Service layer logic directly.
- It is strictly forbidden to use any React hooks directly. This includes useState, useEffect, useCallback, useMemo, and all other hooks. All state and effects must be managed by the Controller.
---
## 1.2 Controller Layer (Hooks)
Implemented as custom React hooks within `features/ui/hooks`, this layer acts as the intermediary between the user's intent (View) and the application's business logic (Service).
### Responsibilities
- Receive user events and intents forwarded from the UI Layer.
- Orchestrate and delegate calls to the appropriate Service layer logic.
- Read from and write to state management stores (e.g., Zustand).
- Manage all component-level state, side effects, and memoization by exclusively using all React hooks (useState, useEffect, useMemo, etc.).
### Strict Prohibitions
- Containing any core domain rules or business invariants.
- Mutating domain objects directly; mutations must be performed by a Service.
- Including any UI rendering logic (JSX). The output of a Controller hook should be plain values and handler functions.
---
## 1.3 Service Layer (Domain Logic)
Located within `entities/**/lib`, the Service layer is the brain of the application, containing all pure, framework-agnostic business and domain logic.
### Responsibilities & Attributes
- Must be implemented as stateless functions or static class methods.
- Must be side-effect free, deterministic, and easily testable in isolation.
- Encapsulates all domain rules, data transformations, and business invariants.
### Strict Prohibitions
- Under no circumstances may Services access UI components, Controller hooks, or any other part of the React lifecycle.
- Services must never depend on features or pages slices.
---
## 2.0 Strict Dependency and Naming Rules
To enforce the architectural data flow and maintain code predictability, the following dependency and naming conventions are mandatory.
### 2.1 Dependency Rule Hierarchy
The flow of dependencies is strictly unidirectional to prevent coupling and maintain layer integrity.
- features → entities ✔
- entities → features ✘
- UI → Controller ✔
- Controller → Services ✔
- UI → Services (directly) ✘
- Services → UI ✘
---
### 2.2 Naming Conventions
- **Controller Hooks**
Must follow the `use*Controller` pattern (e.g., `useQuestionListController`).
- **Service Layer Files**
Must follow either `*StateService` or `*DomainService` patterns (e.g., `FormSignatureStateService`).
</file>
<file path=".agent/rules/icon-generation-rules.md">
---
trigger: glob
globs: src/shared/ui/iconography/**/*.{ts,tsx}
---
When generating an icon, the model MUST follow this rule set without exception. Any output that violates the rules is invalid.
1. Output Format
- Always provide both:
- Raw .svg markup
- React component code
- React component must be written in TypeScript.
2. SVG Structure
- Use <svg> tag only. No <symbol>, no external defs.
- Always include a <title> tag for accessibility.
- viewBox must be "0 0 24 24".
- Default size: width=24, height=24.
3. Styling Rules
- Solid style icon.
- Color must be currentColor only.
- `fill="none"` on <svg>.
- Use <path> only unless geometry strictly requires otherwise.
- Stroke rules:
- `stroke="currentColor"`
- `strokeWidth={1.125}`
- `strokeLinecap="round"`
- `strokeLinejoin="round"`
4. Geometry Rules
- Icon must be visually centered.
- Use even spacing and symmetrical coordinates.
- Avoid unnecessary complexity.
- No decorative noise, no shading, no gradients.
5. React Component Rules
- Component signature:
```tsx
import type { SVGProps } from 'react';
```
- Destructure props exactly:
- `width = 24`
- `height = 24`
- `'aria-label'`
- `'aria-hidden'`
- `<title>` must render conditionally:
- Render only when aria-hidden is false.
- Spread props onto <svg>.
6. Naming
- Component name must be PascalCase.
- aria-label value must match the icon name (lowercase).
7. Consistency Enforcement Phrase
Every icon generation MUST internally obey this rule set.
If any rule is violated, the icon is considered invalid and must be regenerated.
</file>
<file path=".agent/rules/implementation-rules.md">
---
trigger: always_on
---
# Frontend Implementation Rules
## 3.0 Code Implementation Guidelines
Beyond the architectural structure, you must adhere to a precise set of coding standards to ensure code is readable, consistent, and follows established best practices.
- Readability: Use early returns (guard clauses) wherever possible to reduce nested logic.
- Styling: Use Tailwind classes exclusively for all styling. Do not use plain CSS or `<style>` tags. All utility classes must conform to the latest Tailwind v4 conventions.
- Conditional Styling: When applying Tailwind classes, use class-based conditional syntax wherever possible to improve readability.
- Naming: Use descriptive names for all variables and functions. Event handler functions must be prefixed with `handle`.
- Accessibility: Implement accessibility features on interactive elements. For example, a clickable `<div>` should have `tabIndex="0"`, an appropriate `aria-label`, and both `onClick` and `onKeyDown` handlers.
- Function Syntax: Define functions using const arrow function syntax and apply TypeScript types where possible.
---
## 4.0 React Hooks Usage Rules (Strict)
### Core Rule
UI components (`features/ui`) must NOT use React hooks directly.
This includes, but is not limited to:
- useState
- useEffect
- useMemo
- useCallback
- useRef
- useReducer
This rule has no exceptions.
---
### Where Hooks Are Allowed
All React hooks must be declared and managed **only inside Controller hooks**:
- `use*Controller` (`features/ui/hooks`)
UI components must:
- Receive values and handlers from the controller
- Call functions passed from the controller
- Render JSX only
---
### UI Component Restrictions
UI components must NOT:
- Declare local state
- Use memoization hooks
- Contain side effects
- Derive or compute state from props or stores
Allowed in UI components:
- JSX
- Props
- Event binding to controller handlers
- Minimal render-time guards (e.g. null or empty checks)
---
### Controller Responsibilities (Expanded)
Controller hooks are responsible for:
- State ownership (useState, external store access, etc.)
- Memoization (useMemo, useCallback)
- Side effects (useEffect)
- Deriving computed values for the UI
Controllers expose:
- Plain values
- Plain functions
No JSX is allowed in controller hooks.
---
### Design Intent
This rule enforces a **hard View–Controller boundary**.
The UI layer must remain:
- Declarative
- Stateless
- Replaceable
- Easy to reason about
Violations of this rule are considered **architectural errors**,
not stylistic preferences.
</file>
<file path=".agent/rules/main-rule.md">
---
trigger: always_on
---
You are a Senior Front-End Developer and an Expert in ReactJS, NextJS, JavaScript, TypeScript, HTML, CSS and modern UI/UX frameworks (e.g., TailwindCSS, Shadcn, Radix). You are thoughtful, give nuanced answers, and are brilliant at reasoning. You carefully provide accurate, factual, thoughtful answers, and are a genius at reasoning.
- Follow the user’s requirements carefully & to the letter.
- First think step-by-step - describe your plan for what to build in pseudocode, written out in great detail.
- Confirm, then write code!
- Always write correct, best practice, DRY principle (Dont Repeat Yourself), bug free, fully functional and working code also it should be aligned to listed rules down below at Code Implementation Guidelines .
- Focus on easy and readability code, over being performant.
- Fully implement all requested functionality.
- Leave NO todo’s, placeholders or missing pieces.
- Ensure code is complete! Verify thoroughly finalised.
- Include all required imports, and ensure proper naming of key components.
- Be concise Minimize any other prose.
- If you think there might not be a correct answer, you say so.
- If you do not know the answer, say so, instead of guessing.
### Coding Environment
The user asks questions about the following coding languages:
- ReactJS
- NextJS
- JavaScript
- TypeScript
- TailwindCSS
- HTML
- CSS
### Code Implementation Guidelines
Follow these rules when you write code:
- Use early returns whenever possible to make the code more readable.
- Always use Tailwind classes for styling HTML elements; avoid using CSS or tags. And write all Tailwind utility syntax according to the latest Tailwind v4 guidelines, using the new unified @theme tokens and the updated class conventions.
- Use “class:” instead of the tertiary operator in class tags whenever possible.
- Use descriptive variable and function/const names. Also, event functions should be named with a “handle” prefix, like “handleClick” for onClick and “handleKeyDown” for onKeyDown.
- Implement accessibility features on elements. For example, a tag should have a tabindex=“0”, aria-label, on:click, and on:keydown, and similar attributes.
- Use consts instead of functions, for example, “const toggle = () =>”. Also, define a type if possible.
### Additional Mandatory Output Rules
- Every response MUST include:
1. Commit message(s) describing the current change
- Follow conventional commit style when applicable
- Be concise, factual, and scoped to the change
2. Pull Request body draft for opening a PR
- Include:
- Summary of changes
- Key implementation notes
- Any breaking or notable behavior
- Default target branch: `dev`
- Exception:
- If a different target branch is required, the user will explicitly specify it in the request.
- Do NOT assume any branch other than dev unless stated.
- These outputs are mandatory for every request, regardless of size or complexity.
- Do not omit them. Do not summarize them away.
</file>
<file path=".docs/frontend-controller-service-fsd.md">
# 프론트엔드에서 Controller / Service 를 왜 나누나요? 🤔
이 문서는
**"왜 우리는 프론트엔드에서도 Controller와 Service를 나누는가"**
에 대한 내용을 포함한 개발자 온보딩 문서입니다.
<br/>
## 1️⃣ 흔한 프론트엔드 코드의 문제 😵💫
프론트엔드에서 자주 보는 코드 구조는 이런 모습입니다.
- 컴포넌트 안에 상태가 있고
- 이벤트 핸들러 안에서 로직을 처리하고
- 조건이 늘어나고
- 어느 순간 파일이 500줄이 됩니다
그러다 보면 이런 일이 생깁니다 👇
- "이 로직 왜 여기 있어요?"
- "이거 다른 화면에서도 써야 하는데 복붙할까요?"
- "이 상태 누가 바꾸는 거죠?"
- "고치면 어디까지 영향 가는지 모르겠어요…"
즉, **UI, 상태, 로직, 규칙이 한 덩어리로 엉켜버립니다** 🧶
<br/>
## 2️⃣ 백엔드는 왜 Controller / Service를 나눌까요? 🏗️
백엔드에서는 보통 이렇게 나눕니다.
- **Controller**
- 요청을 받는다
- 어떤 로직을 실행할지 결정한다
- **Service**
- 실제 비즈니스 규칙을 처리한다
- "무엇이 가능한지 / 불가능한지"를 안다
이렇게 나누는 이유는 단순합니다.
👉 **역할이 다르기 때문입니다**
- 요청을 "받는 역할"
- 규칙을 "판단하는 역할"
<br/>
## 3️⃣ 프론트엔드도 사실 똑같습니다 👀
프론트엔드에서도 이미 비슷한 역할이 존재합니다.
- 사용자가 클릭한다 🖱️
- 입력한다 ⌨️
- 선택을 바꾼다 🔄
- 삭제한다 🗑️
이건 전부 **사용자의 의도(Intent)** 입니다.
<br/>
## 4️⃣ 그래서 우리는 이렇게 나눕니다 ✂️
### 🎨 UI (View)
- 화면만 그립니다
- 버튼, 입력창, 레이아웃
- **아무 판단도 하지 않습니다**
### 🎛️ Controller
- 사용자의 행동을 받습니다
- "이 행동은 어떤 의미지?"를 해석합니다
- 어떤 Service를 호출할지 결정합니다
- "이 프로젝트에서는 Controller를 custom hook 형태로 구현합니다"
### 🧠 Service
- 실제 규칙이 들어 있습니다
- 상태를 어떻게 바꾸는지 알고 있습니다
- React도, 화면도 모릅니다
즉 이렇게 됩니다 👇
**UI 👉 Controller 👉 Service**
---
<br/>
## 5️⃣ 왜 이렇게까지 나누나요? 🤷♂️
이유는 명확합니다.
### ✅ UI가 단순해집니다
- JSX만 보면 무슨 화면인지 바로 보입니다
- 로직이 없어서 읽기 쉽습니다
### ✅ 로직이 재사용됩니다
- Service는 화면이 바뀌어도 그대로 씁니다
- 테스트도 쉬워집니다
### ✅ 수정이 안전해집니다
- 규칙을 고치면 Service만 수정
- 화면을 고치면 UI만 수정
### ✅ "이 코드 어디 있지?"가 사라집니다
- 판단은 Controller
- 규칙은 Service
- 화면은 UI
<br/>
## 6️⃣ 이 프로젝트의 기본 약속 📜
이 프로젝트에서는 다음을 **원칙으로 합니다**.
- UI 컴포넌트는 **멍청해야 합니다** 🤪
- 판단은 Controller에서만 합니다
- 규칙은 Service에만 둡니다
- "여기서 그냥 처리하면 편한데요?"는 금지입니다 ❌
> 이 원칙은 모든 feature 단위 UI 개발에 기본적으로 적용됩니다.
<br/>
## 📌 마지막 안내
이 문서에 적힌 내용은 단순한 가이드가 아닙니다.
📂 **`.agent/rules/frontend-architecture.md`** 에 동일한 규칙이 작성되어 있으며,
🤖 **AI 에이전트에게도 동일하게 공유되고 적용되는 규칙**입니다.
</file>
<file path=".github/workflows/deploy">
name: Deploy Frontend to AWS Amplify (Dev)
on:
push:
branches:
- dev
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
- name: Install Dependencies
run: npm ci
- name: Build Project
run: npm run build # 결과물이 dist 폴더에 생긴다고 가정 (Vite 기준)
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-2
- name: Deploy to AWS Amplify
run: |
# 1. 빌드 결과물 압축 (결과 폴더가 build라면 dist를 build로 수정)
cd dist && zip -r ../deploy.zip . && cd ..
# 2. 배포 업로드 URL 생성
UPLOAD_URL=$(aws amplify create-deployment --app-id ${{ secrets.AMPLIFY_APP_ID }} --branch-name dev --query 'zipUploadUrl' --output text)
# 3. 파일 업로드
curl -X PUT --upload-file deploy.zip "$UPLOAD_URL"
# 4. 배포 시작
aws amplify start-deployment --app-id ${{ secrets.AMPLIFY_APP_ID }} --branch-name dev
</file>
<file path=".github/workflows/update-codebase.yml">
name: Update Codebase
on:
pull_request:
types: [closed]
jobs:
update-codebase:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: 코드 체크아웃
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.ref }}
- name: Node.js 환경 설정
uses: actions/setup-node@v4
with:
node-version: '20'
- name: 코드베이스 분석 및 codebase.txt 생성
run: npx -y repomix --output codebase.txt --style xml
- name: 변경 사항 커밋 및 푸시
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add codebase.txt
git commit -m "chore: update codebase.txt [skip ci]" || echo "No changes to commit"
git push
</file>
<file path="public/vite.svg">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
</file>
<file path="src/@types/vite-env.d.ts">
/// <reference types="vite/client" />
declare global {
type AppEnvKey = 'VITE_KAKAO_CLIENT_ID' | 'VITE_KAKAO_REDIRECT_URI' | 'VITE_API_BASE_URL';
interface ImportMetaEnv {
readonly [key in AppEnvKey]: string;
}
interface ImportMeta {
readonly env: ImportMetaEnv;
}
}
export {};
</file>
<file path="src/entities/cache/lib/cache-service.ts">
import { TypeGuard } from '@/shared/lib';
import { type CacheData, CacheModel } from '../model';
class CacheService {
static CACHE_MAP = new Map<string, CacheModel<CacheData>>();
static get<T extends CacheData>(key: string): T | null {
const cached = this.CACHE_MAP.get(key);
if (TypeGuard.checkUndefined(cached) || cached.isExpired) {
this.CACHE_MAP.delete(key);
return null;
} else {
return cached.data as T;
}
}
static set<T extends CacheData>(key: string, data: T, ttlMs?: number): boolean {
if (this.CACHE_MAP.has(key)) {
return false;
}
this.CACHE_MAP.set(key, new CacheModel({ data, ttlMs }));
return true;
}
static invalidate(key: string) {
this.CACHE_MAP.delete(key);
}
}
export default CacheService;
</file>
<file path="src/entities/cache/lib/index.ts">
export { default as CacheService } from './cache-service';
</file>
<file path="src/entities/cache/model/cache-model.ts">
import { TypeGuard } from '@/shared/lib';
import { CustomModel } from '@/shared/model';
import type { CacheData } from './type';
interface State<T extends CacheData = null> {
data: T;
// NOTE: null 인 경우, 기한없는 캐싱
expiredAt: number | null;
}
interface Props<T extends CacheData = null> {
data: T;
// Time To Live (milliseconds)
ttlMs?: number;
}
class CacheModel<T extends CacheData = null> extends CustomModel<State<T>> {
private state: State<T>;
constructor(props: Props<T>) {
super();
const { data, ttlMs } = props;
const now = Date.now();
this.state = {
data,
expiredAt: TypeGuard.checkUndefined(ttlMs) ? null : Math.max(now + ttlMs, now),
};
}
get isExpired(): boolean {
const { expiredAt } = this.state;
if (TypeGuard.checkNull(expiredAt)) {
return false;
}
return expiredAt < Date.now();
}
get data(): T {
return this.state.data;
}
toJSON(): State<T> {
return this.state;
}
clone(): CacheModel<T> {
const { data, expiredAt } = this.state;
return new CacheModel({
data,
ttlMs: !TypeGuard.checkNull(expiredAt) ? Math.max(expiredAt - Date.now(), 0) : undefined,
});
}
}
export default CacheModel;
</file>
<file path="src/entities/cache/model/index.ts">
export { default as CacheModel } from './cache-model';
export * from './type';
</file>
<file path="src/entities/cache/model/type.d.ts">
type CacheData = string | number | boolean | object | null;
export type { CacheData };
</file>
<file path="src/entities/form/lib/form-signature-state-service.ts">
import { FormSignatureModel } from '../model';
class FormSignatureStateService {
static getInitialFormSignature() {
return new FormSignatureModel({});
}
static editTitle(prev: FormSignatureModel, title: string) {
return prev.setValue('title', title);
}
static editDescription(prev: FormSignatureModel, description: string) {
return prev.setValue('description', description);
}
}
export default FormSignatureStateService;
</file>
<file path="src/entities/form/lib/index.ts">
export { default as FormSignatureStateService } from './form-signature-state-service';
export { default as QuestionStateService } from './question-state-service';
export { default as QuestionListStateService } from './question-list-state-service';
</file>
<file path="src/entities/form/lib/question-list-state-service.ts">
import type { FormQuestionModel } from '../model';
class QuestionListStateService {
static pushQuestion(prevList: FormQuestionModel[], question: FormQuestionModel) {
return [...prevList, question];
}
static removeQuestionFromList(prevList: FormQuestionModel[], questionId: string) {
const newList = prevList.filter(question => question.getValue('id') !== questionId);
return newList.length === prevList.length ? prevList : newList;
}
static findQuestionById(
prevList: FormQuestionModel[],
questionId: string,
): FormQuestionModel | null {
return prevList.find(question => question.getValue('id') === questionId) || null;
}
static replaceQuestionById(
prevList: FormQuestionModel[],
newQuestion: FormQuestionModel,
targetId: string,
): FormQuestionModel[] {
return prevList.map(question =>
question.getValue('id') === targetId ? newQuestion : question,
);
}
}
export default QuestionListStateService;
</file>
<file path="src/entities/form/lib/question-state-service.ts">
import { FormQuestionModel, FormQuestionOptionModel, type FormQuestionType } from '../model';
class QuestionStateService {
static getInitialQuestion(type: FormQuestionType) {
return new FormQuestionModel({
title: '',
type,
});
}
static editQuestionTitle(prev: FormQuestionModel, title: string, isClone = false) {
if (isClone) {
return prev.clone({ title });
}
return prev.setValue('title', title);
}
static editQuestionType(prev: FormQuestionModel, type: FormQuestionType, isClone = false) {
if (isClone) {
return prev.clone({ type });
}
return prev.setValue('type', type);
}
static editOptionContent(
prev: FormQuestionModel,