From 5f05209b6553851368d30bde39e1f4c180d4272a Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Sun, 25 Aug 2024 22:16:56 +0200 Subject: [PATCH 1/5] Initial requirement --- build.gradle | 2 ++ docs/requirements/ai.md | 12 ++++++++++++ docs/requirements/index.md | 8 ++++++++ 3 files changed, 22 insertions(+) create mode 100644 docs/requirements/ai.md create mode 100644 docs/requirements/index.md diff --git a/build.gradle b/build.gradle index 8c71cadb6f6..9c22fa88500 100644 --- a/build.gradle +++ b/build.gradle @@ -30,6 +30,8 @@ plugins { id 'idea' id 'org.openrewrite.rewrite' version '6.20.0' + + id "org.itsallcode.openfasttrace" version "3.0.0" } // Enable following for debugging diff --git a/docs/requirements/ai.md b/docs/requirements/ai.md new file mode 100644 index 00000000000..b2288004d9e --- /dev/null +++ b/docs/requirements/ai.md @@ -0,0 +1,12 @@ +--- +parent: Requirements +--- +# AI + +## User Interface + +### Chatting with AI + +`req~ai.chat.new-message-based-on-old-one~1` + +To enable easy editing and resending of previous messages, cursor up should show last message. (If current text field is empty) diff --git a/docs/requirements/index.md b/docs/requirements/index.md new file mode 100644 index 00000000000..715228e56f2 --- /dev/null +++ b/docs/requirements/index.md @@ -0,0 +1,8 @@ +--- +nav_order: 7 +has_children: true +--- +# Requirements + +This part of the documentation collects requirements using [OpenFastTrace](https://github.com/itsallcode/openfasttrace). + From 6e37035979305d23e9c52cc6d66192958c369a74 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Sun, 25 Aug 2024 22:16:56 +0200 Subject: [PATCH 2/5] Initial requirement --- build.gradle | 2 ++ docs/requirements/ai.md | 12 ++++++++++++ docs/requirements/index.md | 8 ++++++++ 3 files changed, 22 insertions(+) create mode 100644 docs/requirements/ai.md create mode 100644 docs/requirements/index.md diff --git a/build.gradle b/build.gradle index fd199a8b667..581682bab13 100644 --- a/build.gradle +++ b/build.gradle @@ -30,6 +30,8 @@ plugins { id 'idea' id 'org.openrewrite.rewrite' version '6.20.0' + + id "org.itsallcode.openfasttrace" version "3.0.0" } // Enable following for debugging diff --git a/docs/requirements/ai.md b/docs/requirements/ai.md new file mode 100644 index 00000000000..b2288004d9e --- /dev/null +++ b/docs/requirements/ai.md @@ -0,0 +1,12 @@ +--- +parent: Requirements +--- +# AI + +## User Interface + +### Chatting with AI + +`req~ai.chat.new-message-based-on-old-one~1` + +To enable easy editing and resending of previous messages, cursor up should show last message. (If current text field is empty) diff --git a/docs/requirements/index.md b/docs/requirements/index.md new file mode 100644 index 00000000000..715228e56f2 --- /dev/null +++ b/docs/requirements/index.md @@ -0,0 +1,8 @@ +--- +nav_order: 7 +has_children: true +--- +# Requirements + +This part of the documentation collects requirements using [OpenFastTrace](https://github.com/itsallcode/openfasttrace). + From f8e8087fc1c681cd5a116337bd38fdd7be8bd52c Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Fri, 6 Sep 2024 17:58:48 +0200 Subject: [PATCH 3/5] Add OpenFastTrace --- .github/workflows/tests.yml | 16 ++++++++ build.gradle | 4 ++ docs/requirements/ai.md | 6 ++- docs/requirements/index.md | 38 +++++++++++++++++++ .../chatprompt/ChatPromptComponent.java | 1 + 5 files changed, 63 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3edf09d599c..b4fd2c565f2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -332,6 +332,22 @@ jobs: env: CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} + requirements_coverage: + name: "Validate requiremenet coverage" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + show-progress: 'false' + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: 21.0.2 + distribution: 'temurin' + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + - run: ./gradlew traceRequirements + # This is https://github.com/marketplace/actions/gradle-wrapper-validation # It ensures that the jar file is from gradle and not by a strange third party. gradlevalidation: diff --git a/build.gradle b/build.gradle index 581682bab13..41da6b0a03d 100644 --- a/build.gradle +++ b/build.gradle @@ -898,3 +898,7 @@ jmh { iterations = 10 fork = 2 } + +requirementTracing { + inputDirectories = files('docs', 'src/main/java', 'src/test/java') +} diff --git a/docs/requirements/ai.md b/docs/requirements/ai.md index b2288004d9e..5d5ea70aaf5 100644 --- a/docs/requirements/ai.md +++ b/docs/requirements/ai.md @@ -6,7 +6,9 @@ parent: Requirements ## User Interface ### Chatting with AI +`req~ai.chat.new-message-based-on-previous~1` -`req~ai.chat.new-message-based-on-old-one~1` +To enable simple editing and resending of previous messages, Cursor Up should show last message. +This should only happen if the current text field is empty. -To enable easy editing and resending of previous messages, cursor up should show last message. (If current text field is empty) +Needs: impl diff --git a/docs/requirements/index.md b/docs/requirements/index.md index 715228e56f2..dca29f2e655 100644 --- a/docs/requirements/index.md +++ b/docs/requirements/index.md @@ -6,3 +6,41 @@ has_children: true This part of the documentation collects requirements using [OpenFastTrace](https://github.com/itsallcode/openfasttrace). +## Specifying requirements + +One writes directly below a Markdown heading a requirement identifier. + +Example: + +```markdown +### Example +`req~ai.example~1` +``` + +It is important that there is no empty line directly after the heading. + +## Linking implementations + +Then, one writes down at the requirement. +Directly at the end, one writes that it requires an implementation: + +```markdown +Needs: impl +``` + +One can also state that there should be detailed design document (`dsn`). +However, typically in JabRef, we go from the requirement directly to the implementation. + +Then, at the implementation, a comment is added this implementation is covered: + +```java +// [impl->req~ai.example~1] +``` + +When executing the gradle task `traceRequirements`, `build/tracing.txt` is generated. +In case of a tracing error, one can inspect this file to see which requirements were not covered. + +## More Information + +- [User manual of OpenFastTrace](https://github.com/itsallcode/openfasttrace/blob/main/doc/user_guide.md) +- We cannot copy and paste real examples here, because of [openfasttrace#280](https://github.com/itsallcode/openfasttrace/issues/280). diff --git a/src/main/java/org/jabref/gui/ai/components/aichat/chatprompt/ChatPromptComponent.java b/src/main/java/org/jabref/gui/ai/components/aichat/chatprompt/ChatPromptComponent.java index d89fbb6be05..8bb590103ac 100644 --- a/src/main/java/org/jabref/gui/ai/components/aichat/chatprompt/ChatPromptComponent.java +++ b/src/main/java/org/jabref/gui/ai/components/aichat/chatprompt/ChatPromptComponent.java @@ -88,6 +88,7 @@ private void initialize() { // will be true (this is important). } } else if (keyEvent.getCode() == KeyCode.UP) { + // [impl->req~ai.chat.new-message-based-on-previous~1] if ((currentUserMessageScroll.get() < history.get().size() - 1) && (userPromptTextArea.getText().isEmpty() || showingHistoryMessage.get())) { // 1. We should not go up the maximum number of user messages. // 2. We can scroll history only on two conditions: From 8a92bd26097f3e8489467402d62d0f4377213b4f Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Sat, 7 Sep 2024 09:33:51 +0200 Subject: [PATCH 4/5] Fix linting --- docs/contributing.md | 4 ++++ docs/requirements/ai.md | 2 ++ docs/requirements/index.md | 3 +++ 3 files changed, 9 insertions(+) diff --git a/docs/contributing.md b/docs/contributing.md index 0e64dfe09b0..f8da4579482 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -112,3 +112,7 @@ If you want to indicate that a pull request is not yet complete **before** creat For improving developer's documentation, go on at the [docs/ subdirectory of JabRef's code](https://github.com/JabRef/jabref/tree/main/docs) and edit the file. GitHub offers a good guide at [Editing files in another user's repository](https://help.github.com/en/github/managing-files-in-a-repository/editing-files-in-another-users-repository). + +One can also add [callouts](https://just-the-docs.github.io/just-the-docs-tests/components/callouts/). + + diff --git a/docs/requirements/ai.md b/docs/requirements/ai.md index 5d5ea70aaf5..dfe6be9f004 100644 --- a/docs/requirements/ai.md +++ b/docs/requirements/ai.md @@ -12,3 +12,5 @@ To enable simple editing and resending of previous messages, Cursor Up diff --git a/docs/requirements/index.md b/docs/requirements/index.md index dca29f2e655..bee1af1c590 100644 --- a/docs/requirements/index.md +++ b/docs/requirements/index.md @@ -19,6 +19,9 @@ Example: It is important that there is no empty line directly after the heading. +{: note} +One needs to add `` to the end of the file, because the id of the requirement needs to follow the heading directly. + ## Linking implementations Then, one writes down at the requirement. From 408c9d2c61437c41b1e6c1aad6a75e867c0a2ea0 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Sat, 7 Sep 2024 09:38:28 +0200 Subject: [PATCH 5/5] Remove wrong disable rule --- docs/contributing.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/contributing.md b/docs/contributing.md index f8da4579482..d827129b175 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -114,5 +114,3 @@ For improving developer's documentation, go on at the [docs/ subdirectory of Jab GitHub offers a good guide at [Editing files in another user's repository](https://help.github.com/en/github/managing-files-in-a-repository/editing-files-in-another-users-repository). One can also add [callouts](https://just-the-docs.github.io/just-the-docs-tests/components/callouts/). - -