Skip to content

Commit 0029d33

Browse files
authored
Merge pull request #36 from BrunoV21/get-duplicate-protection
Get duplicate protection
2 parents 315503f + 498c88a commit 0029d33

File tree

2 files changed

+36
-11
lines changed

2 files changed

+36
-11
lines changed

codetide/__init__.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,8 @@ def get(
571571
"""
572572
if isinstance(code_identifiers, str):
573573
code_identifiers = [code_identifiers]
574+
else:
575+
code_identifiers = self.get_unique_paths(code_identifiers)
574576

575577
logger.info(
576578
f"Context request - IDs: {code_identifiers}, "
@@ -602,3 +604,23 @@ def _as_file_paths(self, code_identifiers: Union[str, List[str]])->List[str]:
602604
as_file_paths.append(element)
603605

604606
return as_file_paths
607+
608+
@staticmethod
609+
def get_unique_paths(path_list):
610+
"""
611+
Process a list of path strings and return only unique entries.
612+
Normalizes path separators to handle both forward and back slashes.
613+
"""
614+
seen = set()
615+
unique_paths = []
616+
617+
for path in path_list:
618+
# Normalize the path to use OS-appropriate separators
619+
normalized = os.path.normpath(path)
620+
621+
# Only add if we haven't seen this normalized path before
622+
if normalized not in seen:
623+
seen.add(normalized)
624+
unique_paths.append(normalized)
625+
626+
return unique_paths

codetide/agents/tide/prompts.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@
4444
Take initiative, take responsibility, and take pride in completing tasks to their fullest.
4545
Never submit code you would not be confident using in a live production environment.
4646
47-
**Commit Message Guidelines:**
48-
49-
If the user requests a commit message, generate a concise, descriptive message that summarizes the change.
50-
The message should be one to two lines, easy to read, and clearly communicate the purpose and impact of the change.
51-
5247
"""
5348

5449
ASSISTANT_SYSTEM_PROMPT = """
@@ -339,11 +334,14 @@
339334
"""
340335

341336
CMD_COMMIT_PROMPT = """
342-
Generate a conventional commit message that summarizes the changes since the previous commit.
337+
Generate a conventional commit message that accurately and comprehensively summarizes **all** changes staged since the previous commit.
343338
344339
**Instructions:**
345-
1. Write a brief, clear description, focusing on what was changed, added, removed, or refactored. Summarize the implementation approach or the nature of the changes, while providing just enough context to understand them:
346-
- This description must be written in third person and should begin with "This commit" followed by a verb (e.g., "This commit adds", "This commit fixes", "This commit refactors") or "This commit introduces" for new features or concepts.
340+
1. Write a clear, descriptive subject line that reflects the full scope of the staged changes. The message must:
341+
- Capture all significant changes, additions, removals, or refactors across all affected files, features, or modules.
342+
- Be as representative and bounded as possible: do not omit any major change, and do not focus only on a subset if the commit is broad.
343+
- For large or multi-file commits, summarize the main areas, features, or modules affected, grouping related changes and mentioning all key updates.
344+
- The description must be written in third person and should begin with "This commit" followed by a verb (e.g., "This commit adds", "This commit fixes", "This commit refactors") or "This commit introduces" for new features or concepts.
347345
348346
2. Place only the commit subject line inside the commit block:
349347
*** Begin Commit
@@ -352,17 +350,19 @@
352350
353351
3. **Conventional Commit Format Rules:**
354352
- Use format: `type(scope): description`
355-
- **Types:** feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert
353+
- **Types:** feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert, prompt
356354
- **Scope:** Optional, use lowercase (e.g., api, ui, auth, database)
357355
- **Description:** Imperative mood, lowercase, no period, max 50 chars
358356
- **Breaking changes:** Add `!` after type/scope or use `BREAKING CHANGE:` in footer
359357
360358
4. **Best Practices:**
361359
- Use imperative mood: "add feature" not "added feature"
362-
- Be specific but concise
360+
- Be specific, comprehensive, and concise
363361
- Focus on the "what" and "why", not the "how"
364-
- Group related changes under appropriate types
362+
- Group related changes under appropriate types and mention all major affected areas
365363
- Use consistent terminology across commits
364+
- For large commits, mention all key files, modules, or features updated (e.g., "update user and auth modules", "refactor api and utils", "add tests for models and controllers")
365+
- The commit message must be bounded to the actual staged code and reflect all significant updates
366366
367367
5. If no staged diffs are provided, reply that there's nothing to commit.
368368
@@ -391,6 +391,9 @@
391391
- `prompts(ai): update system prompt for better code generation`
392392
- `build: upgrade webpack to v5.0`
393393
- `feat!: remove deprecated user endpoints`
394+
- `refactor(api,utils): update request handling and helpers`
395+
- `test(models,controllers): add tests for user and order logic`
396+
- `feat(auth,ui): implement login page and backend logic`
394397
"""
395398

396399
STAGED_DIFFS_TEMPLATE = """

0 commit comments

Comments
 (0)