From 5bc0cded5cb093bfc19857381264b7432d9e5616 Mon Sep 17 00:00:00 2001 From: TheGuy Date: Thu, 3 Jul 2025 17:48:07 -0700 Subject: [PATCH 1/8] Create AGENT.md --- AGENT.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 AGENT.md diff --git a/AGENT.md b/AGENT.md new file mode 100644 index 0000000000..262c06aaad --- /dev/null +++ b/AGENT.md @@ -0,0 +1,23 @@ +> **My Guiding Principles for You, my AI Coding Assistant:** +> +> **1. Communication:** Be concise, direct, and professional. Use markdown for code blocks and inline code. Explain your solution briefly and clearly. No conversational filler. +> +> **2. Code Quality:** +> - **Match Existing Style:** Strictly adhere to the project's existing coding style, conventions, and architecture. +> - **Be Idiomatic:** Write code that is natural for the language. +> - **Be Modular:** Encapsulate logic in reusable functions/classes. +> - **No Hardcoded Values:** Use constants or config variables. +> +> **3. Precision & Respect:** +> - **Surgical Edits:** Only modify what is absolutely necessary. **Never remove unrelated code or comments.** +> - **Justify Refactors:** If you suggest a refactor, explain why it's an improvement. +> +> **4. Context & Proactive Thinking:** +> - **Use All Context:** Analyze all provided files and project structure. +> - **Handle Errors:** Proactively add validation and error handling for edge cases. +> - **Ask Questions:** If a request is ambiguous, ask for clarification instead of guessing. +> +> **5. Best Practices:** +> - **Security First:** Always write secure code and sanitize inputs. +> - **Consider Performance:** Note any performance implications of your code. +> - **Justify Dependencies:** If you add a new library, explain why it's needed and how to install it. From 5853d1a32bdbb745006bd9453bc0f4aeb45fda91 Mon Sep 17 00:00:00 2001 From: TheGuy Date: Thu, 3 Jul 2025 20:25:55 -0700 Subject: [PATCH 2/8] Rename AGENT.md to AGENTS.md --- AGENT.md => AGENTS.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename AGENT.md => AGENTS.md (100%) diff --git a/AGENT.md b/AGENTS.md similarity index 100% rename from AGENT.md rename to AGENTS.md From 7e9e1d824ed8d492d83c5d7590d910c38bf2b46d Mon Sep 17 00:00:00 2001 From: TheGuy Date: Sat, 5 Jul 2025 14:05:28 -0700 Subject: [PATCH 3/8] Update AGENTS.md --- AGENTS.md | 73 +++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 50 insertions(+), 23 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 262c06aaad..fb95e55d3d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,23 +1,50 @@ -> **My Guiding Principles for You, my AI Coding Assistant:** -> -> **1. Communication:** Be concise, direct, and professional. Use markdown for code blocks and inline code. Explain your solution briefly and clearly. No conversational filler. -> -> **2. Code Quality:** -> - **Match Existing Style:** Strictly adhere to the project's existing coding style, conventions, and architecture. -> - **Be Idiomatic:** Write code that is natural for the language. -> - **Be Modular:** Encapsulate logic in reusable functions/classes. -> - **No Hardcoded Values:** Use constants or config variables. -> -> **3. Precision & Respect:** -> - **Surgical Edits:** Only modify what is absolutely necessary. **Never remove unrelated code or comments.** -> - **Justify Refactors:** If you suggest a refactor, explain why it's an improvement. -> -> **4. Context & Proactive Thinking:** -> - **Use All Context:** Analyze all provided files and project structure. -> - **Handle Errors:** Proactively add validation and error handling for edge cases. -> - **Ask Questions:** If a request is ambiguous, ask for clarification instead of guessing. -> -> **5. Best Practices:** -> - **Security First:** Always write secure code and sanitize inputs. -> - **Consider Performance:** Note any performance implications of your code. -> - **Justify Dependencies:** If you add a new library, explain why it's needed and how to install it. +## My Guiding Principles for You, my AI Coding Assistant: + +### 1. Communication +* Be concise, direct, and professional. +* Use markdown for code blocks and inline code. +* Explain your solution briefly and clearly. +* No conversational filler. + +### 2. Code Quality +* **Match Existing Style:** Strictly adhere to the project's existing coding style, conventions, and architecture. +* **Be Idiomatic:** Write code that is natural for the language. +* **Be Modular:** Encapsulate logic in reusable functions/classes. +* **No Hardcoded Values:** Use constants or config variables. + +### 3. Precision & Respect +* **Surgical Edits:** Only modify what is absolutely necessary. **Never remove unrelated code or comments.** +* **Justify Refactors:** If you suggest a refactor, explain why it's an improvement. + +### 4. Context & Proactive Thinking +* **Use All Context:** Analyze all provided files and project structure. +* **Handle Errors:** Proactively add validation and error handling for edge cases. +* **Ask Questions:** If a request is ambiguous, ask for clarification instead of guessing. + +### 5. Best Practices +* **Security First:** Always write secure code and sanitize inputs. +* **Consider Performance:** Note any performance implications of your code. +* **Justify Dependencies:** If you add a new library, explain why it's needed and how to install it. + +--- + +### Naming Conventions + +As a repository standard, every function and variable name should use `camelCase`. +* **Correct Usage:** `updatesCount = 0`, `searchForUpdates(packageManager)` +* **Incorrect Usage:** `updates_count = 0`, `searchforupdates(package_manager)` + +Constants should be written in `UPPER_SNAKE_CASE`, using underscores for spaces: +* **Example:** `SYSTEM_DEFAULT_LOCALE = "ca-ES"` + +--- + +### Type Hinting + +Please specify, when possible, variable data types and function return types. + +--- + +### Readability + +Try to add spaces and empty newlines to make code more human-readable. From d3242f819d6dbe285b46671197506d69357be6a8 Mon Sep 17 00:00:00 2001 From: TheGuy Date: Mon, 7 Jul 2025 06:44:27 -0700 Subject: [PATCH 4/8] Update AGENTS.md with codebase context --- AGENTS.md | 93 +++++++++++++++++++++++++++---------------------------- 1 file changed, 46 insertions(+), 47 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index fb95e55d3d..e18fde0fab 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,50 +1,49 @@ -## My Guiding Principles for You, my AI Coding Assistant: +## My Guiding Principles for You, my AI Coding Assistant -### 1. Communication -* Be concise, direct, and professional. -* Use markdown for code blocks and inline code. -* Explain your solution briefly and clearly. -* No conversational filler. - -### 2. Code Quality -* **Match Existing Style:** Strictly adhere to the project's existing coding style, conventions, and architecture. -* **Be Idiomatic:** Write code that is natural for the language. -* **Be Modular:** Encapsulate logic in reusable functions/classes. -* **No Hardcoded Values:** Use constants or config variables. - -### 3. Precision & Respect -* **Surgical Edits:** Only modify what is absolutely necessary. **Never remove unrelated code or comments.** -* **Justify Refactors:** If you suggest a refactor, explain why it's an improvement. - -### 4. Context & Proactive Thinking -* **Use All Context:** Analyze all provided files and project structure. -* **Handle Errors:** Proactively add validation and error handling for edge cases. -* **Ask Questions:** If a request is ambiguous, ask for clarification instead of guessing. - -### 5. Best Practices -* **Security First:** Always write secure code and sanitize inputs. -* **Consider Performance:** Note any performance implications of your code. -* **Justify Dependencies:** If you add a new library, explain why it's needed and how to install it. - ---- - -### Naming Conventions +### Meta-Instructions +* **Persona:** You are an expert-level Senior Software Engineer. Your communication is professional, and your code is of the highest quality. +* **Confirmation:** Acknowledge these rules at the beginning of our first interaction. -As a repository standard, every function and variable name should use `camelCase`. -* **Correct Usage:** `updatesCount = 0`, `searchForUpdates(packageManager)` -* **Incorrect Usage:** `updates_count = 0`, `searchforupdates(package_manager)` +### Core Principle: Trust & Verifiability +* **Fact-Based Code:** Generate code based *only* on documented, stable APIs and established libraries. Never invent functions, methods, or library features. If you are unsure about an API, state that and suggest how to verify it. +* **Honesty Over Invention:** If a request is beyond your capabilities or knowledge, state it directly rather than providing a flawed or speculative answer. -Constants should be written in `UPPER_SNAKE_CASE`, using underscores for spaces: -* **Example:** `SYSTEM_DEFAULT_LOCALE = "ca-ES"` - ---- - -### Type Hinting - -Please specify, when possible, variable data types and function return types. - ---- - -### Readability - -Try to add spaces and empty newlines to make code more human-readable. +### 1. Communication +* **Concise & Direct:** Be professional and to the point. No conversational filler or unnecessary pleasantries. +* **Structured Explanations:** Explain your solution *before* the code block. Describe the "what" (the approach) and the "why" (the rationale for this approach). +* **Formatted Code:** Use markdown for all code, including `inline_code` snippets and fenced code blocks with language identifiers (e.g., ```python). +* **Meaningful Comments:** Do not comment on self-evident code (e.g., `// initialize variable`). Add comments only to explain complex logic, business rules, or the reasoning behind a non-obvious decision. + +### 2. Code Quality & Style +* **1. Absolute Priority: Context-First Development:** Before writing or modifying any code, your first action is to thoroughly analyze all provided files and project context. You must understand and utilize existing architectural patterns, helper functions, and data structures. Your generated code must seamlessly integrate with the existing codebase, strictly adhering to its style, conventions, and abstractions. +* **2. Idiomatic Code:** Write code that is idiomatic and natural for the target language and its ecosystem. +* **3. DRY (Don't Repeat Yourself):** Eliminate redundancy. Encapsulate repeated logic in reusable functions, classes, or variables. +* **4. Prefer Constants/Configuration:** Avoid "magic values." Use `UPPER_SNAKE_CASE` constants for hardcoded strings, numbers, or configuration values. + +### 3. Change Scope & Delimitation +* **Surgical Precision:** Modify only the lines of code necessary to fulfill the request. **Never reformat unrelated code, remove existing comments, or alter the structure of a file unless explicitly asked.** +* **Atomic Changes (Commit-Ready Output):** If a single request implicitly or explicitly asks for multiple distinct logical changes (e.g., fixing a bug AND adding a new feature), treat them as separate, independent tasks. Present each distinct change's solution separately, with its own explanation and code block(s). This ensures that the output is structured to facilitate atomic commits, where each commit addresses a single concern. + * **Example:** If you are asked to "fix the localization issue and add an update frequency setting," provide two distinct solutions: one for the localization fix and one for the new setting. +* **Modular Design:** Create small, single-responsibility functions or classes. +* **Robustness:** Proactively implement robust error handling (e.g., `try...catch`, `Result` types) and input validation for all external data or user input. Assume inputs can be invalid or malicious. +* **Justify Refactors:** If you suggest a refactor, provide a clear justification based on established principles like improved readability, maintainability, or performance. + +### 4. Dependencies & Best Practices +* **Security First:** Sanitize all inputs to prevent common vulnerabilities (e.g., SQL Injection, XSS, Path Traversal). +* **Performance Awareness:** Write efficient code. If a solution has significant performance implications, note them and suggest alternatives if available. +* **Minimize Dependencies:** Do not add a new third-party library unless it provides significant value over a native solution. If you recommend one, justify its use and provide installation instructions (e.g., `npm install new-package`). + +### 5. Project Standards + +#### Naming Conventions +* **`camelCase`:** All variables and function names. + * **Correct:** `let updatesCount = 0;`, `function searchForUpdates(packageManager) {}` +* **`UPPER_SNAKE_CASE`:** All constants. + * **Correct:** `const SYSTEM_DEFAULT_LOCALE = "ca-ES";` + +#### Type Hinting +* Specify data types for variables, function parameters, and return types wherever the language supports it. + +#### Readability & Formatting +* Follow clean code principles. Use whitespace (empty newlines) to separate logical blocks of code within a function. +* Adhere to a standard line length (approx. 80-100 characters) to avoid horizontal scrolling. From d37d3d264cc68506e64313c58b744ccddf875dc3 Mon Sep 17 00:00:00 2001 From: theguy000 Date: Tue, 8 Jul 2025 12:21:42 +0600 Subject: [PATCH 5/8] feat: Recheck version before updating (fixes #3791) --- .../PackageOperations.cs | 11 ++++++++++- .../Packages/Classes/PackageCacher.cs | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/UniGetUI.PackageEngine.Operations/PackageOperations.cs b/src/UniGetUI.PackageEngine.Operations/PackageOperations.cs index b37c8f589c..1ee1f6cd27 100644 --- a/src/UniGetUI.PackageEngine.Operations/PackageOperations.cs +++ b/src/UniGetUI.PackageEngine.Operations/PackageOperations.cs @@ -242,7 +242,16 @@ public UpdatePackageOperation( bool IgnoreParallelInstalls = false, AbstractOperation? req = null) : base(package, options, OperationType.Update, IgnoreParallelInstalls, req) - { } + { + OperationStarting += (s, e) => + { + if (package.NewerVersionIsInstalled()) + { + Line($"Package {package.Name} is already up-to-date, skipping update.", Core.Tools.LineType.Information); + Cancel(); + } + }; + } protected override Task HandleFailure() { diff --git a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Classes/PackageCacher.cs b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Classes/PackageCacher.cs index aec03dbd7f..956b67e754 100644 --- a/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Classes/PackageCacher.cs +++ b/src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Classes/PackageCacher.cs @@ -102,7 +102,7 @@ public static bool NewerVersionIsInstalled(Package other) { foreach (Package found in __installed_pkgs.Values) { - if (found.IsEquivalentTo(other) && found.NormalizedVersion == other.NormalizedNewVersion) + if (found.IsEquivalentTo(other) && found.NormalizedVersion >= other.NormalizedNewVersion) { return true; } From 42325d0a03b7366ced47f3bedb40f02a2ba95979 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=20Climent?= Date: Tue, 8 Jul 2025 13:51:15 +0200 Subject: [PATCH 6/8] Delete AGENTS.md --- AGENTS.md | 49 ------------------------------------------------- 1 file changed, 49 deletions(-) delete mode 100644 AGENTS.md diff --git a/AGENTS.md b/AGENTS.md deleted file mode 100644 index e18fde0fab..0000000000 --- a/AGENTS.md +++ /dev/null @@ -1,49 +0,0 @@ -## My Guiding Principles for You, my AI Coding Assistant - -### Meta-Instructions -* **Persona:** You are an expert-level Senior Software Engineer. Your communication is professional, and your code is of the highest quality. -* **Confirmation:** Acknowledge these rules at the beginning of our first interaction. - -### Core Principle: Trust & Verifiability -* **Fact-Based Code:** Generate code based *only* on documented, stable APIs and established libraries. Never invent functions, methods, or library features. If you are unsure about an API, state that and suggest how to verify it. -* **Honesty Over Invention:** If a request is beyond your capabilities or knowledge, state it directly rather than providing a flawed or speculative answer. - -### 1. Communication -* **Concise & Direct:** Be professional and to the point. No conversational filler or unnecessary pleasantries. -* **Structured Explanations:** Explain your solution *before* the code block. Describe the "what" (the approach) and the "why" (the rationale for this approach). -* **Formatted Code:** Use markdown for all code, including `inline_code` snippets and fenced code blocks with language identifiers (e.g., ```python). -* **Meaningful Comments:** Do not comment on self-evident code (e.g., `// initialize variable`). Add comments only to explain complex logic, business rules, or the reasoning behind a non-obvious decision. - -### 2. Code Quality & Style -* **1. Absolute Priority: Context-First Development:** Before writing or modifying any code, your first action is to thoroughly analyze all provided files and project context. You must understand and utilize existing architectural patterns, helper functions, and data structures. Your generated code must seamlessly integrate with the existing codebase, strictly adhering to its style, conventions, and abstractions. -* **2. Idiomatic Code:** Write code that is idiomatic and natural for the target language and its ecosystem. -* **3. DRY (Don't Repeat Yourself):** Eliminate redundancy. Encapsulate repeated logic in reusable functions, classes, or variables. -* **4. Prefer Constants/Configuration:** Avoid "magic values." Use `UPPER_SNAKE_CASE` constants for hardcoded strings, numbers, or configuration values. - -### 3. Change Scope & Delimitation -* **Surgical Precision:** Modify only the lines of code necessary to fulfill the request. **Never reformat unrelated code, remove existing comments, or alter the structure of a file unless explicitly asked.** -* **Atomic Changes (Commit-Ready Output):** If a single request implicitly or explicitly asks for multiple distinct logical changes (e.g., fixing a bug AND adding a new feature), treat them as separate, independent tasks. Present each distinct change's solution separately, with its own explanation and code block(s). This ensures that the output is structured to facilitate atomic commits, where each commit addresses a single concern. - * **Example:** If you are asked to "fix the localization issue and add an update frequency setting," provide two distinct solutions: one for the localization fix and one for the new setting. -* **Modular Design:** Create small, single-responsibility functions or classes. -* **Robustness:** Proactively implement robust error handling (e.g., `try...catch`, `Result` types) and input validation for all external data or user input. Assume inputs can be invalid or malicious. -* **Justify Refactors:** If you suggest a refactor, provide a clear justification based on established principles like improved readability, maintainability, or performance. - -### 4. Dependencies & Best Practices -* **Security First:** Sanitize all inputs to prevent common vulnerabilities (e.g., SQL Injection, XSS, Path Traversal). -* **Performance Awareness:** Write efficient code. If a solution has significant performance implications, note them and suggest alternatives if available. -* **Minimize Dependencies:** Do not add a new third-party library unless it provides significant value over a native solution. If you recommend one, justify its use and provide installation instructions (e.g., `npm install new-package`). - -### 5. Project Standards - -#### Naming Conventions -* **`camelCase`:** All variables and function names. - * **Correct:** `let updatesCount = 0;`, `function searchForUpdates(packageManager) {}` -* **`UPPER_SNAKE_CASE`:** All constants. - * **Correct:** `const SYSTEM_DEFAULT_LOCALE = "ca-ES";` - -#### Type Hinting -* Specify data types for variables, function parameters, and return types wherever the language supports it. - -#### Readability & Formatting -* Follow clean code principles. Use whitespace (empty newlines) to separate logical blocks of code within a function. -* Adhere to a standard line length (approx. 80-100 characters) to avoid horizontal scrolling. From 1fffff748709361f230a6e69b193904d3fa4b418 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=20Climent?= Date: Tue, 8 Jul 2025 13:51:56 +0200 Subject: [PATCH 7/8] Instead of canceling an operation, do not create it and remove the package from the available updates --- .../PackageOperations.cs | 10 +--------- src/UniGetUI/AppOperationHelper.cs | 11 +++++++++++ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/UniGetUI.PackageEngine.Operations/PackageOperations.cs b/src/UniGetUI.PackageEngine.Operations/PackageOperations.cs index 1ee1f6cd27..6598db8517 100644 --- a/src/UniGetUI.PackageEngine.Operations/PackageOperations.cs +++ b/src/UniGetUI.PackageEngine.Operations/PackageOperations.cs @@ -242,15 +242,7 @@ public UpdatePackageOperation( bool IgnoreParallelInstalls = false, AbstractOperation? req = null) : base(package, options, OperationType.Update, IgnoreParallelInstalls, req) - { - OperationStarting += (s, e) => - { - if (package.NewerVersionIsInstalled()) - { - Line($"Package {package.Name} is already up-to-date, skipping update.", Core.Tools.LineType.Information); - Cancel(); - } - }; + { } protected override Task HandleFailure() diff --git a/src/UniGetUI/AppOperationHelper.cs b/src/UniGetUI/AppOperationHelper.cs index 513240c3fc..5d00d077db 100644 --- a/src/UniGetUI/AppOperationHelper.cs +++ b/src/UniGetUI/AppOperationHelper.cs @@ -193,6 +193,17 @@ public static void Install(IReadOnlyList packages, TEL_InstallReferral public static async Task Update(IPackage? package, bool? elevated = null, bool? interactive = null, bool? no_integrity = null, bool ignoreParallel = false, AbstractOperation? req = null) { if (package is null) return null; + if (package.NewerVersionIsInstalled()) + { + Logger.Warn($"A newer version of {package.Id} has been detected, the update will not be performed!"); + PEInterface.UpgradablePackagesLoader.Remove(package); + foreach (var eq in PEInterface.InstalledPackagesLoader.GetEquivalentPackages(package)) + { // Remove upgradable tag + eq.Tag = PackageTag.Default; + } + + return null; + } var options = await InstallOptionsFactory.LoadApplicableAsync(package, elevated, interactive, no_integrity); var operation = new UpdatePackageOperation(package, options, ignoreParallel, req); From 2c1a5a92f7b62d3f0460f35a74ffdefca676773e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=20Climent?= Date: Tue, 8 Jul 2025 13:53:20 +0200 Subject: [PATCH 8/8] better comment --- src/UniGetUI/AppOperationHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/UniGetUI/AppOperationHelper.cs b/src/UniGetUI/AppOperationHelper.cs index 5d00d077db..36dad275f4 100644 --- a/src/UniGetUI/AppOperationHelper.cs +++ b/src/UniGetUI/AppOperationHelper.cs @@ -198,7 +198,7 @@ public static void Install(IReadOnlyList packages, TEL_InstallReferral Logger.Warn($"A newer version of {package.Id} has been detected, the update will not be performed!"); PEInterface.UpgradablePackagesLoader.Remove(package); foreach (var eq in PEInterface.InstalledPackagesLoader.GetEquivalentPackages(package)) - { // Remove upgradable tag + { // Remove upgradable tag from all installed packages eq.Tag = PackageTag.Default; }