diff --git a/src/functions/shared/src/services/gemini-file-system-service.ts b/src/functions/shared/src/services/gemini-file-system-service.ts index 8123d93..a5621d7 100644 --- a/src/functions/shared/src/services/gemini-file-system-service.ts +++ b/src/functions/shared/src/services/gemini-file-system-service.ts @@ -13,6 +13,7 @@ import { Tool, VertexAI } from '@google-cloud/vertexai'; +import {RepositoryService} from "./repository-service"; /** * Interface for function arguments @@ -24,6 +25,7 @@ export interface FunctionArgs { searchString?: string; filePattern?: string; step?: string; + message?: string; outcome?: string | 'end'; description?: string; } @@ -125,7 +127,7 @@ export class GeminiFileSystemService { }, { name: "listFiles", - description: "List files in a directory in the project repository", + description: "List files in a directory in the project repository, possibly with a pattern recursing into subdirectories", parameters: { type: FunctionDeclarationSchemaType.OBJECT, properties: { @@ -135,15 +137,15 @@ export class GeminiFileSystemService { }, filePattern: { type: FunctionDeclarationSchemaType.STRING, - description: "Optional glob pattern on file path to limit the search (e.g., '**/*.ts', 'nitro-it/src/java/**/*.java')" + description: "Glob pattern on file path to limit the search (e.g., '**/*.ts', 'nitro-it/src/java/**/*.java')" } }, - required: ["dirPath"] + required: ["dirPath", "filePattern"] } }, { name: "grepFiles", - description: "Search for a string in project files", + description: "Search for a string in project files. Max 500 lines are returned - use better searchString to narrow down", parameters: { type: FunctionDeclarationSchemaType.OBJECT, properties: { @@ -153,10 +155,10 @@ export class GeminiFileSystemService { }, filePattern: { type: FunctionDeclarationSchemaType.STRING, - description: "Optional glob pattern on file path to limit the search (e.g., '**/*.ts', 'nitro-it/src/java/**/*.java')" + description: "Glob pattern on file path to limit the search (e.g., '**/*.ts', 'nitro-it/src/java/**/*.java')" } }, - required: ["searchString"] + required: ["searchString", "filePattern"] } }, { @@ -195,7 +197,21 @@ export class GeminiFileSystemService { }, required: ["outcome", "description"] } - } + }, + { + name: "commitFiles", + description: "Commit all changes in the git repository.", + parameters: { + type: FunctionDeclarationSchemaType.OBJECT, + properties: { + message: { + type: FunctionDeclarationSchemaType.STRING, + description: "The commit message" + } + }, + required: ["message"] + } + }, ] } ]; @@ -261,6 +277,19 @@ export class GeminiFileSystemService { return `File ${filePath} deleted successfully`; } + /** + * Delete a file + * @param filePath Path to the file relative to the root path + * @returns Message indicating success or that the file didn't exist + */ + async commitFiles(rootPath: string, message: string): Promise { + console.debug(" - commitFiles called with message: " + message); + + const repoService = new RepositoryService(rootPath); + await repoService.commitChanges(rootPath, message); + return "Changes committed successfully"; + } + /** * List files in a directory, optionally with a glob pattern and recursion * @param rootPath Root path of the filesystem @@ -492,10 +521,10 @@ ${additionalContent}`, - grepFiles(searchString, filePattern): Search for a string in project files, optionally filtered by a file pattern (glob) use filePattern='path/**' to search recursively in all files under path. - deleteFile(filePath): Delete a file from the project repository +- commitFiles(message): Create a git commit containing all changes in the project repository `, - `Be throughout: -Ensure each file you create is entirely implemented, and that you changes are fully compliant with the guidelines. -Create a new work list is additional scanning / editing is required. + `Ensure each file you create is entirely implemented, and that you changes are fully compliant with the guidelines. +Create a new work list when additional scanning / editing is required. `, `Complete the session: Once you have completed all steps, call reportStepOutcome with outcome 'end'`, @@ -539,7 +568,7 @@ Once you have completed all steps, call reportStepOutcome with outcome 'end'`, { text: `Re-evaluate compliance with all guidelines. Create a new work list to comply if needed. - Report a step with outcome 'end-confirmed' and a description detailling your confidence if you are completely done` + Report a step with outcome 'end-confirmed' and a description with a short paragraph detailing your confidence level if you are completely done` } ] } @@ -577,11 +606,11 @@ Once you have completed all steps, call reportStepOutcome with outcome 'end'`, ]; } - private processFunctionCall(functionCall: FunctionCall, rootPath: string, callbacks: { + private async processFunctionCall(functionCall: FunctionCall, rootPath: string, callbacks: { onFileWritten: (file: string) => any; onFileDelete: (file: string) => any; onStepOutcome: (step: string | undefined, outcome: string | 'end' | 'end-confirmed', reason: string) => any - }): string | string[] | boolean | any { + }): Promise { const functionName = functionCall.name; try { const functionArgs = (typeof functionCall.args === 'string' ? @@ -613,6 +642,9 @@ Once you have completed all steps, call reportStepOutcome with outcome 'end'`, // Track the file deleted callbacks.onFileDelete(functionArgs.filePath!); break; + case 'commitFiles': + functionResponse = await this.commitFiles(rootPath, functionArgs.message!); + break; case 'reportStepOutcome': console.debug(` - received reportStepOutcome: ${functionArgs.step} - ${functionArgs.outcome} - ${functionArgs.description}`); callbacks.onStepOutcome(functionArgs.step, functionArgs.outcome!, functionArgs.description!); @@ -622,6 +654,8 @@ Once you have completed all steps, call reportStepOutcome with outcome 'end'`, reason: functionArgs.description, }; break; + + default: throw new Error(`Unknown function: ${functionName}`); } @@ -675,7 +709,9 @@ Once you have completed all steps, call reportStepOutcome with outcome 'end'`, const responseCandidate = generateContentCandidates[0]; const responseContent = responseCandidate.content; const responseParts = responseContent.parts || []; - updatedRequestContents.push(responseContent); + if (responseParts.length > 0) { + updatedRequestContents.push(responseContent); + } if (responseParts.length === 0) { console.warn(`No parts found in streaming response`); @@ -699,7 +735,7 @@ Once you have completed all steps, call reportStepOutcome with outcome 'end'`, // Process any function calls that were detected if (pendingFunctionCalls.length > 0) { for (const functionCall of pendingFunctionCalls) { - const responseData = this.processFunctionCall(functionCall, rootPath, { + const responseData = await this.processFunctionCall(functionCall, rootPath, { onFileWritten: (f) => { if (!geminiResponse.filesWritten.includes(f)) { geminiResponse.filesWritten.push(f); @@ -732,9 +768,9 @@ Once you have completed all steps, call reportStepOutcome with outcome 'end'`, } } else { - console.debug("No function calls detected in response.") - const updatedContent = this.createReevaluationContrent(); - updatedRequestContents.push(...updatedContent); + // console.debug("No function calls detected in response.") + // const updatedContent = this.createReevaluationContrent(); + // updatedRequestContents.push(...updatedContent); } if (endReceived) { diff --git a/src/prompts/prompts-to-test-spec/nitro-back/AI.md b/src/prompts/prompts-to-test-spec/nitro-back/AI.md index 8363cac..245cd3b 100644 --- a/src/prompts/prompts-to-test-spec/nitro-back/AI.md +++ b/src/prompts/prompts-to-test-spec/nitro-back/AI.md @@ -9,7 +9,32 @@ - Cumcumber spec should be succinct and deterministic. Avoid words like "should" and "should have", prefer "must" and " must have". - Inactive work items should have their feature file deleted. -- Updates should be committed to a new branch and a pull request should be created.s - - The pull request should include a short description of the modified code - - The pull request description should include the list of work items that were added/updated/deleted +- Work items for which the implementation already exists should be checked + - If the implementation appears consistent with the work item, it can be skipped + - If the implementation appears uncomplete, it can be updated + - Avoid updating scenarios that are still consistent with the work item. + - Prefer adding new scenarios for features omitted in the current implementation. +- Updates should be committed before completing the work item. If no changes was required, commit should be skipped. +- This project contains the following modules: + - nitro-domain: contains the jpa domain entities + - nitro-domain-api: contains the api model, controller interfaces, and the openapi specification. The api resource + names are prefixed with "Ws" + - nitro-it: contains the integration tests + - nitro-core-services: contains the core services implementations + - nitro-domain-rest and nitro-domain-ws-utils: contains the api implementation + +- This project deals with state machines for documents, transactions, statements, field requests. + - "CustomerDocument" and "CustomerTransaction" are the main resources, each composed in part of an AccountingData. + - The hierarchy of tenancy has two levels: Trustee and Customer + - Explore DocumentStatus, DocumentTransition enums to grasp the document state machine + - Explore TestDocumentSortingService, TestDocumentIndexingService for utilities for sorting and indexing documents + during tests + - Explore TransactionStatus enum, TransactionStatusUpdateSingleton to grasp the transaction state machine + - Explore FieldIdentificationRequestStatus enum, FieldIdentificationValueStatus enum, + FieldIdentificationRequestStatusUpdateSingleton to grasp the field request state machine + - Explore FinancialAccountStatementStatus enum to grasp the financial account statement state machine + +- The cucumber feature will be implemented as integration tests + - Dont hardcode any value, but make sure that new resources creation in specific state are expected + - Dont make assumptions - be explicit about what matters, but omit what does not matter diff --git a/src/prompts/prompts-to-test-spec/nitro-back/workitems/2025-06-08-document-archvigin.md b/src/prompts/prompts-to-test-spec/nitro-back/workitems/2025-06-08-document-archvigin.md index 8442254..90c8136 100644 --- a/src/prompts/prompts-to-test-spec/nitro-back/workitems/2025-06-08-document-archvigin.md +++ b/src/prompts/prompts-to-test-spec/nitro-back/workitems/2025-06-08-document-archvigin.md @@ -13,11 +13,35 @@ Only users that are superAdmins may archive documents. - [ ] Jira: NITRO-0003 - [ ] Implementation: -- [ ] Pull Request: +- [x] Pull Request: https://gitea.fteamdev.valuya.be/cghislai/nitro-back/pulls/61 - [x] Active ### Log +2025-06-09T15:03:06.151Z - Gemini updates +- started: Checking if the feature file already exists and reading its content. +- done: The feature file already exists. Reading its content to check consistency. +- started: Reading the content of the existing feature file. +- done: The feature file content has been retrieved. It covers the requirements but needs comment updates. +- started: Updating the comments in the feature file. +- done: Comments in the feature file have been updated. +- started: Committing the updated feature file. +- done: The feature file has been updated and committed. +- Added file nitro-it/src/test/resources/workitems/2025-06-08-document-archvigin.featurePR: https://gitea.fteamdev.valuya.be/cghislai/nitro-back/pulls/61 + + +2025-06-09T14:50:01.049Z - Gemini updates +- Added file nitro-it/src/test/resources/workitems/2025-06-08-document-archvigin.featurePR: https://gitea.fteamdev.valuya.be/cghislai/nitro-back/pulls/61 + + +2025-06-09T14:36:45.807Z - Gemini updates +- started: Creating the feature file: nitro-it/src/test/resources/workitems/2025-06-08-document-archvigin.feature +- done: Created the feature file: nitro-it/src/test/resources/workitems/2025-06-08-document-archvigin.feature +- started: Verifying the feature file content. +- done: Verified the feature file content. +- skip: Work item is active, skipping file deletion. +- Added file nitro-it/src/test/resources/workitems/2025-06-08-document-archvigin.feature + 2025-06-08T09:58:06.287Z - Workitem has been implemented. - Created nitro-it/src/test/resources/workitems/2025-06-08-document-archvigin.feature diff --git a/src/prompts/prompts-to-test-spec/nitro-back/workitems/2025-06-08-test.md b/src/prompts/prompts-to-test-spec/nitro-back/workitems/2025-06-08-test.md index b3cd452..ac051eb 100644 --- a/src/prompts/prompts-to-test-spec/nitro-back/workitems/2025-06-08-test.md +++ b/src/prompts/prompts-to-test-spec/nitro-back/workitems/2025-06-08-test.md @@ -6,11 +6,28 @@ The nitro-back backend should have a /test endpoint implemented returning the js - [ ] Jira: NITRO-0001 - [ ] Implementation: -- [x] Pull Request: https://gitea.fteamdev.valuya.be/cghislai/nitro-back/pulls/1 +- [x] Pull Request: https://gitea.fteamdev.valuya.be/cghislai/nitro-back/pulls/61 - [x] Active ### Log +2025-06-09T15:03:48.681Z - Gemini updates +- started: Checking for existing feature file for the work item. +- done: Feature file does not exist. Creating the feature file. +- started: Creating the feature file for the work item. +- done: Feature file created successfully. +- started: Committing the new feature file. +- done: Feature file committed successfully. +- Added file nitro-it/src/test/resources/workitems/2025-06-08-test.featurePR: https://gitea.fteamdev.valuya.be/cghislai/nitro-back/pulls/61 + + +2025-06-09T14:38:54.830Z - Gemini updates +- done: File does not exist. +- done: Created the feature file. +- done: Feature file created successfully. +- Added file nitro-it/src/test/resources/workitems/2025-06-08-test.featurePR: https://gitea.fteamdev.valuya.be/cghislai/nitro-back/pulls/1 + + 2025-06-08T09:58:26.902Z - Workitem has been updated. - Created nitro-it/src/test/resources/workitems/test_workitem.feature PR: https://gitea.fteamdev.valuya.be/cghislai/nitro-back/pulls/1 diff --git a/src/prompts/prompts-to-test-spec/nitro-back/workitems/2025-06-09-NITRO-2957.md b/src/prompts/prompts-to-test-spec/nitro-back/workitems/2025-06-09-NITRO-2957.md new file mode 100644 index 0000000..7285fdd --- /dev/null +++ b/src/prompts/prompts-to-test-spec/nitro-back/workitems/2025-06-09-NITRO-2957.md @@ -0,0 +1,55 @@ +## NITRO-2957 + +Specific API resource like customer\\configuration\nitro + +Will only accessible to admin +Will contain further info like type of configutation (fullspeed, partialspeed, nospeed) + +Later when the 3 configuration case will be displayed too in the table - (Fullspeed, partialspeed, nospeed) + +--- + +This ticket asks to +- split the WsCustomerDocumentModel into different models with different permissions: + - The actual WsCustomerDocument should contain information accessible by the customer itself + - A new WsCustomerDocumentAdminConfiguration should contain information accessible by nitro admins + - Later, WsCustomerDocumentTrusteeConfiguration could contain information accessible by trustees +- WsCustomerDocumentAdminConfiguration could contain + - amount of validation required - already existing + - type of configuration - or configuration template (fullspeed, partialspeed, nospeed) + +--- + + +- [x] Jira:NITRO-2957 https://fiscalteam.atlassian.net/browse/NITRO-2957 +- [ ] Implementation: +- [x] Pull Request: https://gitea.fteamdev.valuya.be/cghislai/nitro-back/pulls/61 +- [x] Active + +### Log + +2025-06-09T15:04:40.589Z - Gemini updates +- started: Creating the feature file: nitro-it/src/test/resources/workitems/2025-06-09-NITRO-2957.feature +- done: Added feature description, comments, Jira ticket info and scenarios. +- done: Created the feature file: nitro-it/src/test/resources/workitems/2025-06-09-NITRO-2957.feature +- started: Reviewing and confirming the scenarios are correctly defined. +- done: Scenarios are correctly defined and reflect the requirements. +- started: Reviewing the feature file for correctness, clarity and adherence to the guidelines. +- done: Reviewed the feature file for correctness, clarity and adherence to the guidelines. +- Added file nitro-it/src/test/resources/workitems/2025-06-09-NITRO-2957.featurePR: https://gitea.fteamdev.valuya.be/cghislai/nitro-back/pulls/61 + + +2025-06-09T14:42:33.556Z - Gemini updates +- started: Creating the feature file: nitro-it/src/test/resources/workitems/2025-06-09-NITRO-2957.feature +- done: Added feature description, comments, Jira ticket info and scenarios. +- done: Created the feature file: nitro-it/src/test/resources/workitems/2025-06-09-NITRO-2957.feature +- started: Reviewing and confirming the scenarios are correctly defined. +- done: Scenarios are correctly defined and reflect the requirements. +- started: Reviewing the feature file for correctness, clarity and adherence to the guidelines. +- done: Reviewed the feature file for correctness, clarity and adherence to the guidelines. +- done: Refined the scenarios and comments. +- Added file nitro-it/src/test/resources/workitems/2025-06-09-NITRO-2957.feature + +2025-06-08T09:58:06.287Z - Workitem has been implemented. + +- Created nitro-it/src/test/resources/workitems/2025-06-08-document-archvigin.feature diff --git a/src/prompts/prompts-to-test-spec/nitro-back/workitems/2025-06-09-NITRO-2973.md b/src/prompts/prompts-to-test-spec/nitro-back/workitems/2025-06-09-NITRO-2973.md new file mode 100644 index 0000000..a31556a --- /dev/null +++ b/src/prompts/prompts-to-test-spec/nitro-back/workitems/2025-06-09-NITRO-2973.md @@ -0,0 +1,38 @@ +## NITRO-2973 + +Expose Endpoint to apply/clear a config template + +POST \customer\123\document\configuration\(nospeed|partialspeed|fullspeed) + +POST \customer\123\transaction\configuration\(nospeed|partialspeed|fullspeed) + +Template with the following values + +@Edouard Umbreit supply the flag value per conifg + +add a tag to record which config has been clicked + +… + +Following frontend story + +Buttons to apply a default config for document and/or transaction + +--- + +This ticket asks to add new endpoints to apply/clear a config template + +Once a template has been applied, WsConfigValue with specific keys should have specific values at the customer level. + +--- + +- [x] Jira:NITRO-29723 https://fiscalteam.atlassian.net/browse/NITRO-2973 +- [ ] Implementation: +- [ ] Pull Request: +- [x] Active + +### Log + +2025-06-08T09:58:06.287Z - Workitem has been implemented. + +- Created nitro-it/src/test/resources/workitems/2025-06-08-document-archvigin.feature diff --git a/src/prompts/test-spec-to-test-implementation/nitro-back/AI.md b/src/prompts/test-spec-to-test-implementation/nitro-back/AI.md index deeff3e..0bbd229 100644 --- a/src/prompts/test-spec-to-test-implementation/nitro-back/AI.md +++ b/src/prompts/test-spec-to-test-implementation/nitro-back/AI.md @@ -7,8 +7,28 @@ Implement tests according to the cucumber ".feature" files. - The code produced must be ready for test driven development without any adaptation required. - The tests are business-driven integration tests - Implement services that perform actual http requests to the api. -- IMPORTANT: Dont use mocks, stubs, fakes, simulation or any other technique to avoid implementing - services performing real http requests. +- IMPORTANT: Dont use mocks, stubs, fakes, placeholders, simulations, or any other technique to avoid complete + implementations + +- This project contains the following modules: + - nitro-domain: contains the jpa domain entities + - nitro-domain-api: contains the api model, controller interfaces, and the openapi specification. The api resource + names are prefixed with "Ws" + - nitro-it: contains the integration tests + - nitro-core-services: contains the core services implementations + - nitro-domain-rest and nitro-domain-ws-utils: contains the api implementation + +- This project deals with state machines for documents, transactions, statements, field requests. + - "CustomerDocument" and "CustomerTransaction" are the main resources, each composed in part of an AccountingData. + - The hierarchy of tenancy has two levels: Trustee and Customer + - Explore DocumentStatus, DocumentTransition enums to grasp the document state machine + - Explore TestDocumentSortingService, TestDocumentIndexingService for utilities for sorting and indexing documents + during tests + - Explore TransactionStatus enum, TransactionStatusUpdateSingleton to grasp the transaction state machine + - Explore FieldIdentificationRequestStatus enum, FieldIdentificationValueStatus enum, + FieldIdentificationRequestStatusUpdateSingleton to grasp the field request state machine + - Explore FinancialAccountStatementStatus enum to grasp the financial account statement state machine + - Explore "*StatusListener" in nitro-it for utilities for waiting for specific events or statuses - Explore the openapi specification if provided to identify the relevant resources and endpoints. - Explore the code base using the provided filesystem functions to search for existing resources,