Compare commits
524
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d9b3e2986 | ||
|
|
bceb9a2e49 | ||
|
|
39cbe80582 | ||
|
|
5fec30fea0 | ||
|
|
a35c037f20 | ||
|
|
f34c359720 | ||
|
|
1bb59dcbc5 | ||
|
|
a6bdd104d5 | ||
|
|
9bf0f400fe | ||
|
|
84f6a00572 | ||
|
|
638eeb077f | ||
|
|
d6cb1e9595 | ||
|
|
dbf43792ad | ||
|
|
23cd481dfb | ||
|
|
793639cc98 | ||
|
|
391e321c15 | ||
|
|
e1819f1b36 | ||
|
|
84ce281f7f | ||
|
|
9d29e4f9a4 | ||
|
|
3942d02225 | ||
|
|
edc83493c3 | ||
|
|
4d8b393b9d | ||
|
|
c2ba691b5e | ||
|
|
ff58a61ce9 | ||
|
|
4b87a35a7d | ||
|
|
662d8ba4d2 | ||
|
|
6dee21d58f | ||
|
|
674f51004d | ||
|
|
028bb6412a | ||
|
|
1aa8ded9b3 | ||
|
|
bccd30c1a9 | ||
|
|
ecb645415b | ||
|
|
0b99613710 | ||
|
|
e9b086b57d | ||
|
|
bae9ab5797 | ||
|
|
2435a503fd | ||
|
|
d1aef9113b | ||
|
|
db7f8355dd | ||
|
|
02000b91d3 | ||
|
|
f193385479 | ||
|
|
cfd8589093 | ||
|
|
3831be3c37 | ||
|
|
8aa73887b6 | ||
|
|
7cc5b3a6f6 | ||
|
|
01329605c7 | ||
|
|
f8643f2460 | ||
|
|
afeb175a18 | ||
|
|
e5498bd10f | ||
|
|
e3ab437a1f | ||
|
|
ec3c9246e6 | ||
|
|
8a60c32862 | ||
|
|
9c0ae1f41b | ||
|
|
49ba755528 | ||
|
|
41431f72b2 | ||
|
|
87a56acdb0 | ||
|
|
0931af417e | ||
|
|
305ad552e7 | ||
|
|
dabb0a8ead | ||
|
|
655579da95 | ||
|
|
b6c7f7cbf2 | ||
|
|
4bbd6610aa | ||
|
|
9b1542fbda | ||
|
|
3c6e27b01d | ||
|
|
fa273a4ffe | ||
|
|
1b43564d5b | ||
|
|
4f33d8d9ae | ||
|
|
e410496495 | ||
|
|
73d9c14723 | ||
|
|
158c817683 | ||
|
|
e2bf573cb7 | ||
|
|
9445b889d7 | ||
|
|
6df11e26fa | ||
|
|
85aef0c279 | ||
|
|
c19ef73a5a | ||
|
|
3b3857207e | ||
|
|
0a30ab0401 | ||
|
|
08cdd73c2b | ||
|
|
227296c46d | ||
|
|
35dedf3fbd | ||
|
|
a8547fdac4 | ||
|
|
35adeb202c | ||
|
|
5ecd14b960 | ||
|
|
429dfa02c3 | ||
|
|
e1ccb97b68 | ||
|
|
8bb22db9a0 | ||
|
|
27f49f101b | ||
|
|
a07cc97c11 | ||
|
|
397894903b | ||
|
|
1ea98d4707 | ||
|
|
24545ec16c | ||
|
|
ce18bc01eb | ||
|
|
fcf2e25c15 | ||
|
|
c291393962 | ||
|
|
8122260737 | ||
|
|
2c1c892006 | ||
|
|
da8c33234f | ||
|
|
8c0a2149ad | ||
|
|
d3cd4f656f | ||
|
|
fce011caf2 | ||
|
|
7ea7d96826 | ||
|
|
7509eb18c5 | ||
|
|
367512aa0d | ||
|
|
ff5efbc1cd | ||
|
|
2b9467ac02 | ||
|
|
8fb211a4ce | ||
|
|
7ca42e0618 | ||
|
|
20b778cb94 | ||
|
|
d26a057cd2 | ||
|
|
e25c20c32c | ||
|
|
6ef490c44f | ||
|
|
8735cd3c7c | ||
|
|
f692420403 | ||
|
|
ed61e2a3b6 | ||
|
|
5e200032fd | ||
|
|
a43c8bb5fe | ||
|
|
ca3ff49521 | ||
|
|
741cc9693f | ||
|
|
f5175c41fc | ||
|
|
240515cc93 | ||
|
|
ee1c0cfb64 | ||
|
|
37f991d56f | ||
|
|
13eadd75dc | ||
|
|
5ae989a1cc | ||
|
|
40f0c5a1d5 | ||
|
|
0f620a6ce7 | ||
|
|
e7d6226dbd | ||
|
|
f6f977d34d | ||
|
|
b1531f890e | ||
|
|
549e98030b | ||
|
|
578215aab4 | ||
|
|
553eb3c59d | ||
|
|
bec73e04dd | ||
|
|
6a13c72c2a | ||
|
|
3dff30762b | ||
|
|
5f56a023c4 | ||
|
|
a469a8878b | ||
|
|
83de01f9cb | ||
|
|
64104b781b | ||
|
|
e5290aa6c4 | ||
|
|
98ad43602a | ||
|
|
5eb7eb6677 | ||
|
|
f77c392fba | ||
|
|
8010e4fa2b | ||
|
|
db8c494864 | ||
|
|
e3f3259179 | ||
|
|
d734845f75 | ||
|
|
b6ae920673 | ||
|
|
5f61c1121f | ||
|
|
3b335d6f1e | ||
|
|
2dc59d14d2 | ||
|
|
9aa97e2692 | ||
|
|
78c4419aa2 | ||
|
|
9c77efa424 | ||
|
|
7a7c574217 | ||
|
|
2296251446 | ||
|
|
e728021581 | ||
|
|
bc405b16bd | ||
|
|
981cbb1772 | ||
|
|
9ae06f9b6f | ||
|
|
5602ab043e | ||
|
|
e43a74287f | ||
|
|
9dd7dc83c3 | ||
|
|
7dc78c46eb | ||
|
|
9de52ac243 | ||
|
|
c6be741149 | ||
|
|
b78aa6906b | ||
|
|
f7c352ee70 | ||
|
|
36bc8ef2b4 | ||
|
|
e1b4de60d8 | ||
|
|
bbda923b97 | ||
|
|
03e49e6b14 | ||
|
|
0ca522a1e9 | ||
|
|
de466dd17b | ||
|
|
b9465de40e | ||
|
|
0e096a025a | ||
|
|
c0667c0970 | ||
|
|
df5db2e512 | ||
|
|
a77fedc2a2 | ||
|
|
4ae0309709 | ||
|
|
ba1277d141 | ||
|
|
d2ae26ffdd | ||
|
|
0049274356 | ||
|
|
abc5fb4cb3 | ||
|
|
7aadfb9159 | ||
|
|
13af0620a2 | ||
|
|
5b4a6bf9c1 | ||
|
|
f17803b858 | ||
|
|
8009270b54 | ||
|
|
9266ee77a9 | ||
|
|
a791bfddd3 | ||
|
|
1ac56c2450 | ||
|
|
c5b90b7598 | ||
|
|
488dfb32d9 | ||
|
|
aee76e9aee | ||
|
|
3d8b00baa4 | ||
|
|
3553dd5661 | ||
|
|
49e0f915e1 | ||
|
|
fe2803393b | ||
|
|
a45378685b | ||
|
|
f6e4ae1273 | ||
|
|
e86eaab479 | ||
|
|
306d839915 | ||
|
|
d5d5ef2444 | ||
|
|
f3de85852f | ||
|
|
ed5b16c515 | ||
|
|
0de3f81775 | ||
|
|
67ae66d749 | ||
|
|
753785aa41 | ||
|
|
0f74074552 | ||
|
|
8779d928ee | ||
|
|
30d4312cdd | ||
|
|
e59738dc08 | ||
|
|
9b625a66e2 | ||
|
|
0af4b51a39 | ||
|
|
2cf1abba89 | ||
|
|
c695f6cb0b | ||
|
|
3b75058fbf | ||
|
|
5f161749e2 | ||
|
|
5ad62e8b73 | ||
|
|
278ae5c344 | ||
|
|
b49c6fc470 | ||
|
|
df064742bd | ||
|
|
a7f25cbdfd | ||
|
|
76cbf4ae78 | ||
|
|
0e63b592a9 | ||
|
|
e365aa204f | ||
|
|
14317d2ac8 | ||
|
|
db56ae5b6a | ||
|
|
2c7330d4a6 | ||
|
|
cddf5ceb9a | ||
|
|
3b881e46cc | ||
|
|
12cefe72e9 | ||
|
|
13320a4633 | ||
|
|
47261eb94f | ||
|
|
7007603780 | ||
|
|
68f3c82260 | ||
|
|
4febd08a9e | ||
|
|
929a417cf7 | ||
|
|
381a25d92f | ||
|
|
6e6994de46 | ||
|
|
7dc16a4eec | ||
|
|
86b66b803d | ||
|
|
3d94692086 | ||
|
|
8166c52c73 | ||
|
|
51e3e825cb | ||
|
|
772dce3c5e | ||
|
|
38df357b6e | ||
|
|
187d06ac54 | ||
|
|
60c54599f1 | ||
|
|
6d2bba17b4 | ||
|
|
ff6b0240d7 | ||
|
|
2176ddebbc | ||
|
|
c5fdf01aa7 | ||
|
|
93dda8e5d6 | ||
|
|
9af9b2e9cc | ||
|
|
81ff0a12ec | ||
|
|
7106db7d64 | ||
|
|
a1098dad03 | ||
|
|
1cd2d248ac | ||
|
|
c31ef55341 | ||
|
|
fcaf887b89 | ||
|
|
8a9df47477 | ||
|
|
07bb98d645 | ||
|
|
32fd9c4ff5 | ||
|
|
8f57fc3509 | ||
|
|
8c1d268b97 | ||
|
|
7e494ab95e | ||
|
|
943644301b | ||
|
|
01ce402f51 | ||
|
|
3cd4840f78 | ||
|
|
eb7b184de1 | ||
|
|
6bdd0d7c3c | ||
|
|
c5a0763e28 | ||
|
|
3c185eef4e | ||
|
|
66b206b29b | ||
|
|
a8c7bffe9f | ||
|
|
cc0a9c3de1 | ||
|
|
b17e59a6b4 | ||
|
|
2fabd67217 | ||
|
|
d1f3e8f782 | ||
|
|
cdbe89684a | ||
|
|
d30448e5f5 | ||
|
|
c649463bec | ||
|
|
e2d6ee25ed | ||
|
|
aec7683a9f | ||
|
|
87faeb271f | ||
|
|
442b84c3cc | ||
|
|
bf499926b8 | ||
|
|
14a00ea3a1 | ||
|
|
21a5d66aa3 | ||
|
|
9990a0cfbd | ||
|
|
0c7f990b0a | ||
|
|
8810baf2e3 | ||
|
|
119add1544 | ||
|
|
46f8dacbb8 | ||
|
|
878e0955c2 | ||
|
|
c2f570dd34 | ||
|
|
1eade5e53e | ||
|
|
172f3950c7 | ||
|
|
c7ffe1b3fc | ||
|
|
f6a4554224 | ||
|
|
c96d076174 | ||
|
|
1905df6692 | ||
|
|
7f9a798f95 | ||
|
|
83602c5ba0 | ||
|
|
c3d607b0bb | ||
|
|
508788dbf2 | ||
|
|
424acbec73 | ||
|
|
be9157e5c1 | ||
|
|
0a45443756 | ||
|
|
44668d1c28 | ||
|
|
52fcd589e9 | ||
|
|
a77bd5c41b | ||
|
|
94a064c81d | ||
|
|
418de8724a | ||
|
|
893688e542 | ||
|
|
4827540313 | ||
|
|
f08508ff84 | ||
|
|
e9d99e57d1 | ||
|
|
51eeaaadd5 | ||
|
|
5010293781 | ||
|
|
21b7a34419 | ||
|
|
f063c48675 | ||
|
|
3da256e177 | ||
|
|
bb11dd25a9 | ||
|
|
cb079d5a68 | ||
|
|
f988e76603 | ||
|
|
766ded4d37 | ||
|
|
e56e072276 | ||
|
|
9a8f73e4d5 | ||
|
|
a68d9e650f | ||
|
|
fbcf056efa | ||
|
|
2f580e5940 | ||
|
|
0a9939c934 | ||
|
|
f3c7142e67 | ||
|
|
0974cc00b9 | ||
|
|
a689b7e896 | ||
|
|
c83a8cfbdc | ||
|
|
2797256e2c | ||
|
|
1d10c16b9a | ||
|
|
310d666907 | ||
|
|
025742359b | ||
|
|
d661d445ce | ||
|
|
36f998cf4b | ||
|
|
a9e7fa35a5 | ||
|
|
02d0d1e193 | ||
|
|
e4cf3870d1 | ||
|
|
088025f03e | ||
|
|
b1cf250c7a | ||
|
|
fd95294581 | ||
|
|
332ca2613c | ||
|
|
d8b43188f5 | ||
|
|
18c830869c | ||
|
|
403a64f6f0 | ||
|
|
d5aae0d1b0 | ||
|
|
5b06f48268 | ||
|
|
c2603e07e1 | ||
|
|
95883ad330 | ||
|
|
b7878c609d | ||
|
|
ea66930da2 | ||
|
|
77f828d0aa | ||
|
|
7662144cbf | ||
|
|
a2a0b2f288 | ||
|
|
1f816dd88c | ||
|
|
a02c1ecede | ||
|
|
90e3d1799a | ||
|
|
e2e7cc2613 | ||
|
|
6eaadd814d | ||
|
|
dc7981035c | ||
|
|
96ca92a2d0 | ||
|
|
7a60eaa6e4 | ||
|
|
521c28aec6 | ||
|
|
6c56f408bf | ||
|
|
a89c8960ea | ||
|
|
ebfd94d1d6 | ||
|
|
c670f6a205 | ||
|
|
92fa8e183b | ||
|
|
ff3d1b7b1e | ||
|
|
0c08cffdf9 | ||
|
|
ee603b8059 | ||
|
|
cc280f515c | ||
|
|
986667042b | ||
|
|
9ae34f5046 | ||
|
|
c940019620 | ||
|
|
42b235b01d | ||
|
|
4ad665de22 | ||
|
|
f22bfa10ae | ||
|
|
334baf5897 | ||
|
|
5b81f5bfab | ||
|
|
c252cb5db0 | ||
|
|
32465a6a03 | ||
|
|
d64dbc90fe | ||
|
|
ff05b152b7 | ||
|
|
a48e22916f | ||
|
|
c730f1adc5 | ||
|
|
15ac501dd4 | ||
|
|
3035bf8fa6 | ||
|
|
32bb45772b | ||
|
|
c81517d080 | ||
|
|
93a921dc8b | ||
|
|
519e5a42a2 | ||
|
|
f0185058be | ||
|
|
0114c2d7d1 | ||
|
|
b7920c622c | ||
|
|
d19677ad14 | ||
|
|
1b7d32b27d | ||
|
|
1c7576109e | ||
|
|
081efbcf12 | ||
|
|
f5ce187816 | ||
|
|
2e504972a0 | ||
|
|
6943f99346 | ||
|
|
137f764540 | ||
|
|
aeff426065 | ||
|
|
28f699138a | ||
|
|
1129e5a1c6 | ||
|
|
23cc2ab7a3 | ||
|
|
421123c57d | ||
|
|
204c5142b8 | ||
|
|
911fb7ccb2 | ||
|
|
bf35432562 | ||
|
|
ff05563ce2 | ||
|
|
d46befedd5 | ||
|
|
4171192d1e | ||
|
|
160432c517 | ||
|
|
4229a43698 | ||
|
|
63f2a8d895 | ||
|
|
cc8aa20544 | ||
|
|
389d3679d1 | ||
|
|
539bd327c2 | ||
|
|
e98f095704 | ||
|
|
e79198153e | ||
|
|
aa0a7875b0 | ||
|
|
c21d7876a5 | ||
|
|
bfc311f7e3 | ||
|
|
50f1a6b780 | ||
|
|
79ccf2317b | ||
|
|
380429c7a0 | ||
|
|
cdc3d0dfa3 | ||
|
|
3057a2af23 | ||
|
|
814f26da49 | ||
|
|
d0d441f67a | ||
|
|
5aac9c43d6 | ||
|
|
0bdb68c7e2 | ||
|
|
67940048fe | ||
|
|
13ef1b63c9 | ||
|
|
c039d5f755 | ||
|
|
95aa8aa896 | ||
|
|
ba17ab2100 | ||
|
|
dbb8fe0496 | ||
|
|
50bb9ef5db | ||
|
|
7b94eccfaf | ||
|
|
374c61dcd5 | ||
|
|
48d2a728fc | ||
|
|
e44b2ba82e | ||
|
|
e45457bc14 | ||
|
|
0ad99b6883 | ||
|
|
e944af612c | ||
|
|
5bcb2906c1 | ||
|
|
26e2103fb4 | ||
|
|
cba0701e58 | ||
|
|
f0a5fd299d | ||
|
|
c8352b7456 | ||
|
|
d88c8d748d | ||
|
|
16a8386eba | ||
|
|
3b27f00d29 | ||
|
|
4899810744 | ||
|
|
abaa45bc66 | ||
|
|
6bcf8ec1a9 | ||
|
|
401e728db4 | ||
|
|
85ec74b7ca | ||
|
|
6bdcc26b8c | ||
|
|
7b8b49420b | ||
|
|
748ac748a9 | ||
|
|
280ed20ca8 | ||
|
|
97143dea9b | ||
|
|
e0c19b2a4d | ||
|
|
d83874e2c0 | ||
|
|
5c1b1bc7ae | ||
|
|
9f077e5756 | ||
|
|
ccc6bc99c0 | ||
|
|
c46fe2bc3c | ||
|
|
6ebf5939f5 | ||
|
|
7f0cf5a1fc | ||
|
|
0a3ad7744e | ||
|
|
952a755919 | ||
|
|
e5fb72fff3 | ||
|
|
f3951a806b | ||
|
|
50bc4f2d4f | ||
|
|
1ec7fb56c7 | ||
|
|
d0e6dc6ad0 | ||
|
|
296bacec5c | ||
|
|
e684c820d3 | ||
|
|
2c85b8e133 | ||
|
|
2c658df13d | ||
|
|
430266a360 | ||
|
|
be4044381c | ||
|
|
0747e9c395 | ||
|
|
f264c44b31 | ||
|
|
b189225f1f | ||
|
|
59ebde232a | ||
|
|
d405f60438 | ||
|
|
66ca3980fd | ||
|
|
c545298886 | ||
|
|
7f24b5aa4e | ||
|
|
e86fa29915 | ||
|
|
12ce91a7e0 | ||
|
|
bc9f22c0ca | ||
|
|
ddb7a57fe1 | ||
|
|
6ac37ef599 | ||
|
|
01f4553c10 | ||
|
|
7f1dc1ac46 | ||
|
|
578a1c6437 | ||
|
|
cc77842bce | ||
|
|
54171d735c | ||
|
|
0c454f7b54 | ||
|
|
a8f49ca41b | ||
|
|
3da9f93523 | ||
|
|
a87743cb15 | ||
|
|
a53cefdcf7 | ||
|
|
abf6129f90 | ||
|
|
5fbfadef23 | ||
|
|
84825aa45a | ||
|
|
69ae4426cf | ||
|
|
715ab849fd |
@@ -0,0 +1,23 @@
|
||||
---
|
||||
name: client-updater
|
||||
description: A bot that updates the client software to the latest version.
|
||||
tools: [run_shell_command, read_file, write_file, replace, list_directory, glob, grep_search, ask_user]
|
||||
---
|
||||
# Instructions
|
||||
1. Navigate to the `client` directory.
|
||||
2. Execute the following command to check for updates:
|
||||
`npx npm-check-updates --target minor`
|
||||
3. Display the resulting list of available minor updates to the user.
|
||||
4. If there are packages to update:
|
||||
- Run `npx npm-check-updates --target minor -u` to update `package.json`.
|
||||
- Run `npm install` to update the `package-lock.json` and install the new versions.
|
||||
5. Run the validation script to ensure stability:
|
||||
`../tools/check-frontend.sh`
|
||||
6. If the validation passes:
|
||||
- Create a new branch (e.g., `update-deps-[date]`).
|
||||
- Commit the changes to `package.json` and `package-lock.json`.
|
||||
- Push and create a Pull Request (using `gh pr create` if available).
|
||||
7. If validation fails (lint, build, or test issues):
|
||||
- Diagnose the failure using `grep_search` and `read_file`.
|
||||
- Fix the issues, then retry the validation and PR steps.
|
||||
8. Report the final status and the PR link to the user.
|
||||
@@ -0,0 +1,12 @@
|
||||
description = "Create a formatted GitHub issue"
|
||||
prompt = """
|
||||
Act as a project manager. Based on the following input: {{args}}
|
||||
Create a GitHub issue using the `gh` CLI tool with this exact structure:
|
||||
- Title: [Feat/Bug] <short summary>
|
||||
- Body: A detailed description, technical requirements, and acceptance criteria.
|
||||
- Label: Automatically determine if it's 'bug', 'enhencement', or 'task'.
|
||||
|
||||
Once the user confirms the plan, execute the command:
|
||||
`gh issue create --title "[Type] Title" --body "..." --label "..."
|
||||
"""
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
name: Build App Candidate
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-and-push-app:
|
||||
name: Build & Push App
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Extract metadata for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ghcr.io/${{ github.repository }}/app
|
||||
tags: |
|
||||
type=raw,value=candidate
|
||||
|
||||
- name: Generate version tag
|
||||
id: version
|
||||
run: |
|
||||
DATE=$(date +'%Y.%m.%d')
|
||||
TAG="app-v${DATE}.${{ github.run_number }}"
|
||||
echo "tag=${TAG}" >> $GITHUB_OUTPUT
|
||||
echo "Generated tag: ${TAG}"
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ./client
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
build-args: |
|
||||
VITE_BUILD=${{ steps.version.outputs.tag }}
|
||||
@@ -0,0 +1,59 @@
|
||||
name: Build Server Candidate
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-and-push-server:
|
||||
name: Build & Push Server
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
- name: Set lowercase repo name
|
||||
id: repo
|
||||
run: echo "name=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '25'
|
||||
cache: 'maven'
|
||||
cache-dependency-path: 'server/pom.xml'
|
||||
|
||||
- name: Log in to GHCR
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Cache Buildpack layers
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/reproducible-builds
|
||||
key: ${{ runner.os }}-buildpack-${{ hashFiles('server/pom.xml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-buildpack-
|
||||
|
||||
- name: Build Docker image
|
||||
working-directory: ./server
|
||||
run: |
|
||||
# Use the dynamic repo name to prevent tagging errors
|
||||
./mvnw -Pnative -DskipTests spring-boot:build-image \
|
||||
-Dspring-boot.build-image.imageName=ghcr.io/${{ steps.repo.outputs.name }}/api:latest \
|
||||
-Dspring-boot.build-image.builder=paketobuildpacks/builder-jammy-tiny:latest
|
||||
|
||||
- name: Tag and push candidate
|
||||
run: |
|
||||
docker tag ghcr.io/${{ steps.repo.outputs.name }}/api:latest ghcr.io/${{ steps.repo.outputs.name }}/api:candidate
|
||||
docker push ghcr.io/${{ steps.repo.outputs.name }}/api:candidate
|
||||
@@ -0,0 +1,174 @@
|
||||
name: Main CD-Deploy to Prod
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
backend_image:
|
||||
description: "Backend image tag (full image reference)"
|
||||
required: false
|
||||
frontend_image:
|
||||
description: "Frontend image tag (full image reference)"
|
||||
required: false
|
||||
apply:
|
||||
description: "Apply changes after plan"
|
||||
required: false
|
||||
default: "true"
|
||||
workflow_run:
|
||||
workflows: [ "Main CI-Backend", "Main CI-Frontend" ]
|
||||
types: [ completed ]
|
||||
|
||||
jobs:
|
||||
terraform-plan:
|
||||
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
no_changes: ${{ steps.check-changes.outputs.no_changes }}
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Terraform
|
||||
uses: hashicorp/setup-terraform@v3
|
||||
|
||||
- name: Setup kubectl
|
||||
uses: azure/setup-kubectl@v4
|
||||
|
||||
- name: Setup Kubeconfig
|
||||
run: |
|
||||
mkdir -p ~/.kube
|
||||
echo "${{ secrets.KUBECONFIG_DATA }}" | base64 -d > ~/.kube/config
|
||||
chmod 600 ~/.kube/config
|
||||
|
||||
- name: Validate cluster access
|
||||
run: |
|
||||
kubectl cluster-info
|
||||
kubectl get namespace tasknote
|
||||
|
||||
- name: Determine deployment values
|
||||
id: deploy-vars
|
||||
run: |
|
||||
backend_image="${{ github.event.inputs.backend_image }}"
|
||||
frontend_image="${{ github.event.inputs.frontend_image }}"
|
||||
|
||||
latest_backend_tag_tmp="$(git tag --list 'api-v*' | sort -V | tail -n1)"
|
||||
latest_backend_tag="${latest_backend_tag_tmp#api-v}"
|
||||
latest_frontend_tag="$(git tag --list 'app-v*' | sort -V | tail -n1)"
|
||||
|
||||
if [ -z "$latest_backend_tag" ]; then
|
||||
echo "No backend tag found matching [0-9]*" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$latest_frontend_tag" ]; then
|
||||
echo "No frontend tag found matching app-v*" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$backend_image" ]; then
|
||||
backend_image="ghcr.io/rmcampos/tasknote/api:$latest_backend_tag"
|
||||
fi
|
||||
if [ -z "$frontend_image" ]; then
|
||||
frontend_image="ghcr.io/rmcampos/tasknote/app:$latest_frontend_tag"
|
||||
fi
|
||||
|
||||
echo "Resolved backend_image=$backend_image"
|
||||
echo "Resolved frontend_image=$frontend_image"
|
||||
|
||||
echo "backend_image=$backend_image" >> "$GITHUB_OUTPUT"
|
||||
echo "frontend_image=$frontend_image" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Terraform Fmt -check -diff
|
||||
working-directory: terraform
|
||||
run: terraform fmt -check -diff
|
||||
|
||||
- name: Terraform Init
|
||||
working-directory: terraform
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
|
||||
run: terraform init -input=false
|
||||
|
||||
- name: Terraform Validate
|
||||
working-directory: terraform
|
||||
run: terraform validate
|
||||
|
||||
- name: Terraform Plan
|
||||
id: check-changes
|
||||
working-directory: terraform
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
|
||||
run: |
|
||||
timeout 1m terraform plan -input=false -out=tfplan \
|
||||
-var="db_user=${{ secrets.DB_USER }}" \
|
||||
-var="db_password=${{ secrets.DB_PASSWORD }}" \
|
||||
-var="db_name=${{ secrets.DB_NAME }}" \
|
||||
-var="security_key=${{ secrets.JWT_SECURITY_KEY }}" \
|
||||
-var="mailgun_apikey=${{ secrets.MAILGUN_API_KEY }}" \
|
||||
-var="r2_access_key=${{ secrets.R2_ACCESS_KEY_ID }}" \
|
||||
-var="r2_secret_key=${{ secrets.R2_SECRET_ACCESS_KEY }}" \
|
||||
-var="backend_image=${{ steps.deploy-vars.outputs.backend_image }}" \
|
||||
-var="frontend_image=${{ steps.deploy-vars.outputs.frontend_image }}"
|
||||
terraform show -json tfplan > tfplan.json
|
||||
if jq -e '.resource_changes | length == 0' tfplan.json >/dev/null; then
|
||||
echo "no_changes=true" >> "$GITHUB_OUTPUT"
|
||||
echo "No changes to apply."
|
||||
exit 0
|
||||
else
|
||||
echo "Changes detected. Proceeding with apply"
|
||||
echo "no_changes=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Upload plan artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: tfplan
|
||||
path: terraform/tfplan
|
||||
|
||||
terraform-apply:
|
||||
runs-on: ubuntu-latest
|
||||
needs: terraform-plan
|
||||
if: >
|
||||
(github.event_name == 'push' || github.event_name == 'workflow_run' || inputs.apply == 'true')
|
||||
&& needs.terraform-plan.outputs.no_changes == 'false'
|
||||
environment:
|
||||
name: production
|
||||
url: https://tasknote.darkroasted.vps-kinghost.net
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Setup Terraform
|
||||
uses: hashicorp/setup-terraform@v3
|
||||
|
||||
- name: Download plan artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: tfplan
|
||||
path: terraform
|
||||
|
||||
- name: Setup Kubeconfig
|
||||
run: |
|
||||
mkdir -p ~/.kube
|
||||
echo "${{ secrets.KUBECONFIG_DATA }}" | base64 -d > ~/.kube/config
|
||||
chmod 600 ~/.kube/config
|
||||
|
||||
- name: Terraform Init
|
||||
working-directory: terraform
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
|
||||
run: terraform init -input=false
|
||||
|
||||
- name: Terraform Apply
|
||||
working-directory: terraform
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
|
||||
run: timeout 1m terraform apply tfplan
|
||||
@@ -0,0 +1,142 @@
|
||||
name: Pull Request CD-Deploy to Staging
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
workflow_run:
|
||||
workflows: [ "Pull Request CI-Backend", "Pull Request CI-Frontend" ]
|
||||
types: [ completed ]
|
||||
|
||||
jobs:
|
||||
terraform-plan-stg:
|
||||
name: Plan changs to staging
|
||||
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
no_changes: ${{ steps.check-changes.outputs.no_changes }}
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Terraform
|
||||
uses: hashicorp/setup-terraform@v3
|
||||
|
||||
- name: Show Terraform provider versions
|
||||
working-directory: terraform-stg
|
||||
run: terraform version
|
||||
|
||||
- name: Setup kubectl
|
||||
uses: azure/setup-kubectl@v4
|
||||
|
||||
- name: Setup Kubeconfig
|
||||
run: |
|
||||
mkdir -p ~/.kube
|
||||
echo "${{ secrets.KUBECONFIG_DATA }}" | base64 -d > ~/.kube/config
|
||||
chmod 600 ~/.kube/config
|
||||
|
||||
- name: Validate cluster access
|
||||
run: |
|
||||
kubectl cluster-info
|
||||
kubectl get namespace tasknote-stg
|
||||
|
||||
- name: Determine deployment values
|
||||
id: deploy-vars
|
||||
run: |
|
||||
backend_image="ghcr.io/rmcampos/tasknote/api:candidate"
|
||||
frontend_image="ghcr.io/rmcampos/tasknote/app:candidate"
|
||||
|
||||
echo "backend_image=$backend_image" >> "$GITHUB_OUTPUT"
|
||||
echo "frontend_image=$frontend_image" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Terraform Fmt -check -diff
|
||||
working-directory: terraform-stg
|
||||
run: terraform fmt -check -diff
|
||||
|
||||
- name: Terraform Init
|
||||
working-directory: terraform-stg
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
|
||||
run: terraform init -input=false
|
||||
|
||||
- name: Terraform Validate
|
||||
working-directory: terraform-stg
|
||||
run: terraform validate
|
||||
|
||||
- name: Terraform Plan
|
||||
id: check-changes
|
||||
working-directory: terraform-stg
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
|
||||
run: |
|
||||
timeout 3m terraform plan -input=false -out=tfplan \
|
||||
-var="db_user=${{ secrets.DB_USER }}" \
|
||||
-var="db_password=${{ secrets.DB_PASSWORD }}" \
|
||||
-var="db_name=${{ secrets.DB_NAME }}" \
|
||||
-var="security_key=${{ secrets.JWT_SECURITY_KEY }}" \
|
||||
-var="mailgun_apikey=${{ secrets.MAILGUN_API_KEY }}" \
|
||||
-var="backend_image=${{ steps.deploy-vars.outputs.backend_image }}" \
|
||||
-var="frontend_image=${{ steps.deploy-vars.outputs.frontend_image }}" \
|
||||
-var="deploy_version=${{ github.run_id }}"
|
||||
terraform show -json tfplan > tfplan.json
|
||||
if jq -e '.resource_changes | length == 0' tfplan.json >/dev/null; then
|
||||
echo "no_changes=true" >> "$GITHUB_OUTPUT"
|
||||
echo "No changes to apply."
|
||||
exit 0
|
||||
else
|
||||
echo "Changes detected. Proceeding with apply"
|
||||
echo "no_changes=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Upload plan artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: tfplan
|
||||
path: terraform-stg/tfplan
|
||||
|
||||
terraform-apply:
|
||||
runs-on: ubuntu-latest
|
||||
needs: terraform-plan-stg
|
||||
if: needs.terraform-plan-stg.outputs.no_changes == 'false'
|
||||
environment:
|
||||
name: staging
|
||||
url: https://tasknote-stg.darkroasted.vps-kinghost.net
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Setup Terraform
|
||||
uses: hashicorp/setup-terraform@v3
|
||||
|
||||
- name: Download plan artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: tfplan
|
||||
path: terraform-stg
|
||||
|
||||
- name: Setup Kubeconfig
|
||||
run: |
|
||||
mkdir -p ~/.kube
|
||||
echo "${{ secrets.KUBECONFIG_DATA }}" | base64 -d > ~/.kube/config
|
||||
chmod 600 ~/.kube/config
|
||||
|
||||
- name: Terraform Init
|
||||
working-directory: terraform-stg
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
|
||||
run: terraform init -input=false
|
||||
|
||||
- name: Terraform Apply
|
||||
working-directory: terraform-stg
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
|
||||
KUBE_CONFIG_PATH: ~/.kube/config
|
||||
run: timeout 1m terraform apply tfplan
|
||||
@@ -0,0 +1,101 @@
|
||||
name: Main CI-Backend
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'server/**/*.java'
|
||||
- 'server/**/*.xml'
|
||||
- 'server/pom.xml'
|
||||
- '.github/workflows/main-server.yml'
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
name: Build & Push
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set lowercase repo name
|
||||
id: repo
|
||||
run: echo "name=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '25'
|
||||
cache: 'maven'
|
||||
|
||||
- name: Increment version in pom.xml
|
||||
id: version
|
||||
working-directory: ./server
|
||||
run: |
|
||||
# Extract current version from pom.xml
|
||||
CURRENT_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
|
||||
echo "Current version: ${CURRENT_VERSION}"
|
||||
|
||||
# Increment version
|
||||
NEW_VERSION=$((CURRENT_VERSION + 1))
|
||||
echo "New version: ${NEW_VERSION}"
|
||||
|
||||
# Update pom.xml with new version
|
||||
./mvnw versions:set -DnewVersion=${NEW_VERSION} -DgenerateBackupFiles=false -q
|
||||
|
||||
# Output for later steps
|
||||
echo "version=${NEW_VERSION}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Commit version bump
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git add server/pom.xml
|
||||
git commit -m "chore: bump api version to ${{ steps.version.outputs.version }} [skip ci]"
|
||||
git push
|
||||
|
||||
- name: Log in to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Find PR number
|
||||
id: find_pr
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
PR_NUMBER=$(gh pr list --search "${{ github.sha }}" --state merged --json number --jq '.[0].number')
|
||||
if [ -z "$PR_NUMBER" ]; then
|
||||
echo "No merged PR found for this commit. Falling back to 'candidate' tag."
|
||||
PR_NUMBER="candidate"
|
||||
else
|
||||
PR_NUMBER="pr-${PR_NUMBER}"
|
||||
fi
|
||||
echo "tag=${PR_NUMBER}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Promote Docker image
|
||||
run: |
|
||||
docker buildx imagetools create \
|
||||
--tag ghcr.io/${{ steps.repo.outputs.name }}/api:latest \
|
||||
--tag ghcr.io/${{ steps.repo.outputs.name }}/api:${{ steps.version.outputs.version }} \
|
||||
ghcr.io/${{ steps.repo.outputs.name }}/api:${{ steps.find_pr.outputs.tag }}
|
||||
|
||||
- name: Create and push Git tag
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git tag -a api-v${{ steps.version.outputs.version }} -m "Release API v${{ steps.version.outputs.version }}"
|
||||
git push origin api-v${{ steps.version.outputs.version }}
|
||||
@@ -0,0 +1,83 @@
|
||||
name: Main CI-Frontend
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'client/**/*.html'
|
||||
- 'client/**/*.png'
|
||||
- 'client/**/*.json'
|
||||
- 'client/**/*.txt'
|
||||
- 'client/**/*.ts'
|
||||
- 'client/**/*.tsx'
|
||||
- 'client/**/*.js'
|
||||
- 'client/Dockerfile'
|
||||
- 'client/Caddyfile'
|
||||
- '.github/workflows/main-client.yml'
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
name: Build & Push
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set lowercase repo name
|
||||
id: repo
|
||||
run: echo "name=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Generate version tag
|
||||
id: version
|
||||
run: |
|
||||
DATE=$(date +'%Y.%m.%d')
|
||||
TAG="app-v${DATE}.${{ github.run_number }}"
|
||||
echo "tag=${TAG}" >> $GITHUB_OUTPUT
|
||||
echo "Generated tag: ${TAG}"
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Find PR number
|
||||
id: find_pr
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
PR_NUMBER=$(gh pr list --search "${{ github.sha }}" --state merged --json number --jq '.[0].number')
|
||||
if [ -z "$PR_NUMBER" ]; then
|
||||
echo "No merged PR found for this commit. Falling back to 'candidate' tag."
|
||||
PR_NUMBER="candidate"
|
||||
else
|
||||
PR_NUMBER="pr-${PR_NUMBER}"
|
||||
fi
|
||||
echo "tag=${PR_NUMBER}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Promote Docker image
|
||||
run: |
|
||||
docker buildx imagetools create \
|
||||
--tag ghcr.io/${{ steps.repo.outputs.name }}/app:latest \
|
||||
--tag ghcr.io/${{ steps.repo.outputs.name }}/app:${{ steps.version.outputs.tag }} \
|
||||
ghcr.io/${{ steps.repo.outputs.name }}/app:${{ steps.find_pr.outputs.tag }}
|
||||
|
||||
- name: Create and push Git tag
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git tag -a ${{ steps.version.outputs.tag }} -m "Release ${{ steps.version.outputs.tag }}"
|
||||
git push origin ${{ steps.version.outputs.tag }}
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
name: Pull Request CI-Backend
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
branches:
|
||||
- 'main'
|
||||
paths:
|
||||
- 'server/**/*.java'
|
||||
- 'server/**/*.xml'
|
||||
- 'server/pom.xml'
|
||||
- 'server/**/*.yml'
|
||||
- '.github/workflows/server-ci.yml'
|
||||
|
||||
jobs:
|
||||
run-checks:
|
||||
name: Checks
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '25'
|
||||
cache: 'maven'
|
||||
cache-dependency-path: 'server/pom.xml'
|
||||
|
||||
- name: Run Check Style
|
||||
working-directory: ./server
|
||||
run: ./mvnw --no-transfer-progress checkstyle:check -Dcheckstyle.skip=false
|
||||
|
||||
- name: Run build
|
||||
working-directory: ./server
|
||||
run: ./mvnw --no-transfer-progress clean compile -DskipTests
|
||||
|
||||
- name: Run tests
|
||||
working-directory: ./server
|
||||
run: ./mvnw --no-transfer-progress clean verify -P tests --file pom.xml
|
||||
|
||||
build-and-push:
|
||||
name: Build & Push
|
||||
runs-on: ubuntu-latest
|
||||
needs: ["run-checks"]
|
||||
permissions:
|
||||
contents: read
|
||||
deployments: write
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set lowercase repo name
|
||||
id: repo
|
||||
run: echo "name=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '25'
|
||||
cache: 'maven'
|
||||
cache-dependency-path: 'server/pom.xml'
|
||||
|
||||
- name: Log in to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Cache Buildpack layers
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.cache/reproducible-builds
|
||||
key: ${{ runner.os }}-buildpack-${{ hashFiles('server/pom.xml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-buildpack-
|
||||
|
||||
- name: Build Docker image with Spring Boot
|
||||
working-directory: ./server
|
||||
run: |
|
||||
./mvnw -Pnative -DskipTests spring-boot:build-image \
|
||||
-Dspring-boot.build-image.imageName=ghcr.io/${{ steps.repo.outputs.name }}/api:latest \
|
||||
-Dspring-boot.build-image.builder=paketobuildpacks/builder-jammy-tiny:latest
|
||||
|
||||
- name: Tag and push Docker image
|
||||
run: |
|
||||
docker tag ghcr.io/${{ steps.repo.outputs.name }}/api:latest ghcr.io/${{ steps.repo.outputs.name }}/api:candidate
|
||||
docker tag ghcr.io/${{ steps.repo.outputs.name }}/api:latest ghcr.io/${{ steps.repo.outputs.name }}/api:pr-${{ github.event.pull_request.number }}
|
||||
docker push ghcr.io/${{ steps.repo.outputs.name }}/api:candidate
|
||||
docker push ghcr.io/${{ steps.repo.outputs.name }}/api:pr-${{ github.event.pull_request.number }}
|
||||
|
||||
- name: Create GitHub deployment for staging
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const ref = context.payload.pull_request.head.sha;
|
||||
const env = 'staging';
|
||||
const resp = await github.rest.repos.createDeployment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
ref,
|
||||
required_contexts: [],
|
||||
environment: env,
|
||||
description: `PR #${context.payload.pull_request.number} preview deployment`,
|
||||
transient_environment: true,
|
||||
auto_merge: false
|
||||
});
|
||||
// create a deployment status pointing to the staging URL
|
||||
await github.rest.repos.createDeploymentStatus({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
deployment_id: resp.data.id,
|
||||
state: 'success',
|
||||
environment_url: 'https://tasknote-stg.darkroasted.vps-kinghost.net'
|
||||
});
|
||||
@@ -0,0 +1,134 @@
|
||||
name: Pull Request CI-Frontend
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
branches:
|
||||
- 'main'
|
||||
paths:
|
||||
- 'client/**/*.html'
|
||||
- 'client/**/*.png'
|
||||
- 'client/**/*.json'
|
||||
- 'client/**/*.txt'
|
||||
- 'client/**/*.ts'
|
||||
- 'client/**/*.tsx'
|
||||
- 'client/**/*.js'
|
||||
- 'client/Dockerfile'
|
||||
- 'client/Caddyfile'
|
||||
- '.github/workflows/client-ci.yml'
|
||||
|
||||
jobs:
|
||||
run-checks:
|
||||
name: Checks
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
working-directory: ./client
|
||||
|
||||
- name: Run lint
|
||||
run: npm run lint
|
||||
working-directory: ./client
|
||||
|
||||
- name: Run build
|
||||
run: npm run build
|
||||
working-directory: ./client
|
||||
|
||||
- name: Run tests
|
||||
run: npm run test:no-watch
|
||||
working-directory: ./client
|
||||
|
||||
build-and-push:
|
||||
name: Build & Push
|
||||
runs-on: ubuntu-latest
|
||||
needs: ["run-checks"]
|
||||
permissions:
|
||||
contents: write
|
||||
packages: write
|
||||
deployments: write
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Extract metadata for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ghcr.io/${{ github.repository }}/app
|
||||
tags: |
|
||||
type=raw,value=candidate
|
||||
type=raw,value=pr-${{ github.event.pull_request.number }}
|
||||
|
||||
- name: Generate version tag
|
||||
id: version
|
||||
run: |
|
||||
DATE=$(date +'%Y.%m.%d')
|
||||
TAG="app-v${DATE}.${{ github.run_number }}"
|
||||
echo "tag=${TAG}" >> $GITHUB_OUTPUT
|
||||
echo "Generated tag: ${TAG}"
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ./client
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
build-args: |
|
||||
VITE_BUILD=${{ steps.version.outputs.tag }}
|
||||
|
||||
- name: Create GitHub deployment for staging
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const ref = context.payload.pull_request.head.sha;
|
||||
const env = 'staging';
|
||||
const resp = await github.rest.repos.createDeployment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
ref,
|
||||
required_contexts: [],
|
||||
environment: env,
|
||||
description: `PR #${context.payload.pull_request.number} preview deployment`,
|
||||
transient_environment: true,
|
||||
auto_merge: false
|
||||
});
|
||||
// create a deployment status pointing to the staging URL
|
||||
await github.rest.repos.createDeploymentStatus({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
deployment_id: resp.data.id,
|
||||
state: 'success',
|
||||
environment_url: 'https://tasknote-stg.darkroasted.vps-kinghost.net'
|
||||
});
|
||||
+36
-5
@@ -1,15 +1,18 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
client/node_modules
|
||||
client/.pnp
|
||||
client.pnp.js
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
client/coverage
|
||||
client/cypress/videos
|
||||
client/cypress/screenshots
|
||||
|
||||
# production
|
||||
/build
|
||||
client/build
|
||||
client/dist
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
@@ -21,3 +24,31 @@
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
.env
|
||||
|
||||
# Local PG data
|
||||
/localpgdata
|
||||
|
||||
# IDE
|
||||
.vscode/
|
||||
.idea
|
||||
|
||||
# Schema Spy
|
||||
schemaspy/output/
|
||||
|
||||
# Terraform
|
||||
.terraform/
|
||||
*.tfstate
|
||||
*.tfstate.backup
|
||||
*.tfplan
|
||||
tfplan
|
||||
*.tfvars
|
||||
*.tfvars.json
|
||||
override.tf
|
||||
override.tf.json
|
||||
_override.tf
|
||||
_override.tf.json
|
||||
.terraformrc
|
||||
terraform.rc
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
# AGENTS.md
|
||||
|
||||
## Big picture
|
||||
- `tasknote` is a monorepo with a React/Vite frontend (`client/`) and Spring Boot API (`server/`) sharing a PostgreSQL schema managed by Flyway migrations (`server/src/main/resources/db/migration/`).
|
||||
- Request boundary is explicit: unauthenticated endpoints under `/auth/**`, authenticated business endpoints under `/rest/**`, and public shared-note endpoints under `/public/**` (see `server/src/main/java/br/com/tasknoteapp/server/config/SecurityConfig.java`).
|
||||
- Frontend talks directly to backend URLs from `client/src/api-service/apiConfig.ts` (`VITE_BACKEND_SERVER`), using `fetch` wrapper logic in `client/src/api-service/api.ts`.
|
||||
- Auth is JWT-in-header + localStorage persistence (`API_TOKEN`), with automatic 2-minute token refresh in `client/src/context/AuthProvider.tsx` via `/rest/user-sessions/refresh`.
|
||||
|
||||
## Architecture details that matter
|
||||
- Frontend route split is auth-state driven in `client/src/App.tsx` + `client/src/routes/ProtectedRoute/index.tsx`; private screens render through `client/src/layout/PrivateLayout/index.tsx`.
|
||||
- Home view (`client/src/views/Home/index.tsx`) is a key integration surface: loads tasks/notes/tags, applies client-side filtering, and drives note sharing (`/rest/notes/{id}/share` + `/public/notes/{token}`).
|
||||
- Three React Contexts are active at runtime: `AuthProvider` (JWT lifecycle), `FilterProvider` (search text + option persisted to `localStorage` as `FILTER_TEXT`/`FILTER_OPTION`), and `SidebarProvider` (sidebar open/close state) — all under `client/src/context/`.
|
||||
- Backend follows controller -> service -> repository layering (`server/src/main/java/br/com/tasknoteapp/server/{controller,service,repository}`).
|
||||
- `HomeController` (`/rest/home`) exposes aggregated data such as `/rest/home/tasks/tags`; it is separate from `TaskController` and `NoteController`.
|
||||
- Global API error shape comes from `server/src/main/java/br/com/tasknoteapp/server/controller/RestExceptionController.java`; frontend expects `message` or `fields[].fieldMessage` (`client/src/api-service/api.ts`).
|
||||
- Email and password-reset flows are Mailgun-backed (`server/src/main/java/br/com/tasknoteapp/server/service/MailgunEmailService.java`) and use templates under `server/src/main/java/br/com/tasknoteapp/server/templates/` + `mailgun-templates/`.
|
||||
- Backend targets **Java 25** and **Spring Boot 4.x** (`server/pom.xml`).
|
||||
|
||||
## Developer workflows (use these first)
|
||||
- Frontend quality gate: `bash tools/check-frontend.sh` (runs `npm ci`, `lint:fix`, `build`, `test:no-watch`).
|
||||
- Backend quality gate: `bash tools/check-backend.sh` (runs checkstyle, compile, then `clean verify -P tests`).
|
||||
- Backend dependency freshness check: `bash tools/check-be-deps.sh` (verifies that `failsafe`, `surefire`, `jacoco`, `checkstyle`, and Spring Boot plugin versions in `pom.xml` match the latest releases on Maven Central; must be run from the repo root or `server/`).
|
||||
- Important Maven default: tests/checkstyle/jacoco are skipped unless profile `-P tests` is enabled (`server/pom.xml`).
|
||||
- Dev stack via Docker Compose/Taskfile (`Taskfile.yml`, `docker-compose.dev.yml`): app `5000`, API `8585`, Java debug port `5005`, Postgres `5432`.
|
||||
- Frontend local dev: run from `client/` with `npm start`; backend local dev: run from `server/` with `./mvnw spring-boot:run`.
|
||||
|
||||
## CI/CD and release behavior
|
||||
- PR workflows (`.github/workflows/ci-pr-frontend.yml`, `.github/workflows/ci-pr-backend.yml`) run checks then push `:candidate` and `:pr-<N>` images to GHCR.
|
||||
- Main workflows (`.github/workflows/ci-main-frontend.yml`, `.github/workflows/ci-main-backend.yml`) push versioned tags (`app-v<date>.<run>` / `api-v<pom-version>`) + `latest`; backend workflow also increments `server/pom.xml` version.
|
||||
- Staging deploy workflow (`.github/workflows/cd-pr.yml`) triggers on completion of either PR CI workflow and applies Terraform in `terraform-stg/` using a plan→apply split.
|
||||
- Production deploy workflow (`.github/workflows/cd-main.yml`) triggers on completion of either Main CI workflow and applies Terraform in `terraform/` using a plan→apply split; `apply` can be skipped if there are no Terraform changes.
|
||||
- Infra wiring (secrets, services, ingress, image vars) is defined in `terraform/main.tf`; an alternative GCP target is under `terraform-gcp/`.
|
||||
|
||||
## Project conventions to preserve
|
||||
- Frontend style is ESLint flat config + stylistic rules (2-space indent, single quotes, semicolons) in `client/eslint.config.mjs`.
|
||||
- Backend style is Google Checkstyle (`server/.mvn/google_checks.xml`), including 100-char line length and Javadoc requirements on public APIs.
|
||||
- Integration tests are named `*IntTest.java` and are run by Failsafe; unit tests exclude that suffix (`server/pom.xml`).
|
||||
- Migration files are versioned `V<timestamp>__description.sql`; never edit old migrations, add new ones in `server/src/main/resources/db/migration/`.
|
||||
|
||||
## Agent guardrails
|
||||
- Prefer editing source, not generated artifacts (`server/target/`, `schemaspy/output/`, `TaskNoteBruno/results.html`).
|
||||
- Keep API contract compatibility with frontend `ApiConfig` paths; changing endpoint paths requires synchronized client updates.
|
||||
- When changing auth/session behavior, update both backend filters/controllers and frontend `AuthProvider` token lifecycle.
|
||||
- If you change CI/build/deploy commands, update both `README.md` and this `AGENTS.md` to keep workflows discoverable.
|
||||
@@ -0,0 +1,81 @@
|
||||
# 🤝 Contributing
|
||||
|
||||
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
|
||||
|
||||
This project is an opensource project, meaning you can contribute as many times as you want! We work with the **Fork & Merge** flow.
|
||||
|
||||
If you want to contribute, please create a fork and a Merge Request. Take a look [here to learn more.](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork)
|
||||
|
||||
## Steps to Contribute
|
||||
|
||||
1. Fork the Project
|
||||
2. Clone it on your local (`git clone https://github.com/ricardo-campos-org/react-typescript-todolist`)
|
||||
3. Develop your amazing feature/changes
|
||||
4. Make sure your name is set (`git config user.name 'YOUR NAME'; git config user.email 'YOUR EMAIL'`)
|
||||
5. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
||||
6. Push to the Branch (`git push`)
|
||||
7. Open a Merge Request
|
||||
|
||||
## 🏃♀️ Running locally
|
||||
|
||||
> If your OS is Microsoft Windows, make sure to run this on a Linux VM over WSL2.
|
||||
|
||||
The easiest way of having the app up and running is using [Docker](https://www.docker.com/). Once you're all set, follow these steps to see it live locally:
|
||||
|
||||
1. Start the database engine (PostgreSQL)
|
||||
```sh
|
||||
bash tools/run-docker-db.sh
|
||||
```
|
||||
2. Start the back-end engine (Java & Spring Boot)
|
||||
```sh
|
||||
bash tools/run-docker-server.sh
|
||||
```
|
||||
3. Start the app server
|
||||
```sh
|
||||
bash tools/run-docker-client.sh
|
||||
```
|
||||
|
||||
> Remember to follow up logs with 'docker ps' and 'docker logs -f <name>'
|
||||
|
||||
If everything went well, you can head to [http://localhost:5000](http://localhost:5000) and create your user.
|
||||
|
||||
## 🦾 Automation
|
||||
|
||||
Once you finish your changes, just create a Merge Request to get started.
|
||||
|
||||
This project has workflows to ensure quality code, including linting, testing and security checks. Your changes will be merged only after all check passes.
|
||||
|
||||
You can check locally if changes are passing:
|
||||
|
||||
1. Back-end
|
||||
```sh
|
||||
bash tools/check-backend.sh
|
||||
```
|
||||
2. Front-end
|
||||
```sh
|
||||
bash tools/check-frontend.sh
|
||||
```
|
||||
|
||||
> Remember to follow up logs with 'docker ps' and 'docker logs -f <name>'
|
||||
|
||||
## Debugging Java
|
||||
|
||||
You might need to create a `launch.json` file. Here's a working one
|
||||
|
||||
```json
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "java",
|
||||
"name": "Debug (Attach)",
|
||||
"request": "attach",
|
||||
"hostName": "localhost",
|
||||
"port": 5005
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
@@ -1,8 +1,295 @@
|
||||
## Simple React Project to Study
|
||||
# TaskNote
|
||||
|
||||
- React
|
||||
- TypeScript
|
||||
- Featuring
|
||||
- CSS as modules
|
||||
[](https://www.gnu.org/licenses/gpl-3.0)
|
||||
[](https://github.com/RMCampos/tasknote/actions/workflows/client-ci.yml)
|
||||
[](https://github.com/RMCampos/tasknote/actions/workflows/server-ci.yml)
|
||||
[](https://github.com/RMCampos/tasknote/actions/workflows/main-client.yml)
|
||||
[](https://github.com/RMCampos/tasknote/actions/workflows/main-server.yml)
|
||||
|
||||
This project was based on a course from **Matheus Battisti** on Udemy (https://www.udemy.com/course/typescript-do-basico-ao-avancado-c-react-express/)
|
||||
## 📋 Table of Contents
|
||||
|
||||
- [📝 About the Project](#-about-the-project)
|
||||
- [✨ Features](#-features)
|
||||
- [🚀 Tech Stack](#-tech-stack)
|
||||
- [🏗️ Architecture](#️-architecture)
|
||||
- [🚀 Getting Started](#-getting-started)
|
||||
- [🛠️ Development](#️-development)
|
||||
- [🧪 Testing](#-testing)
|
||||
- [📦 Deployment](#-deployment)
|
||||
- [🤝 Contributing](#-contributing)
|
||||
- [👨💻 Developer](#-developer)
|
||||
- [📞 Contact](#-contact)
|
||||
- [📄 License](#-license)
|
||||
|
||||
## 📝 About the Project
|
||||
|
||||
TaskNote is a full-stack productivity application designed for managing tasks and notes with simplicity and effectiveness in mind. Originally created to address personal productivity needs, it has evolved into a comprehensive, open-source solution featuring a modern tech stack and enterprise-grade architecture.
|
||||
|
||||
The project was born from a month-long technical challenge and has since grown to include robust authentication, internationalization support, responsive design, and comprehensive testing coverage.
|
||||
|
||||
## ✨ Features
|
||||
|
||||
### Current Features
|
||||
- **Task Management**: Create, edit, delete, and organize TODO items with due dates and priority levels
|
||||
- **Note Taking**: Rich text notes with Markdown support for better formatting
|
||||
- **Smart Search**: Full-text search across tasks and notes with real-time filtering
|
||||
- **User Authentication**: Secure JWT-based authentication with automatic token refresh
|
||||
- **Internationalization**: Multi-language support (English, Portuguese, Spanish, Russian)
|
||||
- **Responsive Design**: Mobile-first approach with Bootstrap 5 and dark/light theme support
|
||||
- **Data Visualization**: Task completion charts and productivity analytics
|
||||
- **File Attachments**: URL attachments for tasks and notes
|
||||
- **Tagging System**: `#tag` support for better organization
|
||||
- **Mobile App**: Native mobile applications for iOS and Android with PWA plugin
|
||||
- **Collaboration**: Share tasks and notes with other users
|
||||
|
||||
### Upcoming Features
|
||||
- **Advanced Filters**: Enhanced search with date ranges, priority levels, and status filters
|
||||
- **Notifications**: Email and push notifications for due dates and reminders
|
||||
|
||||
## 🚀 Tech Stack
|
||||
|
||||
### Frontend (React & TypeScript)
|
||||
- **Framework**: React 19 with TypeScript for type safety
|
||||
- **Build Tool**: Vite for fast development and optimized production builds
|
||||
- **Testing**: Vitest with React Testing Library and comprehensive coverage reporting
|
||||
- **Styling**: Bootstrap 5 with custom SCSS and theme support
|
||||
- **State Management**: React Context API for authentication and sidebar state
|
||||
- **Routing**: React Router 7 with dynamic route configuration
|
||||
- **Internationalization**: i18next with automatic language detection
|
||||
- **API Client**: Centralized API service with automatic authentication headers
|
||||
|
||||
### Backend (Java & Spring Boot)
|
||||
- **Framework**: Spring Boot 4.x.x with Java 25
|
||||
- **Security**: Spring Security with JWT authentication and refresh tokens
|
||||
- **Database**: PostgreSQL with JPA/Hibernate ORM
|
||||
- **Migration**: Flyway for database schema versioning
|
||||
- **Documentation**: OpenAPI/Swagger UI for API documentation
|
||||
- **Testing**: JUnit with separate unit and integration test suites
|
||||
- **Code Quality**: Checkstyle, JaCoCo coverage (75% minimum), Maven Enforcer
|
||||
- **Build Options**: Traditional JAR or GraalVM native image compilation
|
||||
|
||||
### Database & Infrastructure
|
||||
- **Database**: PostgreSQL with optimized indexes and constraints
|
||||
- **Containerization**: Docker and Docker Compose for development environment
|
||||
- **Web Server**: Caddy for reverse proxy and SSL termination
|
||||
- **CI/CD**: GitHub Actions with automated testing and quality gates
|
||||
|
||||
## 🏗️ Architecture
|
||||
|
||||
### Monorepo Structure
|
||||
```
|
||||
tasknote/
|
||||
├── client/ # React TypeScript frontend
|
||||
├── server/ # Java Spring Boot REST API
|
||||
├── tools/ # Development and deployment scripts
|
||||
└── docker-compose.yml
|
||||
```
|
||||
|
||||
### Frontend Architecture
|
||||
- **Component Structure**: Modular components with TypeScript interfaces
|
||||
- **Authentication Flow**: JWT tokens with 2-minute refresh intervals
|
||||
- **Theme System**: CSS custom properties for dark/light mode switching
|
||||
- **Responsive Layout**: Mobile-first design with sidebar navigation
|
||||
- **Error Handling**: Centralized error boundary and user feedback
|
||||
|
||||
### Backend Architecture
|
||||
- **RESTful API**: Clean REST endpoints with proper HTTP status codes
|
||||
- **Security Layer**: JWT validation, CORS configuration, and input validation
|
||||
- **Service Layer**: Business logic separation with transaction management
|
||||
- **Repository Pattern**: Data access abstraction with custom queries
|
||||
- **Email Service**: Template-based email notifications for user actions
|
||||
|
||||
## 🚀 Getting Started
|
||||
|
||||
### Prerequisites
|
||||
- **Docker & Docker Compose** (recommended for easy setup)
|
||||
- **Node.js 20+** and **npm** (for frontend development)
|
||||
- **Java 25+** and **Maven 3.6+** (for backend development)
|
||||
- **PostgreSQL 15+** (if running without Docker)
|
||||
|
||||
### Quick Start with Docker
|
||||
1. **Clone the repository**
|
||||
```bash
|
||||
git clone https://github.com/rmcampos/tasknote.git
|
||||
cd tasknote
|
||||
```
|
||||
|
||||
2. **Start the database**
|
||||
```bash
|
||||
bash tools/run-docker-db.sh
|
||||
```
|
||||
|
||||
3. **Start the backend server**
|
||||
```bash
|
||||
bash tools/run-docker-server.sh
|
||||
```
|
||||
|
||||
4. **Start the frontend application**
|
||||
```bash
|
||||
bash tools/run-docker-client.sh
|
||||
```
|
||||
|
||||
5. **Access the application**
|
||||
- Frontend: http://localhost:5000
|
||||
|
||||
## 🛠️ Development
|
||||
|
||||
### Frontend Development
|
||||
```bash
|
||||
cd client
|
||||
npm install # Install dependencies
|
||||
npm start # Start development server (port 5000)
|
||||
npm run build # Build for production
|
||||
npm run preview # Preview production build
|
||||
npm run lint # Run ESLint
|
||||
npm run lint:fix # Fix ESLint issues
|
||||
```
|
||||
|
||||
### Backend Development
|
||||
```bash
|
||||
cd server
|
||||
./mvnw spring-boot:run # Start development server
|
||||
./mvnw clean compile # Compile sources
|
||||
./mvnw spring-boot:build-image # Build Docker image
|
||||
./mvnw clean verify -Pnative # Build GraalVM native image
|
||||
```
|
||||
|
||||
### Quality Checks
|
||||
Run quality checks before submitting changes:
|
||||
```bash
|
||||
bash tools/check-frontend.sh # Frontend linting, testing, coverage
|
||||
bash tools/check-backend.sh # Backend compilation, tests, checkstyle
|
||||
```
|
||||
|
||||
## 🧪 Testing
|
||||
|
||||
### Frontend Testing
|
||||
- **Framework**: Vitest with React Testing Library
|
||||
- **Coverage**: Comprehensive test coverage with reports in `client/coverage/`
|
||||
- **Commands**:
|
||||
```bash
|
||||
npm test # Run tests in watch mode
|
||||
npm run test:coverage # Generate coverage report
|
||||
```
|
||||
|
||||
### Backend Testing
|
||||
- **Unit Tests**: Fast, isolated tests with mocked dependencies
|
||||
- **Integration Tests**: Full application context with test database
|
||||
- **Coverage**: JaCoCo reporting with 75% minimum requirement
|
||||
- **Commands**:
|
||||
```bash
|
||||
./mvnw test # Unit tests only
|
||||
./mvnw clean verify -Ptests # All tests with coverage
|
||||
```
|
||||
|
||||
## 📦 Deployment
|
||||
|
||||
### Production Deployment
|
||||
The application supports multiple deployment strategies:
|
||||
|
||||
1. **Docker Containers** (recommended)
|
||||
```bash
|
||||
docker-compose -f docker-compose.prod.yml up -d
|
||||
```
|
||||
|
||||
2. **Traditional JAR Deployment**
|
||||
```bash
|
||||
cd server && ./mvnw clean package
|
||||
java -jar target/tasknote-api.jar
|
||||
```
|
||||
|
||||
3. **GraalVM Native Image** (for optimal performance)
|
||||
```bash
|
||||
cd server && ./mvnw clean verify -Pnative
|
||||
./target/tasknote-api
|
||||
```
|
||||
|
||||
### Environment Configuration
|
||||
- Database connection via environment variables
|
||||
- JWT secret configuration for production
|
||||
- Email service configuration for notifications
|
||||
- CORS settings for frontend domain
|
||||
|
||||
## 🤝 Contributing
|
||||
|
||||
We welcome contributions from the community! This project follows the **Fork & Merge** workflow.
|
||||
|
||||
### How to Contribute
|
||||
|
||||
1. **Fork the Project** on GitHub
|
||||
2. **Clone your fork** locally
|
||||
```bash
|
||||
git clone https://github.com/YOUR_USERNAME/tasknote.git
|
||||
```
|
||||
3. **Create a feature branch**
|
||||
```bash
|
||||
git checkout -b feature/amazing-feature
|
||||
```
|
||||
4. **Make your changes** and ensure they follow the project standards
|
||||
5. **Run quality checks**
|
||||
```bash
|
||||
bash tools/check-frontend.sh
|
||||
bash tools/check-backend.sh
|
||||
```
|
||||
6. **Commit your changes**
|
||||
```bash
|
||||
git commit -m 'Add some amazing feature'
|
||||
```
|
||||
7. **Push to your fork**
|
||||
```bash
|
||||
git push origin feature/amazing-feature
|
||||
```
|
||||
8. **Open a Pull Request** with a detailed description
|
||||
|
||||
### Development Guidelines
|
||||
- Follow existing code conventions and patterns
|
||||
- Write tests for new functionality
|
||||
- Update documentation when necessary
|
||||
- Ensure all quality checks pass
|
||||
- Keep commits focused and descriptive
|
||||
|
||||
For detailed setup instructions and development workflows, see [CONTRIBUTING.md](CONTRIBUTING.md).
|
||||
|
||||
## 👨💻 Developer
|
||||
|
||||
**Ricardo Campos** - Full-Stack Developer & Project Maintainer
|
||||
|
||||
- **GitHub**: [@RMCampos](https://github.com/RMCampos)
|
||||
- **Twitter/X**: [@RMCamposs](https://x.com/RMCamposs)
|
||||
- **LinkedIn**: [Ricardo Campos](https://www.linkedin.com/in/ricardompcampos/)
|
||||
|
||||
### About the Developer
|
||||
Ricardo is a passionate full-stack developer with expertise in modern web technologies, cloud architecture, and agile development practices. This project showcases his skills in:
|
||||
|
||||
- **Frontend Development**: React, TypeScript, modern CSS, responsive design
|
||||
- **Backend Development**: Java, Spring Boot, RESTful APIs, microservices
|
||||
- **DevOps & Infrastructure**: Docker, CI/CD, cloud deployment, monitoring
|
||||
- **Software Quality**: Testing strategies, code coverage, static analysis
|
||||
- **Open Source**: Community engagement, documentation, maintainership
|
||||
|
||||
The TaskNote project represents a commitment to clean code, comprehensive testing, and user-centered design principles.
|
||||
|
||||
## 📞 Contact
|
||||
|
||||
For questions, suggestions, or collaboration opportunities:
|
||||
|
||||
- **Email**: Contact via GitHub issues or discussions
|
||||
- **Twitter/X**: [@RMCamposs](https://x.com/RMCamposs) for quick questions
|
||||
- **GitHub Issues**: [Create an issue](https://github.com/rmcampos/tasknote/issues) for bugs or feature requests
|
||||
- **GitHub Discussions**: [Join discussions](https://github.com/rmcampos/tasknote/discussions) for general questions
|
||||
|
||||
## 📄 License
|
||||
|
||||
This project is licensed under the **GNU General Public License v3.0** - see the [LICENSE](LICENSE) file for details.
|
||||
|
||||
### What this means:
|
||||
- ✅ **Freedom to use**: Use the software for any purpose
|
||||
- ✅ **Freedom to study**: Access and modify the source code
|
||||
- ✅ **Freedom to share**: Distribute copies of the software
|
||||
- ✅ **Freedom to improve**: Distribute modified versions
|
||||
|
||||
**Copyleft**: Any derivative work must also be open source under GPL v3.0
|
||||
|
||||
---
|
||||
|
||||
⭐ **Star this repository if you find it helpful!** ⭐
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
meta {
|
||||
name: 0-Signup new user
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
put {
|
||||
url: {{addr}}/auth/sign-up
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"email": "{{testEmail}}",
|
||||
"password": "Teste@123.,",
|
||||
"passwordAgain": "Teste@123.,",
|
||||
"lang": "en"
|
||||
}
|
||||
}
|
||||
|
||||
script:pre-request {
|
||||
const testEmail = `test_${Date.now()}@example.com`;
|
||||
const testUsername = `test_user_${Date.now()}`;
|
||||
|
||||
bru.setVar("testEmail", testEmail);
|
||||
}
|
||||
|
||||
tests {
|
||||
test("Status code is 204", function() {
|
||||
expect(res.getStatus()).to.equal(204);
|
||||
});
|
||||
|
||||
test("Response time is acceptable", function() {
|
||||
expect(res.getResponseTime()).to.be.below(3000);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
meta {
|
||||
name: 1-Signup duplicate user
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
put {
|
||||
url: {{addr}}/auth/sign-up
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"email": "{{testEmail}}",
|
||||
"password": "Teste@123.,",
|
||||
"passwordAgain": "Teste@123.,",
|
||||
"lang": "en"
|
||||
}
|
||||
}
|
||||
|
||||
tests {
|
||||
test("Status code is 409", function() {
|
||||
expect(res.getStatus()).to.equal(409);
|
||||
});
|
||||
|
||||
test("Response time is acceptable", function() {
|
||||
expect(res.getResponseTime()).to.be.below(3000);
|
||||
});
|
||||
|
||||
test("Content type is JSON", function() {
|
||||
expect(res.getHeader('content-type')).to.contain('application/json');
|
||||
});
|
||||
|
||||
test("Response has data property", function() {
|
||||
const body = res.getBody();
|
||||
expect(body).to.have.property('error');
|
||||
expect(body).to.have.property('message');
|
||||
expect(body.message).to.equal('Email already exists!');
|
||||
bru.setVar("authToken", body.token);
|
||||
});
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
meta {
|
||||
name: 2-Sign in user
|
||||
type: http
|
||||
seq: 3
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{addr}}/auth/sign-in
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"email": "{{testEmail}}",
|
||||
"password": "Teste@123.,",
|
||||
"passwordAgain": "Teste@123.,",
|
||||
"lang": "en"
|
||||
}
|
||||
}
|
||||
|
||||
tests {
|
||||
test("Status code is 200", function() {
|
||||
expect(res.getStatus()).to.equal(200);
|
||||
});
|
||||
|
||||
test("Response time is acceptable", function() {
|
||||
expect(res.getResponseTime()).to.be.below(3000);
|
||||
});
|
||||
|
||||
test("Content type is JSON", function() {
|
||||
expect(res.getHeader('content-type')).to.contain('application/json');
|
||||
});
|
||||
|
||||
test("Response has all data well set and defined", function() {
|
||||
const body = res.getBody();
|
||||
|
||||
expect(body).to.have.property('userId');
|
||||
expect(body).to.have.property('name');
|
||||
expect(body).to.have.property('email');
|
||||
expect(body).to.have.property('admin');
|
||||
expect(body).to.have.property('createdAt');
|
||||
expect(body).to.have.property('inactivatedAt');
|
||||
expect(body).to.have.property('gravatarImageUrl');
|
||||
expect(body).to.have.property('token');
|
||||
expect(body).to.have.property('lang');
|
||||
|
||||
expect(body.userId).to.be.greaterThan(0);
|
||||
expect(body.name).to.be.null;
|
||||
expect(body.email).to.equal(bru.getVar("testEmail"));
|
||||
expect(body.admin).to.equal(false);
|
||||
expect(body.createdAt).to.not.be.null;
|
||||
expect(body.inactivatedAt).to.be.null;
|
||||
expect(body.gravatarImageUrl).to.not.be.null;
|
||||
expect(body.token).to.not.be.null;
|
||||
expect(body.lang).to.equal('en');
|
||||
bru.setVar("authToken", body.token);
|
||||
});
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
meta {
|
||||
name: 3-Sign in user wrong pw
|
||||
type: http
|
||||
seq: 4
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{addr}}/auth/sign-in
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"email": "{{testEmail}}",
|
||||
"password": "Teste@123.,11",
|
||||
"lang": "en"
|
||||
}
|
||||
}
|
||||
|
||||
tests {
|
||||
test("Status code is 401", function() {
|
||||
expect(res.getStatus()).to.equal(401);
|
||||
});
|
||||
|
||||
test("Response time is acceptable", function() {
|
||||
expect(res.getResponseTime()).to.be.below(3000);
|
||||
});
|
||||
|
||||
test("Content type is JSON", function() {
|
||||
expect(res.getHeader('content-type')).to.contain('application/json');
|
||||
});
|
||||
|
||||
test("Response has all data well set and defined", function() {
|
||||
const body = res.getBody();
|
||||
|
||||
expect(body).to.have.property('timestamp');
|
||||
expect(body).to.have.property('status');
|
||||
expect(body).to.have.property('error');
|
||||
expect(body).to.have.property('message');
|
||||
expect(body).to.have.property('path');
|
||||
|
||||
expect(body.timestamp).to.not.be.null;
|
||||
expect(body.status).to.equal(401);
|
||||
expect(body.error).to.equal('Unauthorized');
|
||||
expect(body.message).to.equal('Invalid credentials');
|
||||
expect(body.path).to.equal('/auth/sign-in');
|
||||
});
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
meta {
|
||||
name: Confirm Password Reset
|
||||
type: http
|
||||
seq: 8
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{addr}}/auth/complete-password-reset
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"token": "string",
|
||||
"password": "string",
|
||||
"passwordAgain": "string"
|
||||
}
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
meta {
|
||||
name: Email Confirmation
|
||||
type: http
|
||||
seq: 7
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{addr}}/auth/email-confirmation
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"email": "ricardompcampos@gmail.com"
|
||||
}
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
meta {
|
||||
name: ReSend Email
|
||||
type: http
|
||||
seq: 5
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{addr}}/auth/resend-email-confirmation
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"email": "ricardompcampos@gmail.com"
|
||||
}
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
meta {
|
||||
name: Reset Password
|
||||
type: http
|
||||
seq: 6
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{addr}}/auth/password-reset
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"email": "ricardompcampos@gmail.com"
|
||||
}
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
meta {
|
||||
name: Authentication
|
||||
seq: 2
|
||||
}
|
||||
|
||||
auth {
|
||||
mode: inherit
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
meta {
|
||||
name: 5-Get tags empty
|
||||
type: http
|
||||
seq: 3
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{addr}}/rest/home/tasks/tags
|
||||
body: none
|
||||
auth: none
|
||||
}
|
||||
|
||||
headers {
|
||||
Authorization: Bearer {{authToken}}
|
||||
}
|
||||
|
||||
tests {
|
||||
test("Response is an empty array", function() {
|
||||
const body = res.getBody();
|
||||
expect(body).to.be.an('array').that.is.empty;
|
||||
});
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
meta {
|
||||
name: Home
|
||||
seq: 4
|
||||
}
|
||||
|
||||
auth {
|
||||
mode: inherit
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
meta {
|
||||
name: Refresh
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{addr}}/rest/user-sessions/refresh
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
meta {
|
||||
name: Session
|
||||
seq: 2
|
||||
}
|
||||
|
||||
auth {
|
||||
mode: inherit
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
meta {
|
||||
name: Task
|
||||
seq: 3
|
||||
}
|
||||
|
||||
auth {
|
||||
mode: inherit
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
meta {
|
||||
name: 999-Delete account
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
delete {
|
||||
url: {{addr}}/rest/user-sessions/delete-account
|
||||
body: none
|
||||
auth: none
|
||||
}
|
||||
|
||||
headers {
|
||||
Authorization: Bearer {{authToken}}
|
||||
}
|
||||
|
||||
tests {
|
||||
test("Status code is 200", function() {
|
||||
expect(res.getStatus()).to.equal(200);
|
||||
});
|
||||
|
||||
test("Response time is acceptable", function() {
|
||||
expect(res.getResponseTime()).to.be.below(3000);
|
||||
});
|
||||
|
||||
test("User deletion response is valid", function() {
|
||||
const body = res.getBody();
|
||||
|
||||
// User ID assertions
|
||||
expect(body.userId).to.exist;
|
||||
expect(body.userId).to.be.a('number');
|
||||
expect(body.userId).to.be.greaterThan(0);
|
||||
|
||||
// Name should be null after deletion
|
||||
expect(body.name).to.be.null;
|
||||
|
||||
// Email assertions
|
||||
expect(body.email).to.exist;
|
||||
expect(body.email).to.be.a('string');
|
||||
expect(body.email).to.not.be.empty;
|
||||
expect(body.email).to.match(/^[\w\.-]+@[\w\.-]+\.\w+$/);
|
||||
|
||||
// Admin flag
|
||||
expect(body.admin).to.exist;
|
||||
expect(body.admin).to.be.a('boolean');
|
||||
|
||||
// CreatedAt assertions
|
||||
expect(body.createdAt).to.exist;
|
||||
expect(body.createdAt).to.be.a('string');
|
||||
expect(body.createdAt).to.match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/);
|
||||
|
||||
// InactivatedAt should exist and not be null (user was deleted)
|
||||
expect(body.inactivatedAt).to.exist;
|
||||
expect(body.inactivatedAt).to.not.be.null;
|
||||
expect(body.inactivatedAt).to.be.a('string');
|
||||
expect(body.inactivatedAt).to.match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/);
|
||||
|
||||
// Gravatar URL
|
||||
expect(body.gravatarImageUrl).to.exist;
|
||||
expect(body.gravatarImageUrl).to.be.a('string');
|
||||
expect(body.gravatarImageUrl).to.have.lengthOf(64); // SHA-256 hash length
|
||||
});
|
||||
|
||||
test("User was inactivated after creation", function() {
|
||||
const body = res.getBody();
|
||||
|
||||
const createdAt = new Date(body.createdAt);
|
||||
const inactivatedAt = new Date(body.inactivatedAt);
|
||||
|
||||
expect(inactivatedAt).to.be.greaterThan(createdAt);
|
||||
});
|
||||
|
||||
test("Email matches the test user", function() {
|
||||
const body = res.getBody();
|
||||
const expectedEmail = bru.getVar("testEmail");
|
||||
|
||||
expect(body.email).to.equal(expectedEmail);
|
||||
});
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
meta {
|
||||
name: User Session
|
||||
seq: 5
|
||||
}
|
||||
|
||||
auth {
|
||||
mode: inherit
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"version": "1",
|
||||
"name": "TaskNoteBruno",
|
||||
"type": "collection",
|
||||
"ignore": [
|
||||
"node_modules",
|
||||
".git"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
auth {
|
||||
mode: bearer
|
||||
}
|
||||
|
||||
auth:bearer {
|
||||
token: eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJKYXZhLUFQSSIsInN1YiI6InJpY2FyZG9tcGNhbXBvc0BnbWFpbC5jb20iLCJpYXQiOjE3NTgzOTQ5NzEsImV4cCI6MTc1ODk5OTc3MSwicm9sZXMiOltdLCJ1c2VySWQiOjEsImVtYWlsIjoicmljYXJkb21wY2FtcG9zQGdtYWlsLmNvbSJ9.ZdlouCYWF_kIEwJ2d7Nl3ASA6xS9OeSke84KXa94ugo
|
||||
}
|
||||
|
||||
vars:pre-request {
|
||||
addr: http://localhost:8585
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
vars {
|
||||
addr: http://localhost:8585
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
vars {
|
||||
addr: https://api.tasknoteapp.dev.br
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
vars {
|
||||
addr: https://stageapi.tasknoteapp.dev.br
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,63 @@
|
||||
# https://taskfile.dev
|
||||
|
||||
version: '3'
|
||||
|
||||
vars:
|
||||
GREETING: Hello, World!
|
||||
|
||||
tasks:
|
||||
docker-build-web:
|
||||
desc: Build the tasknote-web prod-ready docker image, tagging it as candidate
|
||||
cmd: docker build --no-cache --build-arg VITE_BUILD="v999-$(date '+%Y-%m-%d-%H%M%S')" --build-arg SOURCE_PR="v999-123456789-$(date '+%Y-%m-%d-%H%M%S')" -t ghcr.io/rmcampos/tasknote/app:latest ./client
|
||||
|
||||
docker-build-api:
|
||||
desc: Build the tasknote-api prod-ready docker image, tagging it as candidate
|
||||
cmd: cd server && mvn -Pnative -DskipTests spring-boot:build-image -Dspring-boot.build-image.imageName=ghcr.io/rmcampos/tasknote/api:latest -Dspring-boot.build-image.builder=paketobuildpacks/builder-jammy-tiny:latest
|
||||
|
||||
prod-up-web:
|
||||
desc: Speed up the tasknote-web prod-like image, building it if required
|
||||
cmd: docker compose -f docker-compose.prod.yml up -d tasknote-web
|
||||
|
||||
prod-up-api:
|
||||
desc: Speed up the tasknote-api prod-like image, building it if required
|
||||
cmd: docker compose -f docker-compose.prod.yml up -d tasknote-api
|
||||
|
||||
prod-up-db:
|
||||
desc: Start the database container
|
||||
cmd: docker compose -f docker-compose.prod.yml up -d tasknote-db
|
||||
|
||||
prod-up:
|
||||
desc: Speed up the prod-like images for both tasknote-api and tasknote-web, building them if required
|
||||
cmd: docker compose -f docker-compose.prod.yml up -d
|
||||
|
||||
prod-stop:
|
||||
desc: Stop prod containers
|
||||
cmd: docker compose -f docker-compose.prod.yml stop
|
||||
|
||||
prod-tier-down:
|
||||
desc: Stop and remove prod containers
|
||||
cmd: docker compose -f docker-compose.prod.yml down --remove-orphans
|
||||
|
||||
dev-run-web:
|
||||
desc: Get the tasknote-web up and running locally inside docker ready for development
|
||||
cmd: docker compose -f docker-compose.dev.yml up -d tasknote-web
|
||||
|
||||
dev-run-api:
|
||||
desc: Get the tasknote-api up and running locally inside docker ready for development
|
||||
cmd: docker compose -f docker-compose.dev.yml up -d tasknote-api
|
||||
|
||||
dev-run-db:
|
||||
desc: Get the tasknote-db up and running locally inside docker ready for development
|
||||
cmd: docker compose -f docker-compose.dev.yml up -d tasknote-db
|
||||
|
||||
dev-run:
|
||||
desc: Get both tasknote-web and tasknote-api up and running locally inside docker ready for development
|
||||
cmd: docker compose -f docker-compose.dev.yml up -d
|
||||
|
||||
dev-stop:
|
||||
desc: Stop dev containers
|
||||
cmd: docker compose -f docker-compose.dev.yml stop
|
||||
|
||||
dev-tier-down:
|
||||
desc: Stop and remove dev containers
|
||||
cmd: docker compose -f docker-compose.dev.yml down --remove-orphans
|
||||
@@ -0,0 +1,30 @@
|
||||
# Architecture Principles
|
||||
|
||||
## Core Principles
|
||||
|
||||
- Keep solutions simple and focused on the problem at hand.
|
||||
- Prefer readability and maintainability over cleverness.
|
||||
- Small functions and modules that do one thing well.
|
||||
- Use clear and descriptive names for variables, functions, and classes.
|
||||
- Avoid premature optimization; optimize only when necessary.
|
||||
- Avoid over-engineering; build only what is needed for the current problem.
|
||||
- Clear boundaries between components to promote separation of concerns.
|
||||
- Prefer to maintainability over perfection
|
||||
|
||||
## Delivery Principles
|
||||
|
||||
Prefer:
|
||||
- small specs
|
||||
- iterative delivery
|
||||
- vertical slices of functionality
|
||||
- simple APIs
|
||||
- clear documentation
|
||||
- understandable code
|
||||
|
||||
Avoid:
|
||||
- giant upfront architecture
|
||||
- premature optimization
|
||||
- speculative abstractions
|
||||
- over-engineering
|
||||
- unnecessary complexity
|
||||
- unnecessary microservices
|
||||
@@ -0,0 +1,17 @@
|
||||
# Domain Glossary
|
||||
|
||||
This glossary provides definitions for key terms and concepts related to the domain of artificial intelligence (AI). It serves as a reference for understanding the terminology used in AI research, development, and applications.
|
||||
|
||||
Use this file to maintain shared terminology.
|
||||
|
||||
Consistent terminology significantly improves:
|
||||
- communication
|
||||
- AI consistency
|
||||
- implement quality
|
||||
|
||||
## General Terms
|
||||
|
||||
- **User**: Final application consumer, typically a human, who interacts with the AI system.
|
||||
- **Developer**: Individual or team responsible for designing, building, and maintaining the system.
|
||||
- **Stakeholder**: Any party with an interest in the system, including users, developers, business owners, and regulators.
|
||||
- **Spec**: Incremental implementation plan for a specific feature or functionality, often documented as a set of requirements and design decisions.
|
||||
@@ -0,0 +1,31 @@
|
||||
# Project constraints
|
||||
|
||||
## Backend
|
||||
|
||||
Always:
|
||||
|
||||
- Use the `SERIAL` type for `id` columns when creating migration SQL files;
|
||||
- Define a table PRIMARY KEY in the end of the table columns using the table name plus `_pk` and the needed columns;
|
||||
- Import needed packages one by one;
|
||||
- Create JavaDoc for public classes and methods;
|
||||
- Run `./mvnw -Ptests test` to check possible check style issues or failing tests;
|
||||
- Fix existing test cases, if needed;
|
||||
- Update docker-compose.yml and github workflow files if a new variable or application.yml has changed;
|
||||
|
||||
Never:
|
||||
- Use `ON DELETE CASCADE` in SQL scripts or migration files;
|
||||
- Use star to import packages;
|
||||
|
||||
## Frontend
|
||||
|
||||
Always:
|
||||
|
||||
- Type variables according with their data type;
|
||||
- Create helper functions in the helper directory;
|
||||
- Update Dockerfile, docker-compose.yml and github workflow files if a new environment variable was added;
|
||||
|
||||
Never:
|
||||
|
||||
- Use the `any` type;
|
||||
- Add new dependencies for small helpers or util functions, prefer implementing them;
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
# Project Vision
|
||||
|
||||
## Project Name
|
||||
|
||||
TaskNote
|
||||
|
||||
## Problem Statement
|
||||
|
||||
In today's fast-paced world, individuals and teams often struggle to keep track of their tasks, deadlines, and project
|
||||
progress. Traditional task management tools can be overwhelming and lack the flexibility needed to adapt to different
|
||||
workflows. This leads to decreased productivity, missed deadlines, and increased stress.
|
||||
|
||||
As for notes, people often take notes in various formats and locations, such as notebooks, sticky notes, or digital
|
||||
documents. This scattered approach can make it difficult to find and organize information, leading to inefficiency and
|
||||
frustration.
|
||||
|
||||
## Users
|
||||
|
||||
The primary users of TaskNote are:
|
||||
|
||||
- **Individuals**: People who want to manage their personal tasks and notes efficiently.
|
||||
- **Casual**: Users who need a simple and intuitive tool for managing their tasks and notes without the complexity of traditional task management software.
|
||||
- **Developers**: Individuals who want to manage their coding tasks and notes in a streamlined manner.
|
||||
|
||||
## Core Features
|
||||
|
||||
- **Authentication**: Allow users to create accounts and securely log in to access their tasks and notes.
|
||||
- **Task Management**: Create, organize, and prioritize tasks with deadlines and reminders.
|
||||
- **Note-Taking**: Capture and organize notes in a flexible format, allowing for easy retrieval and organization.
|
||||
- **Collaboration**: Enable users to share notes with others for better collaboration and teamwork.
|
||||
- **Search and Organization**: Provide powerful search capabilities and organizational tools to help users find and manage their tasks and notes efficiently.
|
||||
- **Multi-Language Support**: Support multiple languages to cater to a global user base.
|
||||
|
||||
## General Constraints
|
||||
|
||||
- **GraalVM Compatibility**: The application must be compatible with GraalVM to leverage its performance benefits and support for multiple languages.
|
||||
- **Mobile-first UI**: The user interface should be designed with a mobile-first approach to ensure a seamless experience across devices.
|
||||
|
||||
## Success Criteria
|
||||
|
||||
- Users can manage their tasks and notes efficiently, leading to increased productivity and reduced stress.
|
||||
- Positive user feedback and high engagement with the application.
|
||||
- Specs remain under control, with a clear roadmap for future features and improvements.
|
||||
- Codebase remains maintainable and scalable, allowing for easy addition of new features and improvements over time.
|
||||
@@ -0,0 +1,34 @@
|
||||
# Tech Stack
|
||||
|
||||
## Frontend
|
||||
|
||||
- **React**: A popular JavaScript library for building user interfaces, particularly single-page applications.
|
||||
- **TypeScript**: A superset of JavaScript that adds static typing, improving code quality and maintainability.
|
||||
- **Bootstrap**: A widely used CSS framework for building responsive and mobile-first websites.
|
||||
- **Fetch API**: A modern interface for making HTTP requests from the browser, used for communicating with the backend.
|
||||
- **Vite**: A build tool that provides a fast development environment and optimized production builds for modern web applications.
|
||||
|
||||
## Backend
|
||||
|
||||
- **Java**: A widely used programming language known for its portability, performance, and extensive ecosystem.
|
||||
- **Spring Boot**: A framework for building production-ready applications with Java, providing features like dependency injection, security, and data access.
|
||||
- **Spring Security**: A framework for securing Java applications, providing authentication and authorization features to protect resources and manage user access.
|
||||
- **GraalVM**: A high-performance runtime that supports multiple programming languages, allowing for efficient execution of Java applications and interoperability with other languages.
|
||||
- **JPA (Java Persistence API)**: A specification for managing relational data in Java applications, providing a standard way to interact with databases using object-relational mapping (ORM).
|
||||
|
||||
## Database
|
||||
- **PostgreSQL**: A powerful, open-source relational database management system known for its reliability and performance.
|
||||
|
||||
## Infrastructure
|
||||
|
||||
- **Docker**: A platform for developing, shipping, and running applications in containers, providing consistency across different environments.
|
||||
- **Kubernetes**: An open-source container orchestration system for automating the deployment, scaling, and management of containerized applications.
|
||||
- **Terraform**: An infrastructure as code tool that allows for the provisioning and management of cloud resources in a declarative manner.
|
||||
- **VPS**: Virtual Private Server, a virtualized server that provides dedicated resources and control over the hosting environment for deploying applications.
|
||||
|
||||
## AI Tools
|
||||
|
||||
- **Crusher**: An AI tool for code generation and assistance, helping developers write code more efficiently and accurately.
|
||||
- **GitHub Copilot**: An AI-powered code completion tool that provides suggestions and helps developers write code faster by leveraging machine learning models trained on a vast amount of code from GitHub repositories.
|
||||
- **Gemini**: An AI tool for natural language processing and understanding, enabling developers to build applications that can process and generate human-like text.
|
||||
- **Groq**: An AI tool for optimizing and accelerating machine learning models, providing efficient execution and improved performance for AI applications.
|
||||
@@ -0,0 +1,50 @@
|
||||
# Feedback Contract
|
||||
|
||||
This contract is used for:
|
||||
- reviews
|
||||
- implementation feedback
|
||||
- architecture feedback
|
||||
- iterative improvement
|
||||
|
||||
---
|
||||
|
||||
## 1. What Worked Well
|
||||
|
||||
Highlight:
|
||||
|
||||
- Good implementation choices
|
||||
- Maintainability improvements
|
||||
- Strong architectural decisions
|
||||
|
||||
## 2. Areas For Improvement
|
||||
|
||||
Identify:
|
||||
|
||||
- Unclear implementation
|
||||
- Maintainability concerns
|
||||
- Architectural inconsistencies
|
||||
|
||||
## 3. Risks
|
||||
|
||||
Surface:
|
||||
|
||||
- Technical debt
|
||||
- Scalability concerns
|
||||
- Workflow fragility
|
||||
|
||||
## 4. Recommendations
|
||||
|
||||
Provide:
|
||||
|
||||
- Practical improvements
|
||||
- Simplification opportunities
|
||||
- Next iteration suggestions
|
||||
|
||||
## Philosophy
|
||||
|
||||
Feedback should:
|
||||
|
||||
- Improve clarity
|
||||
- Support maintainability
|
||||
- Remain constructive
|
||||
- Avoid unnecessary perfectionism
|
||||
@@ -0,0 +1,68 @@
|
||||
# Handoff Contract
|
||||
|
||||
This contract is used whenever work moves between roles.
|
||||
|
||||
Example:
|
||||
- PM → Architect
|
||||
- Architect → Developer
|
||||
- Developer → Reviewer
|
||||
|
||||
---
|
||||
|
||||
## 1. Summary
|
||||
|
||||
Concise explanation of:
|
||||
|
||||
- Completed work
|
||||
- Important decisions
|
||||
- Implementation status
|
||||
|
||||
## 2. Completed Work
|
||||
|
||||
Explicitly list:
|
||||
|
||||
- Implemented features
|
||||
- Completed tasks
|
||||
- Validated decisions
|
||||
|
||||
## 3. Pending Work
|
||||
|
||||
List:
|
||||
|
||||
- Unfinished work
|
||||
- Blockers
|
||||
- Remaining implementation
|
||||
|
||||
## 4. Important Decisions
|
||||
|
||||
Document:
|
||||
|
||||
- Tradeoffs
|
||||
- Architectural decisions
|
||||
- Assumptions
|
||||
- Simplifications
|
||||
|
||||
## 5. Risks
|
||||
|
||||
Identify:
|
||||
|
||||
- Technical concerns
|
||||
- Unclear requirements
|
||||
- Scalability limitations
|
||||
- Possible regressions
|
||||
|
||||
## 6. Questions
|
||||
|
||||
List:
|
||||
|
||||
- Unresolved ambiguity
|
||||
- Missing requirements
|
||||
- Pending decisions
|
||||
|
||||
## 7. Recommended Next Step
|
||||
|
||||
Clearly explain:
|
||||
|
||||
- What should happen next
|
||||
- Which role should act next
|
||||
- What should be prioritized
|
||||
@@ -0,0 +1,58 @@
|
||||
# Question Contract
|
||||
|
||||
## Description
|
||||
|
||||
This contract is used when:
|
||||
|
||||
- Requirements are not clear
|
||||
- Assumptions must be validated
|
||||
- More information is needed to proceed
|
||||
- Implementation direction is uncertain
|
||||
|
||||
## 1. Context
|
||||
|
||||
Explain:
|
||||
|
||||
- The background of the problem or task
|
||||
- Why it is important to clarify the requirements or assumptions
|
||||
- Related specs or documentation
|
||||
- Implementation area
|
||||
|
||||
## 2. Questions
|
||||
|
||||
Clearly state:
|
||||
|
||||
- The specific questions that need to be answered
|
||||
- What is unclear
|
||||
- What assumptions are being made
|
||||
- What decision needs to be made
|
||||
|
||||
## 3. Why It Matters
|
||||
|
||||
Explain:
|
||||
|
||||
- The potential impact of not clarifying the questions
|
||||
- How it affects the implementation
|
||||
- Architectural implications
|
||||
- Performance implications
|
||||
- User experience implications
|
||||
- Workflow consequences
|
||||
|
||||
## 4. Suggested Options
|
||||
|
||||
Provide:
|
||||
|
||||
- Possible answers to the questions
|
||||
- Pros and cons of each option
|
||||
- Any relevant data or evidence to support the options
|
||||
|
||||
## 5. Philosophy
|
||||
|
||||
Good questions reduce:
|
||||
|
||||
- Hallucinations
|
||||
- Unnecessary work
|
||||
- Rework
|
||||
- Implementation drift
|
||||
- Misalignment with requirements
|
||||
- Hidden assumptions
|
||||
@@ -0,0 +1,56 @@
|
||||
# Context Policy
|
||||
|
||||
AI systems perform significantly better when context is:
|
||||
- structured
|
||||
- concise
|
||||
- consistent
|
||||
- relevant
|
||||
|
||||
## Core Rules
|
||||
|
||||
### 1. Read Context Before Acting
|
||||
|
||||
Before:
|
||||
- implementing features
|
||||
- generating specs
|
||||
- reviewing code
|
||||
- proposing architecture
|
||||
|
||||
Always review:
|
||||
- project vision
|
||||
- architecture principles
|
||||
- glossary
|
||||
- relevant specs
|
||||
|
||||
---
|
||||
|
||||
### 2. Respect Shared Terminology
|
||||
|
||||
Use terminology consistently.
|
||||
|
||||
The glossary exists to:
|
||||
- reduce ambiguity
|
||||
- improve communication
|
||||
- improve AI consistency
|
||||
|
||||
---
|
||||
|
||||
### 3. Avoid Context Overload
|
||||
|
||||
More context is NOT always better.
|
||||
|
||||
Prefer:
|
||||
- focused context
|
||||
- relevant files
|
||||
- small scoped discussions
|
||||
|
||||
---
|
||||
|
||||
### 4. Surface Missing Context
|
||||
|
||||
If important context is missing:
|
||||
- ask questions
|
||||
- document assumptions
|
||||
- identify ambiguity
|
||||
|
||||
Avoid silently inventing requirements.
|
||||
@@ -0,0 +1,39 @@
|
||||
# Handoff Rules
|
||||
|
||||
Every handoff between roles should include:
|
||||
|
||||
- completed work
|
||||
- pending work
|
||||
- risks
|
||||
- important decisions
|
||||
- open questions
|
||||
- recommended next step
|
||||
|
||||
---
|
||||
|
||||
## Goals
|
||||
|
||||
Handoffs exist to:
|
||||
- preserve continuity
|
||||
- reduce ambiguity
|
||||
- improve collaboration
|
||||
- support incremental delivery
|
||||
|
||||
---
|
||||
|
||||
## Good Handoffs
|
||||
|
||||
Good handoffs are:
|
||||
- concise
|
||||
- explicit
|
||||
- actionable
|
||||
- context-aware
|
||||
|
||||
Avoid vague summaries.
|
||||
|
||||
---
|
||||
|
||||
## Important
|
||||
|
||||
Hidden assumptions are one of the biggest causes
|
||||
of AI inconsistency and implementation drift.
|
||||
@@ -0,0 +1,40 @@
|
||||
# Orchestrator
|
||||
|
||||
The orchestrator coordinates:
|
||||
- context
|
||||
- specs
|
||||
- architecture
|
||||
- implementation
|
||||
- review workflows
|
||||
|
||||
## Primary Goals
|
||||
|
||||
- maintain incremental progress
|
||||
- reduce ambiguity
|
||||
- preserve consistency
|
||||
- support maintainability
|
||||
|
||||
---
|
||||
|
||||
## Orchestration Responsibilities
|
||||
|
||||
- identify next executable spec
|
||||
- validate dependencies
|
||||
- coordinate role transitions
|
||||
- ensure contracts are respected
|
||||
- maintain delivery momentum
|
||||
|
||||
---
|
||||
|
||||
## Workflow Philosophy
|
||||
|
||||
Prefer:
|
||||
- small focused steps
|
||||
- explicit transitions
|
||||
- structured handoffs
|
||||
- iterative delivery
|
||||
|
||||
Avoid:
|
||||
- giant implementation phases
|
||||
- uncontrolled context growth
|
||||
- hidden assumptions
|
||||
@@ -0,0 +1,71 @@
|
||||
# AI Workflow
|
||||
|
||||
This repository follows a lightweight AI-native engineering workflow.
|
||||
|
||||
```text
|
||||
Context → Specs → Architecture → Implementation → Review → Iteration
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 1. Context Definition
|
||||
|
||||
Goal: create shared understanding.
|
||||
|
||||
Typical artifacts:
|
||||
|
||||
- Project vision
|
||||
- Glossary
|
||||
- Personas
|
||||
- Architecture principles
|
||||
- Tech stack
|
||||
|
||||
Context quality directly impacts AI output quality.
|
||||
|
||||
# 2. Spec Generation
|
||||
|
||||
Goal: break work into small incremental deliverables.
|
||||
|
||||
Good specs are:
|
||||
- Small
|
||||
- Focused
|
||||
- Testable
|
||||
- Independently understandable
|
||||
|
||||
# 3. Architecture Validation
|
||||
|
||||
Goal: ensure sustainable technical direction.
|
||||
|
||||
Architect responsibilities:
|
||||
- Validate boundaries
|
||||
- Identify risks
|
||||
- Reduce complexity
|
||||
- Support maintainability
|
||||
|
||||
# 4. Implementation
|
||||
|
||||
Goal: deliver working software incrementally.
|
||||
|
||||
Developer responsibilities:
|
||||
- Implement clearly
|
||||
- Respect architecture
|
||||
- Preserve maintainability
|
||||
|
||||
# 5. Testing & Review
|
||||
|
||||
Goal: validate correctness and maintainability.
|
||||
|
||||
Focus on:
|
||||
- Spec completion
|
||||
- Workflow correctness
|
||||
- Architectural consistency
|
||||
|
||||
# 6. Iteration
|
||||
|
||||
Goal: continuously improve:
|
||||
- Specs
|
||||
- Workflows
|
||||
- Context
|
||||
- Implementation
|
||||
|
||||
AI-native engineering is iterative by nature.
|
||||
@@ -0,0 +1,53 @@
|
||||
# Role: Architect
|
||||
|
||||
You are responsible for maintaining technical clarity,
|
||||
system boundaries, and implementation simplicity.
|
||||
|
||||
## Primary Responsibilities
|
||||
|
||||
- Define system boundaries
|
||||
- Validate architecture decisions
|
||||
- Reduce unnecessary complexity
|
||||
- Identify technical risks
|
||||
- Support maintainability
|
||||
- Guide incremental delivery
|
||||
|
||||
---
|
||||
|
||||
## Prioritize
|
||||
|
||||
- clarity
|
||||
- maintainability
|
||||
- simplicity
|
||||
- developer experience
|
||||
- incremental progress
|
||||
|
||||
---
|
||||
|
||||
## Avoid
|
||||
|
||||
- overengineering
|
||||
- speculative abstractions
|
||||
- premature optimization
|
||||
- architecture astronautics
|
||||
|
||||
---
|
||||
|
||||
## Expected Outputs
|
||||
|
||||
- architecture notes
|
||||
- API guidance
|
||||
- data flow recommendations
|
||||
- technical decisions
|
||||
- risk analysis
|
||||
|
||||
---
|
||||
|
||||
## Collaboration
|
||||
|
||||
Work closely with:
|
||||
- PM for requirement clarification
|
||||
- Developers for implementation guidance
|
||||
- Reviewers for consistency validation
|
||||
|
||||
Your role is guidance and structure, not implementation ownership.
|
||||
@@ -0,0 +1,49 @@
|
||||
# Role: Developer
|
||||
|
||||
You are responsible for implementing specs incrementally,
|
||||
clearly, and maintainably.
|
||||
|
||||
## Primary Responsibilities
|
||||
|
||||
- Implement specs
|
||||
- Respect architecture boundaries
|
||||
- Keep code maintainable
|
||||
- Surface blockers early
|
||||
- Preserve readability
|
||||
|
||||
---
|
||||
|
||||
## Engineering Philosophy
|
||||
|
||||
Prefer:
|
||||
- explicit logic
|
||||
- composable systems
|
||||
- simple implementations
|
||||
- incremental delivery
|
||||
|
||||
Avoid:
|
||||
- unnecessary abstractions
|
||||
- giant refactors
|
||||
- hidden side effects
|
||||
- premature optimization
|
||||
|
||||
---
|
||||
|
||||
## Before Implementation
|
||||
|
||||
Always review:
|
||||
- project context
|
||||
- architecture principles
|
||||
- current spec
|
||||
- related workflows
|
||||
|
||||
---
|
||||
|
||||
## Expected Outputs
|
||||
|
||||
- implementation code
|
||||
- tests
|
||||
- documentation
|
||||
- migrations
|
||||
- APIs
|
||||
- technical notes
|
||||
@@ -0,0 +1,40 @@
|
||||
# Role: Product Manager
|
||||
|
||||
You are responsible for:
|
||||
- reducing ambiguity
|
||||
- clarifying requirements
|
||||
- prioritizing delivery
|
||||
- maintaining user focus
|
||||
|
||||
## Responsibilities
|
||||
|
||||
- refine specs
|
||||
- clarify user value
|
||||
- define acceptance criteria
|
||||
- reduce scope ambiguity
|
||||
- support incremental delivery
|
||||
|
||||
---
|
||||
|
||||
## Product Philosophy
|
||||
|
||||
Prefer:
|
||||
- small focused specs
|
||||
- clear workflows
|
||||
- simple user journeys
|
||||
- fast iteration
|
||||
|
||||
Avoid:
|
||||
- oversized features
|
||||
- vague requirements
|
||||
- unnecessary complexity
|
||||
|
||||
---
|
||||
|
||||
## Success Criteria
|
||||
|
||||
A good spec should be:
|
||||
- understandable
|
||||
- implementable
|
||||
- testable
|
||||
- incremental
|
||||
@@ -0,0 +1,36 @@
|
||||
# Role: Reviewer
|
||||
|
||||
You are responsible for validating:
|
||||
- quality
|
||||
- maintainability
|
||||
- spec completion
|
||||
- architectural consistency
|
||||
|
||||
## Responsibilities
|
||||
|
||||
- Verify acceptance criteria
|
||||
- Validate readability
|
||||
- Identify technical debt
|
||||
- Surface risks
|
||||
- Recommend improvements
|
||||
|
||||
---
|
||||
|
||||
## Review Philosophy
|
||||
|
||||
Focus on:
|
||||
- practical maintainability
|
||||
- implementation clarity
|
||||
- architecture consistency
|
||||
|
||||
Avoid:
|
||||
- perfectionism
|
||||
- unnecessary nitpicks
|
||||
- overcomplicated suggestions
|
||||
|
||||
---
|
||||
|
||||
## Important
|
||||
|
||||
The goal is sustainable delivery,
|
||||
not theoretical perfection.
|
||||
@@ -0,0 +1,36 @@
|
||||
# Role: Tester
|
||||
|
||||
You are responsible for validating:
|
||||
- expected behavior
|
||||
- acceptance criteria
|
||||
- workflow correctness
|
||||
- critical edge cases
|
||||
|
||||
## Responsibilities
|
||||
|
||||
- validate specs
|
||||
- test workflows
|
||||
- identify regressions
|
||||
- surface inconsistencies
|
||||
|
||||
---
|
||||
|
||||
## Testing Philosophy
|
||||
|
||||
Focus on:
|
||||
- critical workflows
|
||||
- realistic scenarios
|
||||
- maintainability
|
||||
- clarity
|
||||
|
||||
Avoid:
|
||||
- unnecessary exhaustive testing
|
||||
- unrealistic edge cases
|
||||
- overcomplicated testing strategies
|
||||
|
||||
---
|
||||
|
||||
## Important
|
||||
|
||||
The goal is confidence and reliability,
|
||||
not perfect theoretical coverage.
|
||||
@@ -0,0 +1,14 @@
|
||||
# Skill: Create Handoff Contract
|
||||
|
||||
Good handoffs preserve:
|
||||
- continuity
|
||||
- implementation context
|
||||
- architectural decisions
|
||||
|
||||
Include:
|
||||
- summary
|
||||
- completed work
|
||||
- pending work
|
||||
- risks
|
||||
- questions
|
||||
- recommended next step
|
||||
@@ -0,0 +1,14 @@
|
||||
# Skill: Review Code Quality
|
||||
|
||||
## Focus Areas
|
||||
|
||||
- readability
|
||||
- maintainability
|
||||
- consistency
|
||||
- architectural alignment
|
||||
|
||||
## Avoid
|
||||
|
||||
- unnecessary nitpicks
|
||||
- perfectionism
|
||||
- speculative suggestions
|
||||
@@ -0,0 +1,19 @@
|
||||
# Skill: Write Spec
|
||||
|
||||
## Goal
|
||||
|
||||
Create small incremental implementation specs.
|
||||
|
||||
## Good Specs
|
||||
|
||||
Good specs:
|
||||
- have clear goals
|
||||
- define acceptance criteria
|
||||
- remain focused
|
||||
- avoid ambiguity
|
||||
|
||||
## Avoid
|
||||
|
||||
- giant specs
|
||||
- vague requirements
|
||||
- mixing unrelated concerns
|
||||
@@ -0,0 +1,14 @@
|
||||
# Skill: Write Tests
|
||||
|
||||
## Prioritize
|
||||
|
||||
- critical workflows
|
||||
- expected behavior
|
||||
- important edge cases
|
||||
|
||||
## Philosophy
|
||||
|
||||
Testing should improve:
|
||||
- confidence
|
||||
- reliability
|
||||
- maintainability
|
||||
@@ -0,0 +1,58 @@
|
||||
# Spec: Support Multiple Tags for Tasks and Notes
|
||||
|
||||
## Goal
|
||||
|
||||
Enable users to associate multiple tags with both tasks and notes, enhancing organization and search capabilities.
|
||||
|
||||
---
|
||||
|
||||
## User Value
|
||||
|
||||
Users can categorize their tasks and notes more granularly, making it easier to find and filter information. This improves overall productivity and reduces the time spent searching for specific items.
|
||||
|
||||
---
|
||||
|
||||
## Requirements
|
||||
|
||||
- Users must be able to add multiple tags to a single task.
|
||||
- Users must be able to add multiple tags to a single note.
|
||||
- The system should support adding new tags and selecting existing tags.
|
||||
- Display of multiple tags associated with tasks and notes in the UI.
|
||||
- Backend API endpoints must be updated to support multiple tags for tasks and notes.
|
||||
- Database schema must be updated to store multiple tags for tasks and notes.
|
||||
|
||||
---
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- [ ] When editing a task, a user can add more than one tag.
|
||||
- [ ] When editing a note, a user can add more than one tag.
|
||||
- [ ] All tags associated with a task are displayed when viewing the task.
|
||||
- [ ] All tags associated with a note are displayed when viewing the note.
|
||||
- [ ] Users can filter tasks by multiple tags.
|
||||
- [ ] Users can filter notes by multiple tags.
|
||||
- [ ] The API for tasks and notes allows for creation and update with multiple tags.
|
||||
- [ ] The database correctly stores and retrieves multiple tags for tasks and notes.
|
||||
|
||||
---
|
||||
|
||||
## Dependencies
|
||||
|
||||
None.
|
||||
|
||||
---
|
||||
|
||||
## Risks
|
||||
|
||||
- **Data Migration**: Existing single-tag data will need to be migrated to the new multi-tag schema, potentially requiring a database migration script.
|
||||
- **Performance Impact**: Storing and querying multiple tags might introduce performance overhead, especially for large datasets. This will need careful indexing and optimization.
|
||||
- **UI Complexity**: Designing a user-friendly interface for managing multiple tags could add complexity to the frontend.
|
||||
- **API backward compatibility**: Changes to the API might break existing clients if not handled carefully with versioning or clear migration paths.
|
||||
|
||||
---
|
||||
|
||||
## Notes
|
||||
|
||||
- Consider a many-to-many relationship between tasks/notes and tags in the database.
|
||||
- Frontend tag input should allow for auto-completion of existing tags.
|
||||
- The API should handle tag creation on the fly if a new tag is submitted.
|
||||
@@ -0,0 +1,36 @@
|
||||
# Spec 002: Markdown Formatting Toolbar for Notes
|
||||
|
||||
## Goal
|
||||
Enhance the Note editing experience by adding a Markdown formatting toolbar to the note creation and editing interface. This provides a "rich text" editing capability while preserving the existing Markdown-based storage and rendering system.
|
||||
|
||||
## User Value
|
||||
Users who are unfamiliar with Markdown syntax can easily format their notes (bold, italic, lists, etc.) using familiar UI controls. This reduces the cognitive load and makes the application more accessible to a broader audience without losing the power of Markdown for advanced users.
|
||||
|
||||
## Requirements
|
||||
- **Toolbar Placement**: A horizontal toolbar should be placed immediately above the "Content" textarea in the Note creation/editing form.
|
||||
- **Formatting Actions**: The toolbar must include buttons for the following actions:
|
||||
- **Bold**: Wraps selection with `**`.
|
||||
- **Italic**: Wraps selection with `_`.
|
||||
- **Heading**: Prepends `### ` to the current line or selection.
|
||||
- **Bullet List**: Prepends `- ` to the current line or selection.
|
||||
- **Link**: Inserts a Markdown link template `[text](url)`.
|
||||
- **Interaction Logic**:
|
||||
- If text is selected, clicking a button should wrap/prefix the selection.
|
||||
- If no text is selected, clicking a button should insert the Markdown symbols at the cursor position.
|
||||
- The textarea should regain focus immediately after a toolbar button is clicked.
|
||||
- **Styling**: The toolbar should use standard Bootstrap components (e.g., `ButtonGroup`) and icons (e.g., `react-bootstrap-icons`) to match the existing project aesthetic.
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] The toolbar is visible in the `NoteAdd` view for both adding a new note and editing an existing one.
|
||||
- [ ] Clicking the **Bold** button wraps the selected text in the textarea with `**`.
|
||||
- [ ] Clicking the **Italic** button wraps the selected text with `_`.
|
||||
- [ ] Clicking the **Heading** button adds `### ` at the cursor or selection start.
|
||||
- [ ] Clicking the **Bullet List** button adds `- ` at the start of the line.
|
||||
- [ ] Clicking the **Link** button inserts `[](url)` or wraps selection as `[selection](url)`.
|
||||
- [ ] The note can be saved successfully with the newly formatted content.
|
||||
- [ ] The "Preview Markdown" modal correctly renders the formatted content.
|
||||
|
||||
## Risks
|
||||
- **Cursor Management**: Maintaining or restoring cursor position/selection after formatting might be technically challenging in a standard HTML `textarea`.
|
||||
- **Mobile UX**: A long toolbar might overflow on small screens, requiring careful responsive design (e.g., horizontal scrolling or wrapping).
|
||||
- **Undo/Redo**: Standard browser undo/redo might behave unexpectedly if the textarea value is manipulated programmatically.
|
||||
@@ -0,0 +1,33 @@
|
||||
# Specs
|
||||
|
||||
Specs are the primary implementation units in this repository.
|
||||
|
||||
## Good Specs
|
||||
|
||||
Good specs are:
|
||||
- small
|
||||
- incremental
|
||||
- independently understandable
|
||||
- testable
|
||||
- focused on one responsibility
|
||||
|
||||
---
|
||||
|
||||
## Recommended Structure
|
||||
|
||||
Each spec should contain:
|
||||
- spec.md
|
||||
- architecture.md
|
||||
- tasks.md
|
||||
- optional contracts/
|
||||
|
||||
---
|
||||
|
||||
## Recommended Size
|
||||
|
||||
Prefer:
|
||||
- 3 to 8 specs maximum for dojo projects
|
||||
|
||||
Avoid:
|
||||
- giant umbrella specs
|
||||
- multi-week implementation specs
|
||||
@@ -0,0 +1,43 @@
|
||||
# Spec: <name>
|
||||
|
||||
## Goal
|
||||
|
||||
What are we building?
|
||||
|
||||
---
|
||||
|
||||
## User Value
|
||||
|
||||
Why does this matter?
|
||||
|
||||
---
|
||||
|
||||
## Requirements
|
||||
|
||||
- Requirement 1
|
||||
- Requirement 2
|
||||
|
||||
---
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- [ ] Criteria 1
|
||||
- [ ] Criteria 2
|
||||
|
||||
---
|
||||
|
||||
## Dependencies
|
||||
|
||||
List required previous specs.
|
||||
|
||||
---
|
||||
|
||||
## Risks
|
||||
|
||||
Identify possible implementation risks.
|
||||
|
||||
---
|
||||
|
||||
## Notes
|
||||
|
||||
Additional implementation guidance.
|
||||
@@ -0,0 +1,16 @@
|
||||
# Orchestration Prompt
|
||||
|
||||
Using the orchestrator workflow defined at `ai/orchestration/orchestrator.md`,
|
||||
execute the first spec file, 001-add-multiple-tags.md.
|
||||
|
||||
Respect:
|
||||
- architecture principles
|
||||
- role responsibilities
|
||||
- context policies
|
||||
- handoff rules
|
||||
|
||||
Keep implementation:
|
||||
- simple
|
||||
- maintainable
|
||||
- incremental
|
||||
- production-like
|
||||
@@ -0,0 +1,22 @@
|
||||
# Spec for a feature prompt example
|
||||
|
||||
Based on the project context, defined at `ai/context/*.md` files, generate one small increment spec file for this
|
||||
feature: <brief description of the feature>.
|
||||
|
||||
Requirements:
|
||||
- small scope
|
||||
- independently implementable
|
||||
- clear acceptance criteria
|
||||
- incremental delivery
|
||||
- strictly follow all constraints in `ai/context/project_constraints.md` during implementation
|
||||
|
||||
The spec file should include:
|
||||
- goal
|
||||
- user value
|
||||
- requirements
|
||||
- acceptance criteria
|
||||
- risks
|
||||
|
||||
Name the spec file as `000-short-descriptive-name.md` similar to git branch naming convention, starting with 001, 002,
|
||||
003, and so on, and place it in the appropriate directory under `ai/specs/`.
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
# Spec Generation Prompt
|
||||
|
||||
Based on the project context,
|
||||
generate 3 to 8 small incremental specs.
|
||||
|
||||
Requirements:
|
||||
- small scope
|
||||
- independently implementable
|
||||
- clear acceptance criteria
|
||||
- incremental delivery
|
||||
- avoid overengineering
|
||||
|
||||
Each spec should include:
|
||||
- goal
|
||||
- user value
|
||||
- requirements
|
||||
- acceptance criteria
|
||||
- risks
|
||||
@@ -0,0 +1,11 @@
|
||||
module.exports = {
|
||||
arrowParens: 'avoid',
|
||||
bracketSameLine: true,
|
||||
bracketSpacing: false,
|
||||
singleQuote: false,
|
||||
trailingComma: 'all',
|
||||
tabWidth: 2,
|
||||
useTabs: false,
|
||||
semi: true,
|
||||
printWidth: 80
|
||||
};
|
||||
@@ -0,0 +1,61 @@
|
||||
{
|
||||
auto_https off
|
||||
admin off
|
||||
}
|
||||
|
||||
:5000 {
|
||||
root * /app/dist
|
||||
|
||||
encode gzip
|
||||
|
||||
log {
|
||||
output stdout
|
||||
format console {
|
||||
time_format iso8601
|
||||
level_format color
|
||||
}
|
||||
level "INFO"
|
||||
}
|
||||
|
||||
header {
|
||||
X-Frame-Options "SAMEORIGIN"
|
||||
X-XSS-Protection "1;mode=block"
|
||||
Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate"
|
||||
X-Content-Type-Options "nosniff"
|
||||
Strict-Transport-Security "max-age=31536000"
|
||||
Content-Security-Policy "
|
||||
base-uri 'self';
|
||||
connect-src 'self' {$VITE_BACKEND_SERVER};
|
||||
default-src 'self' data:;
|
||||
font-src 'self' https://fonts.gstatic.com/ https://cdn.jsdelivr.net/;
|
||||
frame-src 'self';
|
||||
img-src 'self' data: https://gravatar.com/;
|
||||
manifest-src 'self';
|
||||
media-src 'self';
|
||||
object-src 'none';
|
||||
script-src 'unsafe-inline' 'report-sample' 'self' https://*.cloudfront.net;
|
||||
style-src 'report-sample' 'self' https://cdn.jsdelivr.net/ https://fonts.googleapis.com 'sha256-+OsIn6RhyCZCUkkvtHxFtP0kU3CGdGeLjDd9Fzqdl3o=';
|
||||
worker-src 'none';
|
||||
"
|
||||
Referrer-Policy "same-origin"
|
||||
}
|
||||
|
||||
handle /env.js {
|
||||
header Content-Type "text/javascript"
|
||||
respond `window.config = {"VITE_BACKEND_SERVER":"{$VITE_BACKEND_SERVER}","VITE_BUILD":"{$VITE_BUILD}"};`
|
||||
}
|
||||
|
||||
handle /favicon.ico {
|
||||
file_server
|
||||
}
|
||||
|
||||
file_server
|
||||
|
||||
handle_errors {
|
||||
@404 {
|
||||
expression {http.error.status_code} == 404
|
||||
}
|
||||
rewrite @404 /
|
||||
file_server
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
# Build static files
|
||||
# Node Bullseye has npm
|
||||
FROM node:22.14-bookworm-slim AS build
|
||||
ENV NODE_OPTIONS="--max-old-space-size=3072"
|
||||
|
||||
# Build
|
||||
WORKDIR /app
|
||||
COPY *.html *.json *.ts ./
|
||||
COPY ./src ./src
|
||||
COPY ./public ./public
|
||||
RUN npm i --ignore-scripts --no-update-notifier --omit=dev && \
|
||||
npm run build && \
|
||||
rm -rf node_modules
|
||||
|
||||
# Deploy container
|
||||
# Caddy serves static files
|
||||
FROM caddy:2.10.2-alpine
|
||||
RUN apk add --no-cache ca-certificates curl
|
||||
|
||||
# Receive build number as argument, retain as environment variable
|
||||
ARG VITE_BUILD
|
||||
ARG SOURCE_PR
|
||||
ENV VITE_BUILD=${VITE_BUILD}
|
||||
ENV SOURCE_PR=${SOURCE_PR}
|
||||
|
||||
# Add metadata to the final image
|
||||
LABEL org.opencontainers.image.authors="Ricardo Campos <ricardompcampos@gmail.com>" \
|
||||
org.opencontainers.image.vendor="Ricardo Campos Org" \
|
||||
org.opencontainers.image.title="TaskNoteApp client" \
|
||||
org.opencontainers.image.description="React Web app application" \
|
||||
org.opencontainers.image.version="${SOURCE_PR}" \
|
||||
org.opencontainers.image.source="https://github.com/ricardo-campos-org/react-typescript-todolist"
|
||||
|
||||
# Copy files and run formatting
|
||||
COPY --from=build /app/dist/ /app/dist
|
||||
COPY Caddyfile /etc/caddy/Caddyfile
|
||||
RUN caddy fmt --overwrite /etc/caddy/Caddyfile
|
||||
|
||||
# User, port and healthcheck
|
||||
EXPOSE 5000
|
||||
HEALTHCHECK CMD curl -f http://localhost:5000
|
||||
USER 1001
|
||||
@@ -0,0 +1,4 @@
|
||||
FROM node:22.14-bookworm-slim
|
||||
WORKDIR /app
|
||||
HEALTHCHECK CMD timeout 10s bash -c 'true > /dev/tcp/127.0.0.1/5000'
|
||||
CMD ["sh", "run-from-docker.sh"]
|
||||
@@ -0,0 +1,16 @@
|
||||
import { defineConfig } from 'cypress';
|
||||
|
||||
export default defineConfig({
|
||||
e2e: {
|
||||
baseUrl: 'http://localhost:5000',
|
||||
specPattern: 'cypress/e2e/**/*.cy.{ts,tsx}',
|
||||
supportFile: 'cypress/support/e2e.ts',
|
||||
videosFolder: 'cypress/videos',
|
||||
screenshotsFolder: 'cypress/screenshots',
|
||||
viewportWidth: 1280,
|
||||
viewportHeight: 720,
|
||||
setupNodeEvents(on, config) {
|
||||
return config;
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,141 @@
|
||||
/**
|
||||
* E2E tests for authentication flows: User Signup and Login.
|
||||
*
|
||||
* These tests cover the primary user journeys for account creation
|
||||
* and logging in to the TaskNote application.
|
||||
*/
|
||||
describe('Authentication', () => {
|
||||
/**
|
||||
* User Signup (Registration) flow
|
||||
*/
|
||||
describe('Signup', () => {
|
||||
beforeEach(() => {
|
||||
cy.visit('/register');
|
||||
});
|
||||
|
||||
it('displays the registration form', () => {
|
||||
cy.contains('h2', 'Create account').should('be.visible');
|
||||
cy.get('input[name="email"]').should('be.visible');
|
||||
cy.get('input[name="password"]').should('be.visible');
|
||||
cy.get('input[name="passwordAgain"]').should('be.visible');
|
||||
cy.get('button[type="submit"]').should('be.visible').and('contain', 'Create account');
|
||||
});
|
||||
|
||||
it('shows a validation error when the form is submitted empty', () => {
|
||||
cy.get('button[type="submit"]').click();
|
||||
cy.get('.alert-danger').should('be.visible');
|
||||
});
|
||||
|
||||
it('shows a validation error when passwords do not match', () => {
|
||||
cy.get('input[name="email"]').type('testuser@example.com');
|
||||
cy.get('input[name="password"]').type('Password1!');
|
||||
cy.get('input[name="passwordAgain"]').type('DifferentPass1!');
|
||||
cy.get('button[type="submit"]').click();
|
||||
cy.get('.alert-danger').should('be.visible');
|
||||
});
|
||||
|
||||
it('navigates to the login page via the login link', () => {
|
||||
cy.contains('a', 'Login').first().click();
|
||||
cy.url().should('include', '/login');
|
||||
});
|
||||
|
||||
it('navigates back to the landing page via the back-to-home link', () => {
|
||||
cy.contains('a', 'Back to home').click();
|
||||
cy.url().should('eq', `${Cypress.config('baseUrl')}/`);
|
||||
});
|
||||
|
||||
it('submits the signup form and shows a confirmation message on success', () => {
|
||||
cy.intercept({ method: 'PUT', url: /\/auth\/sign-up/ }, {
|
||||
statusCode: 201,
|
||||
body: { message: 'User created' }
|
||||
}).as('signUp');
|
||||
|
||||
cy.get('input[name="email"]').type(`newuser${Date.now()}@example.com`);
|
||||
cy.get('input[name="password"]').type('Password1!');
|
||||
cy.get('input[name="passwordAgain"]').type('Password1!');
|
||||
cy.get('button[type="submit"]').click();
|
||||
|
||||
cy.wait('@signUp');
|
||||
cy.get('.alert-success').should('be.visible');
|
||||
});
|
||||
|
||||
it('displays an error alert when the API returns an error on signup', () => {
|
||||
cy.intercept({ method: 'PUT', url: /\/auth\/sign-up/ }, {
|
||||
statusCode: 409,
|
||||
body: { message: 'Email already in use' }
|
||||
}).as('signUpFail');
|
||||
|
||||
cy.get('input[name="email"]').type(`existing${Date.now()}@example.com`);
|
||||
cy.get('input[name="password"]').type('Password1!');
|
||||
cy.get('input[name="passwordAgain"]').type('Password1!');
|
||||
cy.get('button[type="submit"]').click();
|
||||
|
||||
cy.wait('@signUpFail');
|
||||
cy.get('.alert-danger').should('be.visible');
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* User Login flow
|
||||
*/
|
||||
describe('Login', () => {
|
||||
beforeEach(() => {
|
||||
cy.visit('/login');
|
||||
});
|
||||
|
||||
it('displays the login form', () => {
|
||||
cy.contains('h2', 'Login').should('be.visible');
|
||||
cy.get('input[name="email"]').should('be.visible');
|
||||
cy.get('input[name="password"]').should('be.visible');
|
||||
cy.get('button[type="submit"]').should('be.visible').and('contain', 'Login');
|
||||
});
|
||||
|
||||
it('shows a validation error when the form is submitted empty', () => {
|
||||
cy.get('button[type="submit"]').click();
|
||||
cy.get('.alert-danger').should('be.visible');
|
||||
});
|
||||
|
||||
it('navigates to the register page via the create account link', () => {
|
||||
cy.contains('a', 'Create account').click();
|
||||
cy.url().should('include', '/register');
|
||||
});
|
||||
|
||||
it('navigates back to the landing page via the back-to-home link', () => {
|
||||
cy.contains('a', 'Back to home').click();
|
||||
cy.url().should('eq', `${Cypress.config('baseUrl')}/`);
|
||||
});
|
||||
|
||||
it('navigates to the reset password page via the forgot password link', () => {
|
||||
cy.contains('a', 'Forgot your password?').click();
|
||||
cy.url().should('include', '/reset-password');
|
||||
});
|
||||
|
||||
it('redirects to home after a successful login', () => {
|
||||
cy.intercept({ method: 'POST', url: /\/auth\/sign-in/ }, {
|
||||
statusCode: 200,
|
||||
body: { token: 'fake-jwt-token', email: 'user@example.com' }
|
||||
}).as('signIn');
|
||||
|
||||
cy.get('input[name="email"]').type('user@example.com');
|
||||
cy.get('input[name="password"]').type('Password1!');
|
||||
cy.get('button[type="submit"]').click();
|
||||
|
||||
cy.wait('@signIn');
|
||||
cy.url().should('include', '/home');
|
||||
});
|
||||
|
||||
it('displays an error alert when the API returns an error on login', () => {
|
||||
cy.intercept({ method: 'POST', url: /\/auth\/sign-in/ }, {
|
||||
statusCode: 401,
|
||||
body: { message: 'Invalid credentials' }
|
||||
}).as('signInFail');
|
||||
|
||||
cy.get('input[name="email"]').type('user@example.com');
|
||||
cy.get('input[name="password"]').type('wrongpassword');
|
||||
cy.get('button[type="submit"]').click();
|
||||
|
||||
cy.wait('@signInFail');
|
||||
cy.get('.alert-danger').should('be.visible');
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,204 @@
|
||||
/**
|
||||
* E2E tests for Home page management: searching and filtering tasks and notes.
|
||||
*/
|
||||
|
||||
const mockUser = {
|
||||
userId: 1,
|
||||
name: 'Test User',
|
||||
email: 'test@example.com',
|
||||
admin: false,
|
||||
createdAt: '2026-01-01T00:00:00.000Z',
|
||||
gravatarImageUrl: '',
|
||||
lang: 'en'
|
||||
};
|
||||
|
||||
const mockTasks = [
|
||||
{
|
||||
id: 1,
|
||||
description: 'Buy groceries',
|
||||
done: false,
|
||||
highPriority: true,
|
||||
dueDate: '2026-06-01',
|
||||
dueDateFmt: 'Jun 1, 2026',
|
||||
lastUpdate: '2026-05-01',
|
||||
tags: ['personal'],
|
||||
urls: []
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
description: 'Write report',
|
||||
done: false,
|
||||
highPriority: false,
|
||||
dueDate: '',
|
||||
dueDateFmt: '',
|
||||
lastUpdate: '2026-05-02',
|
||||
tags: ['work'],
|
||||
urls: []
|
||||
}
|
||||
];
|
||||
|
||||
const mockNotes = [
|
||||
{
|
||||
id: 1,
|
||||
title: 'Meeting notes',
|
||||
description: 'Discuss quarterly goals',
|
||||
url: null,
|
||||
tags: ['work'],
|
||||
lastUpdate: '2026-05-01',
|
||||
shared: false,
|
||||
shareToken: null
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
title: 'Recipe',
|
||||
description: 'Pasta carbonara recipe',
|
||||
url: null,
|
||||
tags: ['personal'],
|
||||
lastUpdate: '2026-05-02',
|
||||
shared: false,
|
||||
shareToken: null
|
||||
}
|
||||
];
|
||||
|
||||
const mockTags = ['personal', 'work'];
|
||||
|
||||
describe('Home Management', () => {
|
||||
beforeEach(() => {
|
||||
cy.intercept('GET', /\/rest\/user-sessions\/refresh/, {
|
||||
statusCode: 200,
|
||||
body: { token: 'fake-jwt-token', ...mockUser }
|
||||
}).as('refreshToken');
|
||||
|
||||
cy.intercept('GET', /\/rest\/users\/me/, {
|
||||
statusCode: 200,
|
||||
body: mockUser
|
||||
}).as('getCurrentUser');
|
||||
|
||||
cy.intercept('GET', /\/rest\/home\/tasks\/tags/, {
|
||||
statusCode: 200,
|
||||
body: mockTags
|
||||
}).as('getTags');
|
||||
|
||||
cy.intercept('GET', /\/rest\/tasks$/, {
|
||||
statusCode: 200,
|
||||
body: mockTasks
|
||||
}).as('getTasks');
|
||||
|
||||
cy.intercept('GET', /\/rest\/notes$/, {
|
||||
statusCode: 200,
|
||||
body: mockNotes
|
||||
}).as('getNotes');
|
||||
|
||||
cy.visit('/home', {
|
||||
onBeforeLoad(win) {
|
||||
win.localStorage.setItem('TASKNOTE-TOKEN', 'fake-jwt-token');
|
||||
win.localStorage.setItem('TASKNOTE-USER', JSON.stringify(mockUser));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Home page display
|
||||
*/
|
||||
describe('Display', () => {
|
||||
it('shows tasks and notes after loading', () => {
|
||||
cy.wait('@getTasks');
|
||||
cy.wait('@getNotes');
|
||||
|
||||
cy.contains('Buy groceries').should('be.visible');
|
||||
cy.contains('Write report').should('be.visible');
|
||||
cy.contains('Meeting notes').should('be.visible');
|
||||
cy.contains('Recipe').should('be.visible');
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Search / text filtering
|
||||
*/
|
||||
describe('Search', () => {
|
||||
beforeEach(() => {
|
||||
cy.wait('@getTasks');
|
||||
cy.wait('@getNotes');
|
||||
});
|
||||
|
||||
it('filters items by search text matching a task description', () => {
|
||||
cy.get('input[placeholder="Filter tasks & notes"]').type('groceries');
|
||||
|
||||
cy.contains('Buy groceries').should('be.visible');
|
||||
cy.contains('Write report').should('not.exist');
|
||||
cy.contains('Meeting notes').should('not.exist');
|
||||
cy.contains('Recipe').should('not.exist');
|
||||
});
|
||||
|
||||
it('filters items by search text matching a note title', () => {
|
||||
cy.get('input[placeholder="Filter tasks & notes"]').type('Meeting');
|
||||
|
||||
cy.contains('Meeting notes').should('be.visible');
|
||||
cy.contains('Buy groceries').should('not.exist');
|
||||
cy.contains('Recipe').should('not.exist');
|
||||
});
|
||||
|
||||
it('restores all items after clearing the search', () => {
|
||||
cy.get('input[placeholder="Filter tasks & notes"]').type('groceries');
|
||||
cy.contains('Write report').should('not.exist');
|
||||
|
||||
cy.get('input[placeholder="Filter tasks & notes"]').clear();
|
||||
|
||||
cy.contains('Buy groceries').should('be.visible');
|
||||
cy.contains('Meeting notes').should('be.visible');
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Dropdown filter
|
||||
*/
|
||||
describe('Dropdown Filter', () => {
|
||||
beforeEach(() => {
|
||||
cy.wait('@getTasks');
|
||||
cy.wait('@getNotes');
|
||||
});
|
||||
|
||||
it('shows only tasks when Tasks filter is selected', () => {
|
||||
cy.get('[data-testid="dropdown-tag-filter"]').click();
|
||||
cy.contains('Tasks').click();
|
||||
|
||||
cy.contains('Buy groceries').should('be.visible');
|
||||
cy.contains('Write report').should('be.visible');
|
||||
cy.contains('Meeting notes').should('not.exist');
|
||||
cy.contains('Recipe').should('not.exist');
|
||||
});
|
||||
|
||||
it('shows only notes when Notes filter is selected', () => {
|
||||
cy.get('[data-testid="dropdown-tag-filter"]').click();
|
||||
cy.contains('Notes').click();
|
||||
|
||||
cy.contains('Meeting notes').should('be.visible');
|
||||
cy.contains('Recipe').should('be.visible');
|
||||
cy.contains('Buy groceries').should('not.exist');
|
||||
cy.contains('Write report').should('not.exist');
|
||||
});
|
||||
|
||||
it('shows everything when Everything filter is selected', () => {
|
||||
cy.get('[data-testid="dropdown-tag-filter"]').click();
|
||||
cy.contains('Tasks').click();
|
||||
|
||||
cy.get('[data-testid="dropdown-tag-filter"]').click();
|
||||
cy.contains('Everything').click();
|
||||
|
||||
cy.contains('Buy groceries').should('be.visible');
|
||||
cy.contains('Meeting notes').should('be.visible');
|
||||
});
|
||||
|
||||
it('filters by tag when a tag is selected', () => {
|
||||
cy.wait('@getTags');
|
||||
|
||||
cy.get('[data-testid="dropdown-tag-filter"]').click();
|
||||
cy.contains('#personal').click();
|
||||
|
||||
cy.contains('Buy groceries').should('be.visible');
|
||||
cy.contains('Recipe').should('be.visible');
|
||||
cy.contains('Write report').should('not.exist');
|
||||
cy.contains('Meeting notes').should('not.exist');
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,273 @@
|
||||
/**
|
||||
* E2E tests for Notes Management: Create, Update, Delete, and Share notes.
|
||||
*/
|
||||
|
||||
const mockUser = {
|
||||
userId: 1,
|
||||
name: 'Test User',
|
||||
email: 'test@example.com',
|
||||
admin: false,
|
||||
createdAt: '2026-01-01T00:00:00.000Z',
|
||||
gravatarImageUrl: '',
|
||||
lang: 'en'
|
||||
};
|
||||
|
||||
const mockNote = {
|
||||
id: 1,
|
||||
title: 'Meeting notes',
|
||||
description: 'Discuss quarterly goals',
|
||||
url: null,
|
||||
tags: ['work'],
|
||||
lastUpdate: '2026-05-01',
|
||||
shared: false,
|
||||
shareToken: null
|
||||
};
|
||||
|
||||
describe('Notes Management', () => {
|
||||
/**
|
||||
* Sets up authentication intercepts and visits the given path.
|
||||
*
|
||||
* @param {string} path - The path to visit.
|
||||
*/
|
||||
const visitWithAuth = (path: string): void => {
|
||||
cy.intercept('GET', /\/rest\/user-sessions\/refresh/, {
|
||||
statusCode: 200,
|
||||
body: { token: 'fake-jwt-token', ...mockUser }
|
||||
}).as('refreshToken');
|
||||
|
||||
cy.intercept('GET', /\/rest\/users\/me/, {
|
||||
statusCode: 200,
|
||||
body: mockUser
|
||||
}).as('getCurrentUser');
|
||||
|
||||
cy.intercept('GET', /\/rest\/home\/tasks\/tags/, {
|
||||
statusCode: 200,
|
||||
body: ['work', 'personal']
|
||||
}).as('getTags');
|
||||
|
||||
cy.visit(path, {
|
||||
onBeforeLoad(win) {
|
||||
win.localStorage.setItem('TASKNOTE-TOKEN', 'fake-jwt-token');
|
||||
win.localStorage.setItem('TASKNOTE-USER', JSON.stringify(mockUser));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Create note
|
||||
*/
|
||||
describe('Create', () => {
|
||||
beforeEach(() => {
|
||||
visitWithAuth('/notes/new');
|
||||
});
|
||||
|
||||
it('displays the add note form', () => {
|
||||
cy.contains('Add Note').should('be.visible');
|
||||
cy.get('input[name="note_title"]').should('be.visible');
|
||||
cy.get('textarea[name="note_description"]').should('be.visible');
|
||||
cy.contains('button', 'Save note').should('be.visible');
|
||||
});
|
||||
|
||||
it('shows a validation error when submitted without a title', () => {
|
||||
cy.contains('button', 'Save note').click();
|
||||
|
||||
cy.get('.alert-danger').should('be.visible');
|
||||
});
|
||||
|
||||
it('shows a validation error when submitted without content', () => {
|
||||
cy.get('input[name="note_title"]').type('A note title');
|
||||
cy.contains('button', 'Save note').click();
|
||||
|
||||
cy.get('.alert-danger').should('be.visible');
|
||||
});
|
||||
|
||||
it('creates a note and navigates to home on success', () => {
|
||||
cy.intercept('POST', /\/rest\/notes/, {
|
||||
statusCode: 201,
|
||||
body: {
|
||||
id: 10,
|
||||
title: 'New note',
|
||||
description: 'Some content',
|
||||
url: null,
|
||||
tags: [],
|
||||
lastUpdate: '',
|
||||
shared: false,
|
||||
shareToken: null
|
||||
}
|
||||
}).as('createNote');
|
||||
|
||||
cy.intercept('GET', /\/rest\/tasks$/, { statusCode: 200, body: [] }).as('getTasks');
|
||||
cy.intercept('GET', /\/rest\/notes$/, { statusCode: 200, body: [] }).as('getNotes');
|
||||
|
||||
cy.get('input[name="note_title"]').type('New note');
|
||||
cy.get('textarea[name="note_description"]').type('Some content');
|
||||
cy.contains('button', 'Save note').click();
|
||||
|
||||
cy.wait('@createNote');
|
||||
cy.url().should('include', '/home');
|
||||
});
|
||||
|
||||
it('shows an error alert when the API returns an error on create', () => {
|
||||
cy.intercept('POST', /\/rest\/notes/, {
|
||||
statusCode: 500,
|
||||
body: { message: 'Internal Server Error' }
|
||||
}).as('createNoteFail');
|
||||
|
||||
cy.get('input[name="note_title"]').type('Failing note');
|
||||
cy.get('textarea[name="note_description"]').type('Some content');
|
||||
cy.contains('button', 'Save note').click();
|
||||
|
||||
cy.wait('@createNoteFail');
|
||||
cy.get('.alert-danger').should('be.visible');
|
||||
});
|
||||
|
||||
it('navigates back to home when Cancel is clicked', () => {
|
||||
cy.intercept('GET', /\/rest\/tasks$/, { statusCode: 200, body: [] }).as('getTasks');
|
||||
cy.intercept('GET', /\/rest\/notes$/, { statusCode: 200, body: [] }).as('getNotes');
|
||||
|
||||
cy.contains('button', 'Cancel').click();
|
||||
|
||||
cy.url().should('include', '/home');
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Update note
|
||||
*/
|
||||
describe('Update', () => {
|
||||
beforeEach(() => {
|
||||
cy.intercept('GET', /\/rest\/notes\/\d+/, {
|
||||
statusCode: 200,
|
||||
body: mockNote
|
||||
}).as('getNote');
|
||||
|
||||
visitWithAuth('/notes/edit/1');
|
||||
cy.wait('@getNote');
|
||||
});
|
||||
|
||||
it('pre-fills the form with the existing note data', () => {
|
||||
cy.get('input[name="note_title"]').should('have.value', 'Meeting notes');
|
||||
cy.get('textarea[name="note_description"]').should('have.value', 'Discuss quarterly goals');
|
||||
});
|
||||
|
||||
it('updates the note and navigates to home on success', () => {
|
||||
cy.intercept('PATCH', /\/rest\/notes\/\d+/, {
|
||||
statusCode: 200,
|
||||
body: { ...mockNote, title: 'Updated meeting notes' }
|
||||
}).as('updateNote');
|
||||
|
||||
cy.intercept('GET', /\/rest\/tasks$/, { statusCode: 200, body: [] }).as('getTasks');
|
||||
cy.intercept('GET', /\/rest\/notes$/, { statusCode: 200, body: [] }).as('getNotes');
|
||||
|
||||
cy.get('input[name="note_title"]').clear().type('Updated meeting notes');
|
||||
cy.contains('button', 'Save note').click();
|
||||
|
||||
cy.wait('@updateNote');
|
||||
cy.url().should('include', '/home');
|
||||
});
|
||||
|
||||
it('shows an error alert when the update API call fails', () => {
|
||||
cy.intercept('PATCH', /\/rest\/notes\/\d+/, {
|
||||
statusCode: 500,
|
||||
body: { message: 'Internal Server Error' }
|
||||
}).as('updateNoteFail');
|
||||
|
||||
cy.get('input[name="note_title"]').clear().type('Updated note');
|
||||
cy.contains('button', 'Save note').click();
|
||||
|
||||
cy.wait('@updateNoteFail');
|
||||
cy.get('.alert-danger').should('be.visible');
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Delete note
|
||||
*/
|
||||
describe('Delete', () => {
|
||||
beforeEach(() => {
|
||||
cy.intercept('GET', /\/rest\/tasks$/, {
|
||||
statusCode: 200,
|
||||
body: []
|
||||
}).as('getTasks');
|
||||
|
||||
cy.intercept('GET', /\/rest\/notes$/, {
|
||||
statusCode: 200,
|
||||
body: [mockNote]
|
||||
}).as('getNotes');
|
||||
|
||||
visitWithAuth('/home');
|
||||
cy.wait('@getNotes');
|
||||
});
|
||||
|
||||
it('deletes a note via the note dropdown menu', () => {
|
||||
cy.intercept('DELETE', /\/rest\/notes\/\d+/, {
|
||||
statusCode: 204
|
||||
}).as('deleteNote');
|
||||
|
||||
cy.get('[data-testid="note-dropdown-menu-1"]').click();
|
||||
cy.get('[data-testid="note-dropdown-delete-item-1"]').click();
|
||||
|
||||
cy.wait('@deleteNote');
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Share note
|
||||
*/
|
||||
describe('Share', () => {
|
||||
beforeEach(() => {
|
||||
cy.intercept('GET', /\/rest\/tasks$/, {
|
||||
statusCode: 200,
|
||||
body: []
|
||||
}).as('getTasks');
|
||||
|
||||
cy.intercept('GET', /\/rest\/notes$/, {
|
||||
statusCode: 200,
|
||||
body: [mockNote]
|
||||
}).as('getNotes');
|
||||
|
||||
visitWithAuth('/home');
|
||||
cy.wait('@getNotes');
|
||||
});
|
||||
|
||||
it('shares a note via the note dropdown menu', () => {
|
||||
cy.intercept('PUT', /\/rest\/notes\/\d+\/share/, {
|
||||
statusCode: 200,
|
||||
body: { ...mockNote, shared: true, shareToken: 'abc123' }
|
||||
}).as('shareNote');
|
||||
|
||||
cy.get('[data-testid="note-dropdown-menu-1"]').click();
|
||||
cy.get('[data-testid="note-dropdown-share-item-1"]').click();
|
||||
|
||||
cy.wait('@shareNote');
|
||||
});
|
||||
|
||||
it('unshares a shared note via the note dropdown menu', () => {
|
||||
const sharedNote = { ...mockNote, shared: true, shareToken: 'abc123' };
|
||||
|
||||
cy.intercept('GET', /\/rest\/notes$/, {
|
||||
statusCode: 200,
|
||||
body: [sharedNote]
|
||||
}).as('getSharedNotes');
|
||||
|
||||
cy.intercept('PUT', /\/rest\/notes\/\d+\/unshare/, {
|
||||
statusCode: 200,
|
||||
body: { ...sharedNote, shared: false, shareToken: null }
|
||||
}).as('unshareNote');
|
||||
|
||||
cy.visit('/home', {
|
||||
onBeforeLoad(win) {
|
||||
win.localStorage.setItem('TASKNOTE-TOKEN', 'fake-jwt-token');
|
||||
win.localStorage.setItem('TASKNOTE-USER', JSON.stringify(mockUser));
|
||||
}
|
||||
});
|
||||
|
||||
cy.wait('@getSharedNotes');
|
||||
|
||||
cy.get('[data-testid="note-dropdown-menu-1"]').click();
|
||||
cy.get('[data-testid="note-dropdown-share-item-1"]').click();
|
||||
|
||||
cy.wait('@unshareNote');
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,231 @@
|
||||
/**
|
||||
* E2E tests for Task Management: Create, Update, and Delete tasks.
|
||||
*/
|
||||
|
||||
const mockUser = {
|
||||
userId: 1,
|
||||
name: 'Test User',
|
||||
email: 'test@example.com',
|
||||
admin: false,
|
||||
createdAt: '2026-01-01T00:00:00.000Z',
|
||||
gravatarImageUrl: '',
|
||||
lang: 'en'
|
||||
};
|
||||
|
||||
const mockTask = {
|
||||
id: 1,
|
||||
description: 'Buy groceries',
|
||||
done: false,
|
||||
highPriority: false,
|
||||
dueDate: '',
|
||||
dueDateFmt: '',
|
||||
lastUpdate: '2026-05-01',
|
||||
tags: ['personal'],
|
||||
urls: []
|
||||
};
|
||||
|
||||
describe('Task Management', () => {
|
||||
/**
|
||||
* Sets up authentication intercepts and visits the given path.
|
||||
*
|
||||
* @param {string} path - The path to visit.
|
||||
*/
|
||||
const visitWithAuth = (path: string): void => {
|
||||
cy.intercept('GET', /\/rest\/user-sessions\/refresh/, {
|
||||
statusCode: 200,
|
||||
body: { token: 'fake-jwt-token', ...mockUser }
|
||||
}).as('refreshToken');
|
||||
|
||||
cy.intercept('GET', /\/rest\/users\/me/, {
|
||||
statusCode: 200,
|
||||
body: mockUser
|
||||
}).as('getCurrentUser');
|
||||
|
||||
cy.intercept('GET', /\/rest\/home\/tasks\/tags/, {
|
||||
statusCode: 200,
|
||||
body: ['personal', 'work']
|
||||
}).as('getTags');
|
||||
|
||||
cy.visit(path, {
|
||||
onBeforeLoad(win) {
|
||||
win.localStorage.setItem('TASKNOTE-TOKEN', 'fake-jwt-token');
|
||||
win.localStorage.setItem('TASKNOTE-USER', JSON.stringify(mockUser));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Create task
|
||||
*/
|
||||
describe('Create', () => {
|
||||
beforeEach(() => {
|
||||
visitWithAuth('/tasks/new');
|
||||
});
|
||||
|
||||
it('displays the add task form', () => {
|
||||
cy.contains('Add Task').should('be.visible');
|
||||
cy.get('input[name="description"]').should('be.visible');
|
||||
cy.get('input[name="url"]').should('be.visible');
|
||||
cy.get('input[name="tag"]').should('be.visible');
|
||||
cy.contains('button', 'Save task').should('be.visible');
|
||||
});
|
||||
|
||||
it('shows a validation error when submitted without a description', () => {
|
||||
cy.contains('button', 'Save task').click();
|
||||
|
||||
cy.get('.alert-danger').should('be.visible');
|
||||
});
|
||||
|
||||
it('creates a task and navigates to home on success', () => {
|
||||
cy.intercept('POST', /\/rest\/tasks/, {
|
||||
statusCode: 201,
|
||||
body: {
|
||||
id: 10,
|
||||
description: 'New task',
|
||||
done: false,
|
||||
highPriority: false,
|
||||
dueDate: '',
|
||||
dueDateFmt: '',
|
||||
lastUpdate: '',
|
||||
tags: [],
|
||||
urls: []
|
||||
}
|
||||
}).as('createTask');
|
||||
|
||||
cy.intercept('GET', /\/rest\/tasks$/, { statusCode: 200, body: [] }).as('getTasks');
|
||||
cy.intercept('GET', /\/rest\/notes$/, { statusCode: 200, body: [] }).as('getNotes');
|
||||
|
||||
cy.get('input[name="description"]').type('New task');
|
||||
cy.contains('button', 'Save task').click();
|
||||
|
||||
cy.wait('@createTask');
|
||||
cy.url().should('include', '/home');
|
||||
});
|
||||
|
||||
it('shows an error alert when the API returns an error on create', () => {
|
||||
cy.intercept('POST', /\/rest\/tasks/, {
|
||||
statusCode: 500,
|
||||
body: { message: 'Internal Server Error' }
|
||||
}).as('createTaskFail');
|
||||
|
||||
cy.get('input[name="description"]').type('Failing task');
|
||||
cy.contains('button', 'Save task').click();
|
||||
|
||||
cy.wait('@createTaskFail');
|
||||
cy.get('.alert-danger').should('be.visible');
|
||||
});
|
||||
|
||||
it('navigates back to home when Cancel is clicked', () => {
|
||||
cy.intercept('GET', /\/rest\/tasks$/, { statusCode: 200, body: [] }).as('getTasks');
|
||||
cy.intercept('GET', /\/rest\/notes$/, { statusCode: 200, body: [] }).as('getNotes');
|
||||
|
||||
cy.contains('button', 'Cancel').click();
|
||||
|
||||
cy.url().should('include', '/home');
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Update task
|
||||
*/
|
||||
describe('Update', () => {
|
||||
beforeEach(() => {
|
||||
cy.intercept('GET', /\/rest\/tasks\/\d+/, {
|
||||
statusCode: 200,
|
||||
body: mockTask
|
||||
}).as('getTask');
|
||||
|
||||
visitWithAuth('/tasks/edit/1');
|
||||
cy.wait('@getTask');
|
||||
});
|
||||
|
||||
it('pre-fills the form with the existing task data', () => {
|
||||
cy.get('input[name="description"]').should('have.value', 'Buy groceries');
|
||||
});
|
||||
|
||||
it('updates the task and navigates to home on success', () => {
|
||||
cy.intercept('PATCH', /\/rest\/tasks\/\d+/, {
|
||||
statusCode: 200,
|
||||
body: { ...mockTask, description: 'Buy more groceries' }
|
||||
}).as('updateTask');
|
||||
|
||||
cy.intercept('GET', /\/rest\/tasks$/, { statusCode: 200, body: [] }).as('getTasks');
|
||||
cy.intercept('GET', /\/rest\/notes$/, { statusCode: 200, body: [] }).as('getNotes');
|
||||
|
||||
cy.get('input[name="description"]').clear().type('Buy more groceries');
|
||||
cy.contains('button', 'Save task').click();
|
||||
|
||||
cy.wait('@updateTask');
|
||||
cy.url().should('include', '/home');
|
||||
});
|
||||
|
||||
it('shows an error alert when the update API call fails', () => {
|
||||
cy.intercept('PATCH', /\/rest\/tasks\/\d+/, {
|
||||
statusCode: 500,
|
||||
body: { message: 'Internal Server Error' }
|
||||
}).as('updateTaskFail');
|
||||
|
||||
cy.get('input[name="description"]').clear().type('Updated task');
|
||||
cy.contains('button', 'Save task').click();
|
||||
|
||||
cy.wait('@updateTaskFail');
|
||||
cy.get('.alert-danger').should('be.visible');
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Mark as done / undone
|
||||
*/
|
||||
describe('Mark as Done', () => {
|
||||
beforeEach(() => {
|
||||
cy.intercept('GET', /\/rest\/tasks$/, {
|
||||
statusCode: 200,
|
||||
body: [mockTask]
|
||||
}).as('getTasks');
|
||||
|
||||
cy.intercept('GET', /\/rest\/notes$/, {
|
||||
statusCode: 200,
|
||||
body: []
|
||||
}).as('getNotes');
|
||||
|
||||
visitWithAuth('/home');
|
||||
cy.wait('@getTasks');
|
||||
});
|
||||
|
||||
it('marks a task as done via the task dropdown menu', () => {
|
||||
cy.intercept('DELETE', /\/rest\/tasks\/\d+/, {
|
||||
statusCode: 204
|
||||
}).as('markDone');
|
||||
|
||||
cy.get('[data-testid="task-dropdown-menu-1"]').click();
|
||||
cy.get('[data-testid="task-dropdown-done-item-1"]').click();
|
||||
|
||||
cy.wait('@markDone');
|
||||
});
|
||||
|
||||
it('marks a done task as undone via the task dropdown menu', () => {
|
||||
cy.intercept('GET', /\/rest\/tasks$/, {
|
||||
statusCode: 200,
|
||||
body: [{ ...mockTask, done: true }]
|
||||
}).as('getDoneTasks');
|
||||
|
||||
cy.intercept('DELETE', /\/rest\/tasks\/\d+/, {
|
||||
statusCode: 204
|
||||
}).as('markUndone');
|
||||
|
||||
cy.visit('/home', {
|
||||
onBeforeLoad(win) {
|
||||
win.localStorage.setItem('TASKNOTE-TOKEN', 'fake-jwt-token');
|
||||
win.localStorage.setItem('TASKNOTE-USER', JSON.stringify(mockUser));
|
||||
}
|
||||
});
|
||||
|
||||
cy.wait('@getDoneTasks');
|
||||
|
||||
cy.get('[data-testid="task-dropdown-menu-1"]').click();
|
||||
cy.get('[data-testid="task-dropdown-done-item-1"]').click();
|
||||
|
||||
cy.wait('@markUndone');
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,26 @@
|
||||
// Custom Cypress commands.
|
||||
// Add any project-wide custom commands here.
|
||||
|
||||
// Prevent TypeScript errors for cy.login usage
|
||||
declare global {
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
namespace Cypress {
|
||||
interface Chainable {
|
||||
/**
|
||||
* Custom command to log in via the UI.
|
||||
* @param email - User email address
|
||||
* @param password - User password
|
||||
*/
|
||||
login(email: string, password: string): Chainable<void>;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Cypress.Commands.add('login', (email: string, password: string) => {
|
||||
cy.visit('/login');
|
||||
cy.get('input[name="email"]').clear().type(email);
|
||||
cy.get('input[name="password"]').clear().type(password);
|
||||
cy.get('button[type="submit"]').click();
|
||||
});
|
||||
|
||||
export {};
|
||||
@@ -0,0 +1,4 @@
|
||||
// Support file for Cypress E2E tests.
|
||||
// This file is loaded before each spec file.
|
||||
|
||||
import './commands';
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ESNext",
|
||||
"lib": ["ESNext", "dom"],
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "bundler",
|
||||
"types": ["cypress", "node"],
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strict": false,
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"include": [
|
||||
"./**/*.ts",
|
||||
"./**/*.tsx"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
import globals from 'globals';
|
||||
import { fixupConfigRules } from '@eslint/compat';
|
||||
import jsLint from '@eslint/js';
|
||||
import tsLint from 'typescript-eslint';
|
||||
import pluginReactConfig from 'eslint-plugin-react/configs/recommended.js';
|
||||
import stylistic from '@stylistic/eslint-plugin';
|
||||
|
||||
export default [
|
||||
{
|
||||
files: ['**/*.{ts,tsx}']
|
||||
},
|
||||
{
|
||||
languageOptions: {
|
||||
// common parser options, enable TypeScript and JSX
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
sourceType: 'module'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
ignores: [
|
||||
'**/__test__/*',
|
||||
'cypress/**',
|
||||
'**/assets/*',
|
||||
'**/*.scss',
|
||||
'**/*.css',
|
||||
'**/*.svg'
|
||||
]
|
||||
},
|
||||
{
|
||||
languageOptions: {
|
||||
globals: { ...globals.browser, ...globals.node }
|
||||
}
|
||||
},
|
||||
{
|
||||
settings: {
|
||||
'import/resolver': {
|
||||
node: {
|
||||
extensions: ['.js', '.jsx', ',ts', '.tsx']
|
||||
}
|
||||
},
|
||||
'react': {
|
||||
pragma: 'React',
|
||||
fragment: 'Fragment',
|
||||
version: '18.3'
|
||||
}
|
||||
}
|
||||
},
|
||||
// syntax rules
|
||||
jsLint.configs.recommended,
|
||||
...tsLint.configs.recommended,
|
||||
...fixupConfigRules(pluginReactConfig),
|
||||
// code style rules
|
||||
stylistic.configs['disable-legacy'],
|
||||
stylistic.configs.customize({
|
||||
indent: 2,
|
||||
quotes: 'single',
|
||||
semi: true,
|
||||
commaDangle: 'never',
|
||||
jsx: true
|
||||
})
|
||||
];
|
||||
@@ -0,0 +1,27 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="theme-color" content="#ffffff" />
|
||||
<meta name="description" content="This app provides you tools to get organized and stay on op of notes and TODOs." />
|
||||
<meta name="robots" content="noindex" />
|
||||
<meta name="robots" content="nofollow" />
|
||||
<meta name="googlebot-news" content="noindex" />
|
||||
<meta name="keywords" content="TODOs, organization, notes, tools" />
|
||||
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
|
||||
<link rel="manifest" href="/manifest.json" />
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.9.1/font/bootstrap-icons.css">
|
||||
<link rel="canonical" href="https://tasknoteapp.dev.br" />
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,200..800;1,200..800&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">
|
||||
<title>TaskNote is your daily-basis friend to keep up with notes and tasks</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/index.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,37 @@
|
||||
server {
|
||||
root /var/www/example.com/html;
|
||||
index index.html;
|
||||
|
||||
server_name example.com www.example.com;
|
||||
|
||||
location / {
|
||||
try_files $uri /index.html
|
||||
}
|
||||
|
||||
listen [::]:443 ssl ipv6only=on;
|
||||
listen 443 ssl;
|
||||
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/texample.com/privkey.pem;
|
||||
|
||||
location /server {
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header Host $host;
|
||||
proxy_pass http://localhost:8585;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
if ($host = www.example.com) {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
if ($host = example.com) {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
server_name example.com www.example.com;
|
||||
return 404;
|
||||
}
|
||||
Generated
+11513
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,95 @@
|
||||
{
|
||||
"name": "task-note",
|
||||
"version": "1.0.0",
|
||||
"license": "GPL-3.0-only",
|
||||
"description": "TaskNote App - Your daily-basis friend to help you with TODOs and Notes",
|
||||
"keywords": [
|
||||
"react",
|
||||
"typescript",
|
||||
"node",
|
||||
"nestjs"
|
||||
],
|
||||
"repository": "https://github.com/ricardo-campos-org/react-typescript-todolist",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@popperjs/core": "^2.11.8",
|
||||
"@types/node": "^25.9.1",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"@vitejs/plugin-react": "^6.0.2",
|
||||
"bootstrap": "^5.3.8",
|
||||
"dompurify": "^3.4.7",
|
||||
"i18next": "^26.3.0",
|
||||
"react": "^19.2.6",
|
||||
"react-bootstrap": "^2.10.10",
|
||||
"react-bootstrap-icons": "^1.11.6",
|
||||
"react-charts": "^3.0.0-beta.57",
|
||||
"react-datepicker": "^9.1.0",
|
||||
"react-dom": "^19.2.6",
|
||||
"react-i18next": "^17.0.8",
|
||||
"react-markdown": "^10.1.0",
|
||||
"react-router": "^7.16.0",
|
||||
"react-router-bootstrap": "^0.26.3",
|
||||
"remark-gfm": "^4.0.1",
|
||||
"typescript": "^6.0.3",
|
||||
"vite": "^8.0.16"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "vite --host",
|
||||
"build": "tsc && vite build",
|
||||
"preview": "vite build && vite preview",
|
||||
"test": "vitest",
|
||||
"test:no-watch": "vitest --watch=false",
|
||||
"test:coverage": "vitest run --coverage --watch=false",
|
||||
"lint": "./node_modules/.bin/eslint",
|
||||
"lint:fix": "./node_modules/.bin/eslint --fix",
|
||||
"cypress:open": "cypress open",
|
||||
"cypress:run": "cypress run",
|
||||
"cypress:run:headless": "cypress run --headless"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"react-app",
|
||||
"react-app/jest"
|
||||
]
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.2%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"development": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/compat": "^2.1.0",
|
||||
"@eslint/eslintrc": "^3.3.5",
|
||||
"@eslint/js": "^9.39.4",
|
||||
"@stylistic/eslint-plugin": "^5.10.0",
|
||||
"@testing-library/jest-dom": "^6.9.1",
|
||||
"@testing-library/react": "^16.3.2",
|
||||
"@testing-library/user-event": "^14.6.1",
|
||||
"@types/jest": "^30.0.0",
|
||||
"@types/react": "^19.2.15",
|
||||
"@types/react-router-bootstrap": "^0.26.8",
|
||||
"@vitest/coverage-v8": "^4.1.8",
|
||||
"cypress": "^15.16.0",
|
||||
"eslint": "^9.39.4",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"eslint-plugin-import-x": "^4.16.2",
|
||||
"eslint-plugin-jsdoc": "^62.9.0",
|
||||
"eslint-plugin-n": "^18.0.1",
|
||||
"eslint-plugin-promise": "^7.3.0",
|
||||
"eslint-plugin-react": "^7.37.5",
|
||||
"globals": "^17.6.0",
|
||||
"jsdom": "^29.1.1",
|
||||
"prettier": "^3.8.3",
|
||||
"sass": "^1.100.0",
|
||||
"source-map-support": "^0.5.21",
|
||||
"typescript-eslint": "^8.60.0",
|
||||
"vitest": "^4.1.8"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 39 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 182 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 35 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 831 B |
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "TastNote",
|
||||
"short_name": "TastNote",
|
||||
"icons":[
|
||||
{
|
||||
"src":"/android-chrome-192x192.png",
|
||||
"sizes":"192x192",
|
||||
"type":"image/png"
|
||||
},
|
||||
{
|
||||
"src":"/android-chrome-512x512.png",
|
||||
"sizes":"512x512",
|
||||
"type":"image/png"
|
||||
}
|
||||
],
|
||||
"theme_color":"#ffffff",
|
||||
"background_color":"#ffffff",
|
||||
"display":"standalone",
|
||||
"start_url": "."
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
# Must be unique in a given SonarQube instance
|
||||
sonar.projectKey=ricardo-campos-org_react-typescript-todolist_client
|
||||
sonar.organization=ricardo-campos-org
|
||||
|
||||
# This is the name and version displayed in the SonarQube UI.
|
||||
# Was mandatory prior to SonarQube 6.1.
|
||||
sonar.projectName=tasknote-webapp
|
||||
#sonar.projectVersion=1.0
|
||||
|
||||
# Path is relative to the sonar-project.properties file.
|
||||
# Replace "\" by "/" on Windows.
|
||||
# This property is optional if sonar.modules is set.
|
||||
sonar.javascript.lcov.reportPaths=coverage/lcov.info
|
||||
sonar.typescript.tsconfigPaths=tsconfig.json
|
||||
sonar.sources=src/
|
||||
sonar.exclusions=src/__test__/**
|
||||
sonar.tests=src/__test__/
|
||||
sonar.verbose=false
|
||||
|
||||
# Encoding of the source code. Default is default system encoding
|
||||
sonar.sourceEncoding=UTF-8
|
||||
@@ -0,0 +1,142 @@
|
||||
import React, { useContext, useEffect, useState } from 'react';
|
||||
import {
|
||||
createBrowserRouter,
|
||||
Navigate,
|
||||
RouteObject,
|
||||
RouterProvider
|
||||
} from 'react-router';
|
||||
import AuthContext from './context/AuthContext';
|
||||
import BrowserRoutes from './routes';
|
||||
import ProtectedRoute from './routes/ProtectedRoute';
|
||||
import PrivateLayout from './layout/PrivateLayout';
|
||||
import Landing from './views/Landing';
|
||||
import Login from './views/Login';
|
||||
import NotFound from './views/NotFound';
|
||||
import Register from './views/Register';
|
||||
import EmailConfirmation from './views/EmailConfirmation';
|
||||
import ResetPassword from './views/ResetPassword';
|
||||
import CompleteResetPassword from './views/CompleteResetPassword';
|
||||
import SharedNote from './views/SharedNote';
|
||||
import './styles/custom.scss';
|
||||
|
||||
/**
|
||||
* The main application component that sets up routing based on the
|
||||
* user's authentication status.
|
||||
*
|
||||
* @component
|
||||
* @returns {React.ReactNode} The rendered component.
|
||||
*/
|
||||
function App(): React.ReactNode {
|
||||
const { signed, loading } = useContext(AuthContext);
|
||||
const [theme, setTheme] = useState(() => {
|
||||
return localStorage.getItem('theme') ?? 'light';
|
||||
});
|
||||
|
||||
/**
|
||||
* Routes for the users who are not signed in.
|
||||
* @type {RouteObject[]}
|
||||
*/
|
||||
const notSignedRouter: RouteObject[] = [
|
||||
{
|
||||
path: '/',
|
||||
element: <Landing />
|
||||
},
|
||||
{
|
||||
path: '/login',
|
||||
element: <Login />
|
||||
},
|
||||
{
|
||||
path: '/register',
|
||||
element: <Register />
|
||||
},
|
||||
{
|
||||
path: '/home',
|
||||
element: <Navigate to="/login" replace />
|
||||
},
|
||||
{
|
||||
path: '/email-confirmation',
|
||||
element: <EmailConfirmation />
|
||||
},
|
||||
{
|
||||
// The reset-password is where the password reset workflow starts
|
||||
path: '/reset-password',
|
||||
element: <ResetPassword />
|
||||
},
|
||||
{
|
||||
path: '/finish-reset-password',
|
||||
element: <CompleteResetPassword />
|
||||
},
|
||||
{
|
||||
path: '/public/notes/:token',
|
||||
element: <SharedNote />
|
||||
},
|
||||
{
|
||||
path: '*',
|
||||
element: <Navigate to="/" replace />
|
||||
}
|
||||
];
|
||||
|
||||
/**
|
||||
* Routes for users who are signed in.
|
||||
* @type {RouteObject[]}
|
||||
*/
|
||||
const signedRouter: RouteObject[] = [
|
||||
{
|
||||
path: '/',
|
||||
element: <ProtectedRoute />,
|
||||
children: [
|
||||
{
|
||||
element: <PrivateLayout />,
|
||||
children: BrowserRoutes
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/public/notes/:token',
|
||||
element: <SharedNote />
|
||||
},
|
||||
{
|
||||
path: '*',
|
||||
element: <NotFound />
|
||||
}
|
||||
];
|
||||
|
||||
/**
|
||||
* Determines the appropriate router based on the user's authentication status.
|
||||
* @returns The configured router.
|
||||
*/
|
||||
const getBrowserRouter = () => {
|
||||
if (signed) {
|
||||
return createBrowserRouter(signedRouter);
|
||||
}
|
||||
return createBrowserRouter(notSignedRouter);
|
||||
};
|
||||
|
||||
const browserRouter = getBrowserRouter();
|
||||
|
||||
useEffect(() => {
|
||||
document.body.setAttribute('data-bs-theme', theme);
|
||||
localStorage.setItem('theme', theme);
|
||||
}, [theme]);
|
||||
|
||||
const toggleTheme = () => {
|
||||
setTheme(prev => (prev === 'light' ? 'dark' : 'light'));
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-dark"
|
||||
onClick={toggleTheme}
|
||||
>
|
||||
{theme === 'dark' ? '☀ Light Mode' : '🌙 Dark Mode'}
|
||||
</button>
|
||||
|
||||
{/* Your routes or content here */}
|
||||
{!loading && <RouterProvider router={browserRouter} />}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
@@ -0,0 +1,38 @@
|
||||
import React, { act } from 'react';
|
||||
import { test, vi } from 'vitest';
|
||||
import App from '../App';
|
||||
import { render } from '@testing-library/react';
|
||||
import AuthContext from '../context/AuthContext';
|
||||
import authContextMock from './__mocks__/authContextMock';
|
||||
import SidebarContext from '../context/SidebarContext';
|
||||
import FilterContext from '../context/FilterContext';
|
||||
|
||||
const sidebarContextMock = {
|
||||
currentPage: '/home',
|
||||
setNewPage: vi.fn()
|
||||
};
|
||||
|
||||
const filterContextMock = {
|
||||
filterText: '',
|
||||
selectedOption: 'everything',
|
||||
setFilterText: vi.fn(),
|
||||
setSelectedOption: vi.fn()
|
||||
};
|
||||
|
||||
vi.mock('react-charts', () => ({
|
||||
Chart: ({ options }) => <div data-testid="mocked-chart">Mocked Chart</div>
|
||||
}));
|
||||
|
||||
test('Renders the app', async () => {
|
||||
await act(async () => {
|
||||
render(
|
||||
<AuthContext.Provider value={authContextMock}>
|
||||
<SidebarContext.Provider value={sidebarContextMock}>
|
||||
<FilterContext.Provider value={filterContextMock}>
|
||||
<App />
|
||||
</FilterContext.Provider>
|
||||
</SidebarContext.Provider>
|
||||
</AuthContext.Provider>
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,15 @@
|
||||
import { vi } from "vitest";
|
||||
|
||||
const authContextMock = {
|
||||
signed: true,
|
||||
loading: false,
|
||||
user: undefined,
|
||||
checkCurrentAuthUser: vi.fn(),
|
||||
signIn: vi.fn(),
|
||||
signOut: vi.fn(),
|
||||
register: vi.fn(),
|
||||
isAdmin: false,
|
||||
updateUser: vi.fn()
|
||||
};
|
||||
|
||||
export default authContextMock;
|
||||
@@ -0,0 +1,31 @@
|
||||
import React from 'react';
|
||||
import { render } from '@testing-library/react';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import AlertError from '../../components/AlertError';
|
||||
|
||||
describe('AlertError Component tests', () => {
|
||||
const dataTestId: string = "alert-error-msg-tests";
|
||||
const renderAlert = (message?: string) => {
|
||||
return render(
|
||||
<AlertError errorMessage={message} dataTestId={dataTestId} />
|
||||
);
|
||||
};
|
||||
|
||||
it('should display the message if error', () => {
|
||||
const errorMessage = "Oops, something went wrong";
|
||||
const { getByTestId } = renderAlert(errorMessage);
|
||||
|
||||
expect(getByTestId(dataTestId)).toBeDefined();
|
||||
});
|
||||
|
||||
// Personal notes: queryByTestId should be used to find elements
|
||||
// that possibly aren't in the document. getByTestId expect always
|
||||
// to find the element.
|
||||
it('should not display the message if no error', () => {
|
||||
const errorMessage = "";
|
||||
const { queryByTestId } = renderAlert(errorMessage);
|
||||
(errorMessage);
|
||||
|
||||
expect(queryByTestId(dataTestId)).toBeNull();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,49 @@
|
||||
import React from 'react';
|
||||
import { render } from '@testing-library/react';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { MemoryRouter } from 'react-router';
|
||||
import ContentHeader from '../../components/ContentHeader';
|
||||
|
||||
const headerProps = {
|
||||
h1TextRegular: "Title part one",
|
||||
h1TextBold: "Title part two",
|
||||
subtitle: "This is the subtitle",
|
||||
h2BlackText: "Another text part one",
|
||||
h2GreenText: "Another green text",
|
||||
isHomeComponent: false
|
||||
};
|
||||
|
||||
describe('ContentHeader test cases', () => {
|
||||
it('should render all the text elements', () => {
|
||||
const { getByText } = render(<ContentHeader {...headerProps} />);
|
||||
|
||||
expect(getByText(headerProps.h1TextRegular)).toBeDefined();
|
||||
expect(getByText(headerProps.h1TextBold)).toBeDefined();
|
||||
expect(getByText(headerProps.subtitle)).toBeDefined();
|
||||
expect(getByText(headerProps.h2BlackText)).toBeDefined();
|
||||
expect(getByText(headerProps.h2GreenText)).toBeDefined();
|
||||
});
|
||||
|
||||
it('should render all the text elements for home', () => {
|
||||
const { getByText } = render(
|
||||
<MemoryRouter>
|
||||
<ContentHeader
|
||||
{ ...headerProps }
|
||||
isHomeComponent={true}
|
||||
newTaskI18n="New task"
|
||||
newNoteI18n="New note"
|
||||
/>
|
||||
</MemoryRouter>
|
||||
);
|
||||
|
||||
expect(getByText(headerProps.h1TextRegular)).toBeDefined();
|
||||
expect(getByText(headerProps.h1TextBold)).toBeDefined();
|
||||
expect(getByText(headerProps.subtitle)).toBeDefined();
|
||||
expect(getByText(headerProps.h2BlackText)).toBeDefined();
|
||||
expect(getByText(headerProps.h2GreenText)).toBeDefined();
|
||||
|
||||
// renders only if it's the home (dashboard)
|
||||
expect(getByText("New note")).toBeDefined();
|
||||
expect(getByText("New task")).toBeDefined();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,27 @@
|
||||
import React from 'react';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { MemoryRouter } from 'react-router';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import Header from '../../components/Header';
|
||||
import '../../i18n';
|
||||
|
||||
describe('Header component test', () => {
|
||||
it('should renders the Header with all elements', () => {
|
||||
render(
|
||||
<MemoryRouter>
|
||||
<Header />
|
||||
</MemoryRouter>,
|
||||
);
|
||||
const logo = screen.getByAltText('TaskNote logo');
|
||||
const homeLink = screen.getByText('Home');
|
||||
const tasksLink = screen.getByText('Tasks');
|
||||
const notesLink = screen.getByText('Notes');
|
||||
const aboutLink = screen.getByText('About');
|
||||
|
||||
expect(logo).toBeDefined();
|
||||
expect(homeLink).toBeDefined();
|
||||
expect(tasksLink).toBeDefined();
|
||||
expect(notesLink).toBeDefined();
|
||||
expect(aboutLink).toBeDefined();
|
||||
});
|
||||
});
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user