-
Notifications
You must be signed in to change notification settings - Fork 34
feature/524_add-version-to-help-text #525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
2c0d450
f40e5f7
642fa0f
411fc75
a2ee114
5c42b72
fb5aa6d
feb5369
009e950
e7d120d
648c847
fda1fd9
b19a715
44947b6
1359bc8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,134 @@ | ||
| # OpenFastTrace (OFT) Skill | ||
|
|
||
| OpenFastTrace is a tool for requirement tracing across various artifacts (specifications, code, tests). | ||
|
|
||
| ## Core Concepts | ||
|
|
||
| - **Specification Items**: Normative pieces of specification or coverage markers. | ||
| - **Artifact Types**: Dynamic and not hard-coded. New types exist automatically when used in a document. | ||
| - Common: `feat`, `req`, `arch`, `dsn`, `impl`, `utest`, `itest`, `stest`, `uman`, `oman`. | ||
| - **ID Syntax**: `type~name~revision` (e.g., `req~login-feature~1`). | ||
| - `name`: Hierarchical with dots (e.g., `ui.button.save`). | ||
| - `revision`: Integer used for versioning. | ||
| - Incrementing the revision breaks all incoming links (coverage and dependencies). | ||
| - This forces covering items to be updated and re-verified. | ||
| - **Keywords**: | ||
| - `Covers: <ID>`: Current item implements/details the target ID. | ||
| - `Needs: <types>`: Artifact types required to cover this item. | ||
| - `Status: <status>`: `draft`, `proposed`, `approved`. | ||
| - `Depends: <IDs>`: Defines dependencies (no effect on coverage). | ||
| - `Description: <text>`: Optional keyword to start description. | ||
| - `Rationale: <text>`, `Comment: <text>`. | ||
|
|
||
| ## Syntax (Markdown) | ||
|
|
||
| ```markdown | ||
| ### Title | ||
| `req~id~1` | ||
| Description of the requirement. | ||
|
|
||
| Rationale: Why this is needed. | ||
|
|
||
| Covers: feat~parent~1 | ||
|
|
||
| Needs: dsn, impl, utest | ||
| ``` | ||
|
|
||
| - **Forwarding**: `arch --> dsn : req~id~1` (delegates coverage without repeating). | ||
| - **Exclusion**: Use `<!-- oft:off -->` and `<!-- oft:on -->` to skip parsing. | ||
|
|
||
| ## Tracing | ||
|
|
||
| Tracing can be performed via CLI, Maven, or Gradle. | ||
|
|
||
| ### CLI Usage | ||
|
|
||
| General form: `oft <command> [options] <files/dirs>` | ||
|
|
||
| - **Commands**: `trace` (generate report), `convert` (export format), `help` (usage and version). | ||
| - **Options for `convert` and `trace`**: | ||
| - `-o, --output-format`: `plain`, `html`, `aspec` (XML). | ||
| - `-f, --output-file`: File path (default STDOUT). | ||
| - `-a, --wanted-artifact-types`: Filter by type (Partial Tracing). | ||
| - `-t, --wanted-tags`: Filter by tags (Partial Tracing). Use `_` for items without tags (e.g., `-t _,MyTag`). | ||
| - `-v, --report-verbosity`: `quiet`, `minimal`, `summary`, `failures`, `failure_summaries`, `failure_details` (default), `all`. | ||
| - `-i, --ignore-artifact-types`: Exclude types from import. | ||
|
|
||
| ### Maven Integration | ||
|
|
||
| - **User Guide**: [openfasttrace-maven-plugin](https://github.com/itsallcode/openfasttrace-maven-plugin) | ||
|
|
||
| Add the `openfasttrace-maven-plugin` to your `pom.xml`: | ||
|
|
||
| ```xml | ||
| <plugin> | ||
| <groupId>org.itsallcode.openfasttrace</groupId> | ||
| <artifactId>openfasttrace-maven-plugin</artifactId> | ||
| <version>VERSION</version> | ||
| <executions> | ||
| <execution> | ||
| <goals><goal>trace</goal></goals> | ||
| </execution> | ||
| </executions> | ||
| <configuration> | ||
| <reportFormat>html</reportFormat> | ||
| <reportFile>target/site/tracing.html</reportFile> | ||
| </configuration> | ||
| </plugin> | ||
| ``` | ||
|
|
||
| - **Run**: `mvn openfasttrace:trace` | ||
|
|
||
| ### Gradle Integration | ||
|
|
||
| - **User Guide**: [openfasttrace-gradle](https://github.com/itsallcode/openfasttrace-gradle) | ||
|
|
||
| Apply the plugin in `build.gradle`: | ||
|
|
||
| ```gradle | ||
| plugins { | ||
| id "org.itsallcode.openfasttrace" version "VERSION" | ||
| } | ||
|
|
||
| openfasttrace { | ||
| reportFormat = "html" | ||
| } | ||
| ``` | ||
|
|
||
| - **Run**: `gradle trace` | ||
|
|
||
| ### Partial Tracing & Filtering | ||
|
|
||
| Partial tracing allows teams to focus on specific layers of the traceability chain, reducing noise and build time. | ||
|
|
||
| **Example Scenario:** | ||
| - **Product Owner (PO)**: Writes system requirements (`req`). Traces `feat` → `req` to ensure all features are specified. | ||
| - **Architect**: Writes design specifications (`dsn`). Traces `feat` + `req` → `dsn` to ensure requirements are architecturally covered. | ||
| - **Developer**: Writes implementation (`impl`) and tests (`utest`). Traces `feat`+ … + `dsn` → `impl`, `utest` to verify complete implementation and testing of the design. | ||
|
|
||
| ```text | ||
| [PO] --(feat)--> [req] | ||
| | | ||
| [Architect] -------+--(feat, req)--> [dsn] | ||
| | | ||
| [Developer] ---------------------------+--(feat, ..., dsn)--> [impl], [utest] | ||
| ``` | ||
|
|
||
| **Usage:** | ||
| - Filter by artifact types: `oft trace -a req,dsn <dir>` | ||
| - Filter by tags: `oft trace -t MyTag <dir>` | ||
| - Combine filters to focus on specific components or requirement levels. | ||
|
|
||
| ## LLM Interaction Guidelines | ||
|
|
||
| - When identifying coverage, look for `impl~<ID>`, `utest~<ID>`, `itest~<ID>` and `stest~<ID>` in comments. | ||
| - Place markers at the narrowest possible scope (method/class). | ||
| - Ensure ID consistency across specifications and code. | ||
| - **Semantic Changes**: Increment the revision when the meaning of a requirement changes. This enforces a check of all covering items as their links become invalid. | ||
| - Verify changes by running tracing. | ||
|
|
||
| ## Exit Codes | ||
|
|
||
| - `0`: Success. | ||
| - `1`: OFT error. | ||
| - `2`: Command line error. |
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -13,6 +13,24 @@ | |||||||||||||||
| <properties> | ||||||||||||||||
| <project.build.outputTimestamp>${reproducible.build.timestamp}</project.build.outputTimestamp> | ||||||||||||||||
| </properties> | ||||||||||||||||
| <build> | ||||||||||||||||
| <resources> | ||||||||||||||||
| <resource> | ||||||||||||||||
| <directory>src/main/resources</directory> | ||||||||||||||||
| <filtering>true</filtering> | ||||||||||||||||
| <includes> | ||||||||||||||||
| <include>version.properties</include> | ||||||||||||||||
| </includes> | ||||||||||||||||
| </resource> | ||||||||||||||||
| <resource> | ||||||||||||||||
| <directory>src/main/resources</directory> | ||||||||||||||||
| <filtering>false</filtering> | ||||||||||||||||
| <excludes> | ||||||||||||||||
| <exclude>version.properties</exclude> | ||||||||||||||||
| </excludes> | ||||||||||||||||
| </resource> | ||||||||||||||||
|
Comment on lines
+25
to
+31
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is the file included and excluded?
Suggested change
|
||||||||||||||||
| </resources> | ||||||||||||||||
| </build> | ||||||||||||||||
| <dependencies> | ||||||||||||||||
| <dependency> | ||||||||||||||||
| <groupId>org.itsallcode.openfasttrace</groupId> | ||||||||||||||||
|
|
||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| package org.itsallcode.openfasttrace.core; | ||
|
|
||
| import java.io.IOException; | ||
| import java.io.InputStream; | ||
| import java.net.URL; | ||
| import java.util.Properties; | ||
| import java.util.logging.Logger; | ||
|
|
||
| /** | ||
| * Provides the version of OpenFastTrace from a resource file generated during | ||
| * build. | ||
| */ | ||
| public class VersionProvider | ||
| { | ||
| private static final Logger LOGGER = Logger.getLogger(VersionProvider.class.getName()); | ||
| private static final String VERSION_PROPERTIES = "/version.properties"; | ||
| private static final String UNKNOWN_VERSION = "unknown"; | ||
|
|
||
| /** | ||
| * Create a new instance of the {@link VersionProvider}. | ||
| */ | ||
| public VersionProvider() | ||
| { | ||
| // Default constructor | ||
| } | ||
|
|
||
| /** | ||
| * Loads the version number from the version.properties resource. | ||
| * | ||
| * @return the version string or "unknown" if it cannot be loaded. | ||
| */ | ||
| // [impl->dsn~cli.version~1] | ||
| public String getVersion() | ||
| { | ||
| final URL resource = getClass().getResource(VERSION_PROPERTIES); | ||
| if (resource == null) | ||
| { | ||
| return UNKNOWN_VERSION; | ||
| } | ||
| try (InputStream stream = resource.openStream()) | ||
| { | ||
| final Properties properties = new Properties(); | ||
| properties.load(stream); | ||
| return properties.getProperty("version", UNKNOWN_VERSION); | ||
| } | ||
| catch (final IOException exception) | ||
| { | ||
| LOGGER.warning("Error loading version from resource file: " + exception.getMessage()); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also log stack trace?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think that is necessary in this case. It's a static resource anyway. Not much that can go wrong. |
||
| return UNKNOWN_VERSION; | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,4 +1,4 @@ | ||||||
| OpenFastTrace | ||||||
| OpenFastTrace ${version} | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Avoid confusion in case the version is |
||||||
|
|
||||||
| Usage: | ||||||
| oft command [option ...] [<input file or directory> ...] | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| version=${revision} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| package org.itsallcode.openfasttrace.core; | ||
|
|
||
| import static org.hamcrest.MatcherAssert.assertThat; | ||
| import static org.hamcrest.Matchers.is; | ||
| import static org.hamcrest.Matchers.not; | ||
| import static org.junit.jupiter.api.Assertions.assertAll; | ||
|
|
||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| /** | ||
| * Integration test for {@link VersionProvider}. | ||
| * <p> | ||
| * Testing the bad weather cases requires using a custom classloader. But that | ||
| * makes the test coverage invisible. So we only test the happy path. The tests | ||
| * for the bad weather cases are too involved for testing a problem that is | ||
| * unlikely to occur with a static resource. | ||
|
redcatbear marked this conversation as resolved.
|
||
| * </p> | ||
| */ | ||
| class VersionProviderIT | ||
| { | ||
| // [itest->dsn~cli.version~1] | ||
| @Test | ||
| void testLoadVersionFromProperties() | ||
| { | ||
| final String version = new VersionProvider().getVersion(); | ||
| assertAll(() -> assertThat(version, is(not("unknown"))), | ||
| () -> assertThat(version, is(not("${version}")))); | ||
|
Comment on lines
+26
to
+27
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make the |
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -932,6 +932,28 @@ Needs: impl, itest | |
|
|
||
| ### Common | ||
|
|
||
| #### CLI Help | ||
| `dsn~cli.help~1` | ||
|
|
||
| The CLI provides a help command and flags (`help`, `-h`, `--help`) that display a short help text. | ||
|
|
||
| Covers: | ||
|
|
||
| * [`req~cli.help~1`](system_requirements.md#cli-help) | ||
|
|
||
| Needs: impl, itest | ||
|
|
||
| #### CLI Version | ||
| `dsn~cli.version~1` | ||
|
|
||
| The CLI provides the current version of OpenFastTrace read from the resource file `version.properties`. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reading from a resource file is an implementation detail. If you want to be so specific, please also describe how the version gets into this file ;) |
||
|
|
||
| Covers: | ||
|
|
||
| * [`req~cli.version~1`](system_requirements.md#cli-version) | ||
|
|
||
| Needs: impl, itest | ||
|
|
||
| #### Input File Selection | ||
| `dsn~cli.input-file-selection~1` | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.