Initial commit
This commit is contained in:
29 files changed
+2780
No files matched your search
@@ -0,0 +1,28 @@
|
|||||||
|
BasedOnStyle: LLVM
|
||||||
|
IndentWidth: 4
|
||||||
|
TabWidth: 4
|
||||||
|
UseTab: Never
|
||||||
|
ColumnLimit: 120
|
||||||
|
Language: Cpp
|
||||||
|
Standard: c++20
|
||||||
|
PointerAlignment: Left
|
||||||
|
ReferenceAlignment: Left
|
||||||
|
SortIncludes: true
|
||||||
|
IncludeBlocks: Regroup
|
||||||
|
BreakBeforeBraces: Custom
|
||||||
|
BraceWrapping:
|
||||||
|
AfterClass: true
|
||||||
|
AfterControlStatement: true
|
||||||
|
AfterFunction: true
|
||||||
|
AfterNamespace: true
|
||||||
|
AfterStruct: true
|
||||||
|
BeforeCatch: true
|
||||||
|
BeforeElse: true
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: Empty
|
||||||
|
NamespaceIndentation: None
|
||||||
|
IndentCaseLabels: true
|
||||||
|
AlignTrailingComments: true
|
||||||
|
SeparateDefinitionBlocks: Always
|
||||||
|
SpaceBeforeParens: ControlStatements
|
||||||
|
Cpp11BracedListStyle: true
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
tmp/
|
||||||
|
settings.local.json
|
||||||
|
metadata/
|
||||||
|
logs/
|
||||||
|
redactors/local/
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"enabled": true,
|
||||||
|
"telemetry": true,
|
||||||
|
"checkpoints": {
|
||||||
|
"primary": {
|
||||||
|
"type": "git-branch"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
export STRIX_LLM="qwen3.5-397b-a17b"
|
||||||
|
export SCW_SECRET_KEY="REPLACE_WITH_YOURS"
|
||||||
|
|
||||||
|
export COPILOT_PROVIDER_TYPE="openai"
|
||||||
|
export COPILOT_PROVIDER_API_KEY="${SCW_SECRET_KEY}"
|
||||||
|
export COPILOT_PROVIDER_BASE_URL="https://api.scaleway.ai/v1"
|
||||||
|
export COPILOT_MODEL="${STRIX_LLM}"
|
||||||
|
|
||||||
|
export COPILOT_PROVIDER_MAX_PROMPT_TOKENS="32768"
|
||||||
|
export COPILOT_PROVIDER_MAX_OUTPUT_TOKENS="8192"
|
||||||
|
|
||||||
|
export ENTIRE_TOKEN_STORE=file
|
||||||
|
export ENTIRE_TOKEN_STORE_PATH=$HOME/.config/entire/tokens.json
|
||||||
|
export ACCESSIBLE=1
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
# GitHub Copilot Repository Instructions: C++23 Modernization
|
||||||
|
|
||||||
|
## Context
|
||||||
|
- Language: C++
|
||||||
|
- Target standard: C++23
|
||||||
|
- Goal: modernize legacy C++11/14/17 code safely and incrementally
|
||||||
|
|
||||||
|
## Primary Rule
|
||||||
|
Preserve existing behavior unless functional changes are explicitly requested.
|
||||||
|
|
||||||
|
## Balanced Modernization Policy
|
||||||
|
- Prefer modern C++23 constructs when they clearly improve safety, readability, or maintainability.
|
||||||
|
- Keep refactors focused and reviewable; avoid broad rewrites unless requested.
|
||||||
|
- Prefer standard library solutions over custom or legacy patterns.
|
||||||
|
- Respect toolchain limitations, ABI-sensitive interfaces, and repository-local style.
|
||||||
|
|
||||||
|
## Preferred Modernizations
|
||||||
|
- Use `auto` where the type is obvious from the initializer; avoid it when it hides important type information.
|
||||||
|
- Prefer structured bindings over `std::tie` or manual pair/tuple access when clearer.
|
||||||
|
- Replace raw owning pointers and manual `delete` with RAII, usually `std::unique_ptr`.
|
||||||
|
- Use `std::make_unique` and `std::make_shared`; prefer `std::shared_ptr` only for real shared ownership.
|
||||||
|
- Use `std::string_view` for read-only string parameters only when lifetime safety is clear.
|
||||||
|
- Prefer `std::span` for non-owning contiguous ranges.
|
||||||
|
- Use `std::mdspan` only when multidimensional access is central and the change improves clarity or safety.
|
||||||
|
- Prefer `.contains()` over `find(...) != end()` where available and clearer.
|
||||||
|
- Prefer standard algorithms and ranges over manual loops when readability improves.
|
||||||
|
- Use `[[nodiscard]]` where ignoring the result is likely a bug.
|
||||||
|
- Prefer early returns over deeply nested control flow.
|
||||||
|
- Use `std::optional` monadic operations (`and_then`, `transform`, `or_else`) when they make the code simpler.
|
||||||
|
- Prefer `constexpr`, `if constexpr`, concepts, and `requires` over legacy `std::enable_if` / SFINAE where practical.
|
||||||
|
- Add `noexcept`, `override`, `final`, `= default`, and `= delete` where correct and useful.
|
||||||
|
- Prefer `enum class` over unscoped enums where practical.
|
||||||
|
- Prefer `std::print` / `std::println` for console output when supported by the project toolchain.
|
||||||
|
- Prefer typed `std::chrono` durations and `std::jthread` where appropriate.
|
||||||
|
|
||||||
|
## Avoid
|
||||||
|
- Do not modernize mechanically if readability becomes worse.
|
||||||
|
- Do not introduce unsupported C++23 features.
|
||||||
|
- Do not introduce dangling references, dangling `std::string_view`, or unclear ownership.
|
||||||
|
- Do not silently change ABI, object lifetime, exception behavior, or performance characteristics.
|
||||||
|
- Do not rewrite unrelated code.
|
||||||
|
|
||||||
|
## Expected Copilot Behavior
|
||||||
|
When making migration suggestions:
|
||||||
|
- produce small, focused updates
|
||||||
|
- explain non-trivial changes briefly
|
||||||
|
- call out risky refactors explicitly
|
||||||
|
- note compatibility or toolchain caveats
|
||||||
|
- leave optional follow-up improvements separate
|
||||||
|
|
||||||
|
## Preferred Output
|
||||||
|
Provide:
|
||||||
|
- updated code
|
||||||
|
- short rationale
|
||||||
|
- compatibility/toolchain caveats
|
||||||
|
- optional next modernization steps
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
{
|
||||||
|
"hooks": {
|
||||||
|
"agentStop": [
|
||||||
|
{
|
||||||
|
"type": "command",
|
||||||
|
"bash": "sh -c 'if ! command -v entire >/dev/null 2>&1; then exit 0; fi; exec entire hooks copilot-cli agent-stop'",
|
||||||
|
"comment": "Entire CLI"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"errorOccurred": [
|
||||||
|
{
|
||||||
|
"type": "command",
|
||||||
|
"bash": "sh -c 'if ! command -v entire >/dev/null 2>&1; then exit 0; fi; exec entire hooks copilot-cli error-occurred'",
|
||||||
|
"comment": "Entire CLI"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"postToolUse": [
|
||||||
|
{
|
||||||
|
"type": "command",
|
||||||
|
"bash": "sh -c 'if ! command -v entire >/dev/null 2>&1; then exit 0; fi; exec entire hooks copilot-cli post-tool-use'",
|
||||||
|
"comment": "Entire CLI"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"preToolUse": [
|
||||||
|
{
|
||||||
|
"type": "command",
|
||||||
|
"bash": "sh -c 'if ! command -v entire >/dev/null 2>&1; then exit 0; fi; exec entire hooks copilot-cli pre-tool-use'",
|
||||||
|
"comment": "Entire CLI"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sessionEnd": [
|
||||||
|
{
|
||||||
|
"type": "command",
|
||||||
|
"bash": "sh -c 'if ! command -v entire >/dev/null 2>&1; then exit 0; fi; exec entire hooks copilot-cli session-end'",
|
||||||
|
"comment": "Entire CLI"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sessionStart": [
|
||||||
|
{
|
||||||
|
"type": "command",
|
||||||
|
"bash": "sh -c 'if ! command -v entire >/dev/null 2>&1; then exit 0; fi; exec entire hooks copilot-cli session-start'",
|
||||||
|
"comment": "Entire CLI"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"subagentStop": [
|
||||||
|
{
|
||||||
|
"type": "command",
|
||||||
|
"bash": "sh -c 'if ! command -v entire >/dev/null 2>&1; then exit 0; fi; exec entire hooks copilot-cli subagent-stop'",
|
||||||
|
"comment": "Entire CLI"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"userPromptSubmitted": [
|
||||||
|
{
|
||||||
|
"type": "command",
|
||||||
|
"bash": "sh -c 'if ! command -v entire >/dev/null 2>&1; then exit 0; fi; exec entire hooks copilot-cli user-prompt-submitted'",
|
||||||
|
"comment": "Entire CLI"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"version": 1
|
||||||
|
}
|
||||||
@@ -0,0 +1,157 @@
|
|||||||
|
# GitHub Copilot Instructions: Qt5/C++11 to Qt6/C++23 Migration
|
||||||
|
|
||||||
|
## Mission
|
||||||
|
Migrate the legacy Qt5/C++11 desktop application to Qt6/C++23, preserve behavior unless change is strictly required, and validate the result completely in the repository’s Docker-based CI workflow.
|
||||||
|
|
||||||
|
## Operating Mode
|
||||||
|
- Work autonomously from analysis through validation.
|
||||||
|
- Do not stop after editing code.
|
||||||
|
- Continue until configure, build, tests, and policy checks have been attempted in Docker.
|
||||||
|
- Do not ask for confirmation during normal implementation.
|
||||||
|
- Stop early only if required source material is missing, the task is impossible, or a destructive action would be required.
|
||||||
|
|
||||||
|
## Boundaries
|
||||||
|
- Read the legacy project from `${PROJECT_DIR}`.
|
||||||
|
- Write the migrated project to `qt6-after/qt6-migrated-benchmark`.
|
||||||
|
- Do not modify the legacy source tree in place.
|
||||||
|
- Limit changes to the target tree and only the CI/build/test files needed to support migration and validation.
|
||||||
|
|
||||||
|
## Main Migration Targets
|
||||||
|
- Upgrade Qt5 to Qt6.
|
||||||
|
- Upgrade C++11/14/17 code to C++23.
|
||||||
|
- Keep Qt Core, Gui, and Widgets explicitly linked.
|
||||||
|
- Replace `QRegExp` with `QRegularExpression`.
|
||||||
|
- Replace `QDesktopWidget` and `QApplication::desktop()` with `QScreen`-based Qt6 APIs.
|
||||||
|
- Remove legacy `QTextCodec` usage and adopt Qt6-safe text handling.
|
||||||
|
- Replace old `SIGNAL`/`SLOT` syntax with function-pointer connect syntax.
|
||||||
|
- Replace `0`/`NULL` pointer literals with `nullptr`.
|
||||||
|
- Preserve `.ui` and `.qrc` integration.
|
||||||
|
- Preserve behavior unless Qt6 compatibility requires adaptation.
|
||||||
|
|
||||||
|
## C++23 Modernization Rules
|
||||||
|
- Preserve semantics first; modernize second.
|
||||||
|
- Use `auto` when the type is obvious; avoid it when it hides important type information.
|
||||||
|
- Prefer structured bindings where clearer.
|
||||||
|
- Replace raw owning pointers/manual `delete` with RAII, usually `std::unique_ptr`.
|
||||||
|
- Use `std::make_unique` / `std::make_shared`; use `std::shared_ptr` only for real shared ownership.
|
||||||
|
- Use `std::string_view` only when lifetime safety is clear.
|
||||||
|
- Prefer `std::span` for non-owning contiguous data; use `std::mdspan` only when multidimensional access clearly benefits.
|
||||||
|
- Prefer `.contains()` over `find(...) != end()` where available.
|
||||||
|
- Prefer algorithms and ranges over manual loops when readability improves.
|
||||||
|
- Use `[[nodiscard]]` when ignoring a result is likely a bug.
|
||||||
|
- Prefer early returns over deeply nested control flow.
|
||||||
|
- Use `std::optional` monadic operations (`and_then`, `transform`, `or_else`) when clearer.
|
||||||
|
- Prefer `constexpr`, `if constexpr`, concepts, and `requires` over legacy `std::enable_if`/SFINAE where practical.
|
||||||
|
- Add `noexcept`, `override`, `final`, `= default`, and `= delete` where correct and useful.
|
||||||
|
- Prefer `enum class` over unscoped enums where practical.
|
||||||
|
- Prefer `std::print` / `std::println` when supported by the toolchain.
|
||||||
|
- Prefer typed `std::chrono` durations and `std::jthread` where appropriate.
|
||||||
|
|
||||||
|
## Safety Rules
|
||||||
|
- Do not change business logic unless explicitly requested or required for Qt6 compatibility.
|
||||||
|
- Do not introduce unsupported Qt6/C++23 features.
|
||||||
|
- Do not silently change ABI, ownership, lifetime, exception behavior, performance, UI behavior, or event ordering.
|
||||||
|
- Do not worsen readability for the sake of modernization.
|
||||||
|
- Avoid dangling references, dangling `std::string_view`, and ownership ambiguity.
|
||||||
|
- Keep includes minimal and preserve repository-local formatting/style.
|
||||||
|
|
||||||
|
## Tests
|
||||||
|
- For every code change inside a method, add at least three tests covering the changed behavior.
|
||||||
|
- Place generated tests in `qt6-after/qt6-migrated-benchmark/tests`.
|
||||||
|
- Use policy-compatible test filenames such as:
|
||||||
|
- `test_<name>.cpp`
|
||||||
|
- `<name>_test.cpp`
|
||||||
|
- `<name>test.cpp`
|
||||||
|
- `<name>gtest.cpp`
|
||||||
|
- Update CMake so the migrated app and all tests build and run with CTest.
|
||||||
|
- Ensure all tests are registered with CTest.
|
||||||
|
|
||||||
|
## Docker-First Validation
|
||||||
|
Use `lifemaps/ci-cpp:latest` as the authoritative environment. Do not substitute host tools for missing container tools. Treat `ci/Dockerfile.ci` as the source of truth for CI dependencies.
|
||||||
|
|
||||||
|
### Required validation sequence
|
||||||
|
1. Configure in Docker
|
||||||
|
2. Build in Docker
|
||||||
|
3. Run tests in Docker
|
||||||
|
4. If tests pass, run `python3 ci/check_pr_policies.py` in Docker
|
||||||
|
|
||||||
|
### Recommended commands
|
||||||
|
- Configure:
|
||||||
|
`cmake -S qt6-after/qt6-migrated-benchmark -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug`
|
||||||
|
- Build:
|
||||||
|
`cmake --build build --parallel`
|
||||||
|
- Test:
|
||||||
|
`ctest --test-dir build --output-on-failure`
|
||||||
|
- Policy:
|
||||||
|
`python3 ci/check_pr_policies.py`
|
||||||
|
|
||||||
|
Adapt paths/flags only if repository inspection proves they must differ.
|
||||||
|
|
||||||
|
## Missing-Tool Remediation
|
||||||
|
If Docker validation fails because a required tool/package is missing:
|
||||||
|
- identify the exact missing dependency
|
||||||
|
- update `Dockerfile.ci` minimally
|
||||||
|
- rebuild `lifemaps/ci-cpp:latest`
|
||||||
|
- rerun the full validation sequence
|
||||||
|
|
||||||
|
Continue until:
|
||||||
|
- validation succeeds, or
|
||||||
|
- the next blocker is a genuine project/code issue
|
||||||
|
|
||||||
|
## Failure Classification
|
||||||
|
Environment failures:
|
||||||
|
- command not found
|
||||||
|
- missing compiler/toolchain utility
|
||||||
|
- missing Qt dev package
|
||||||
|
- missing CMake/Ninja/CTest support tool
|
||||||
|
- missing dependency required by `ci/check_pr_policies.py`
|
||||||
|
|
||||||
|
Project failures:
|
||||||
|
- compile errors
|
||||||
|
- linker errors
|
||||||
|
- failing tests
|
||||||
|
- formatting/policy failures caused by migration changes
|
||||||
|
|
||||||
|
## Policy Awareness
|
||||||
|
- `ci/check_pr_policies.py` checks formatting for changed C/C++ files, expects related tests, and verifies commit-signature conditions in its diff range.
|
||||||
|
- Ensure Docker validation runs with mounted workspace and git metadata available.
|
||||||
|
- Do not claim success unless the policy script passes.
|
||||||
|
|
||||||
|
## Execution Plan
|
||||||
|
1. Inspect `${PROJECT_DIR}` and the target tree.
|
||||||
|
2. Identify Qt5 and legacy C++ constructs to migrate.
|
||||||
|
3. Migrate incrementally in `qt6-after/qt6-migrated-benchmark`.
|
||||||
|
4. Add/update tests with each behavior-relevant change.
|
||||||
|
5. Update CMake/test registration.
|
||||||
|
6. Validate in Docker.
|
||||||
|
7. If missing dependencies are found, update `Dockerfile.ci`, rebuild, and rerun.
|
||||||
|
8. Repeat until success or a real project defect remains.
|
||||||
|
|
||||||
|
## Reporting
|
||||||
|
Group change explanations by:
|
||||||
|
- CMake / build-system migration
|
||||||
|
- Qt API replacements
|
||||||
|
- C++ modernization
|
||||||
|
- UI/resource preservation
|
||||||
|
- tests added
|
||||||
|
- `Dockerfile.ci` / container updates
|
||||||
|
|
||||||
|
Also provide a concise changed-files summary.
|
||||||
|
|
||||||
|
## Completion Criteria
|
||||||
|
Success requires:
|
||||||
|
- migrated project exists under `qt6-after/qt6-migrated-benchmark`
|
||||||
|
- configure succeeds in Docker
|
||||||
|
- build succeeds in Docker
|
||||||
|
- tests succeed in Docker
|
||||||
|
- `python3 ci/check_pr_policies.py` succeeds in Docker after tests pass
|
||||||
|
|
||||||
|
## Final Response
|
||||||
|
- State whether migration is fully validated or which blocker remains.
|
||||||
|
- List the exact Docker commands used for image rebuild, configure, build, test, and policy check.
|
||||||
|
- For every failed attempt, include:
|
||||||
|
- exact command
|
||||||
|
- key error
|
||||||
|
- environment vs project classification
|
||||||
|
- fix applied
|
||||||
|
- End with a short summary of any remaining blocker.
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
.envrc
|
||||||
|
.*~
|
||||||
|
*~
|
||||||
|
build
|
||||||
Vendored
+90
@@ -0,0 +1,90 @@
|
|||||||
|
pipeline {
|
||||||
|
agent {
|
||||||
|
docker {
|
||||||
|
image 'lifemaps/ci-cpp:latest'
|
||||||
|
reuseNode true
|
||||||
|
args '-u root:root'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
options {
|
||||||
|
timestamps()
|
||||||
|
disableConcurrentBuilds()
|
||||||
|
}
|
||||||
|
|
||||||
|
environment {
|
||||||
|
PROJECT_DIR = "qt6-after/qt6-migrated-benchmark"
|
||||||
|
BUILD_DIR = "build"
|
||||||
|
CHANGE_TARGET = "${env.CHANGE_TARGET ?: 'origin/main'}"
|
||||||
|
QT_QPA_PLATFORM = "offscreen"
|
||||||
|
LANG = "C.UTF-8"
|
||||||
|
LC_ALL = "C.UTF-8"
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('Checkout') {
|
||||||
|
steps {
|
||||||
|
checkout scm
|
||||||
|
sh 'git fetch --all --prune'
|
||||||
|
sh 'git submodule update --init --recursive || true'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Tool Versions') {
|
||||||
|
steps {
|
||||||
|
sh '''
|
||||||
|
python3 --version
|
||||||
|
cmake --version
|
||||||
|
ninja --version
|
||||||
|
g++ --version
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Qt Diagnostics') {
|
||||||
|
steps {
|
||||||
|
sh '''
|
||||||
|
echo "QT_QPA_PLATFORM=$QT_QPA_PLATFORM"
|
||||||
|
echo "LANG=$LANG"
|
||||||
|
echo "LC_ALL=$LC_ALL"
|
||||||
|
dpkg -l | grep -E "qt6-base-dev|qtbase5-dev|qt6-tools" || true
|
||||||
|
pkg-config --list-all | grep -i qt || true
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Policy Checks') {
|
||||||
|
steps {
|
||||||
|
sh 'python3 ci/check_pr_policies.py'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Configure') {
|
||||||
|
steps {
|
||||||
|
sh 'cmake -S ${PROJECT_DIR} -B ${BUILD_DIR} -G Ninja -DCMAKE_BUILD_TYPE=Debug'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Build') {
|
||||||
|
steps {
|
||||||
|
sh 'cmake --build ${BUILD_DIR} --parallel'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Test') {
|
||||||
|
steps {
|
||||||
|
sh 'QT_QPA_PLATFORM=offscreen LANG=C.UTF-8 LC_ALL=C.UTF-8 ctest --test-dir ${BUILD_DIR} --output-on-failure'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
always {
|
||||||
|
script {
|
||||||
|
if (getContext(hudson.FilePath)) {
|
||||||
|
cleanWs deleteDirs: true, disableDeferredWipeout: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2026 lifemaps
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
FROM ubuntu:26.04
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y --no-install-recommends \
|
||||||
|
python3 \
|
||||||
|
clang-format \
|
||||||
|
cmake \
|
||||||
|
ninja-build \
|
||||||
|
git \
|
||||||
|
g++ \
|
||||||
|
make \
|
||||||
|
ca-certificates \
|
||||||
|
openssh-client \
|
||||||
|
pkg-config \
|
||||||
|
qtbase5-dev \
|
||||||
|
qt6-base-dev \
|
||||||
|
qt6-base-dev-tools \
|
||||||
|
qt6-tools-dev \
|
||||||
|
qt6-tools-dev-tools && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Set Qt platform for headless testing
|
||||||
|
ENV QT_QPA_PLATFORM=offscreen
|
||||||
|
|
||||||
|
# Configure git for containerized environments
|
||||||
|
RUN git config --global --add safe.directory "*"
|
||||||
|
|
||||||
|
WORKDIR /workspace
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
torsten.wierschin@life-maps.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO+c+9jJKrLpTk4pLg+p1Qo0CjCYzfKfEhXEu0MAlZpj
|
||||||
|
nkana@outlook.de ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBR68AzU7UtY+NJPIRloEeIlQIZIP3xhvkWB8BediMeQ
|
||||||
@@ -0,0 +1,221 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
ROOT = Path(".").resolve()
|
||||||
|
TEST_DIRS = [
|
||||||
|
ROOT / "tests",
|
||||||
|
ROOT / "test",
|
||||||
|
ROOT / "qt6-after" / "qt6-migrated-benchmark" / "tests",
|
||||||
|
]
|
||||||
|
CPP_EXTENSIONS = {".c", ".cc", ".cpp", ".cxx", ".h", ".hh", ".hpp", ".hxx"}
|
||||||
|
ALLOWED_SIGNERS_FILE = ROOT / "ci" / "allowed_signers"
|
||||||
|
|
||||||
|
TEST_PATTERNS = [
|
||||||
|
"test_{name}.cpp",
|
||||||
|
"test_{name}.h",
|
||||||
|
"{name}_test.cpp",
|
||||||
|
"{name}_test.h",
|
||||||
|
"{name}test.cpp",
|
||||||
|
"{name}test.h",
|
||||||
|
"{name}gtest.cpp",
|
||||||
|
"{name}gtest.h",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def run(cmd: str) -> str:
|
||||||
|
return subprocess.check_output(cmd, shell=True, text=True).strip()
|
||||||
|
|
||||||
|
|
||||||
|
def git_ref_exists(ref: str) -> bool:
|
||||||
|
try:
|
||||||
|
subprocess.check_call(
|
||||||
|
f"git rev-parse --verify --quiet '{ref}'",
|
||||||
|
shell=True,
|
||||||
|
stdout=subprocess.DEVNULL,
|
||||||
|
stderr=subprocess.DEVNULL,
|
||||||
|
)
|
||||||
|
return True
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def is_pull_request_build() -> bool:
|
||||||
|
return bool(os.environ.get("CHANGE_ID"))
|
||||||
|
|
||||||
|
|
||||||
|
def resolve_target_ref() -> str | None:
|
||||||
|
raw = os.environ.get("CHANGE_TARGET", "").strip()
|
||||||
|
|
||||||
|
candidates = []
|
||||||
|
if raw:
|
||||||
|
candidates.append(raw)
|
||||||
|
if not raw.startswith("origin/"):
|
||||||
|
candidates.append(f"origin/{raw}")
|
||||||
|
|
||||||
|
candidates.extend(["origin/main", "main"])
|
||||||
|
|
||||||
|
seen = set()
|
||||||
|
for ref in candidates:
|
||||||
|
if ref and ref not in seen:
|
||||||
|
seen.add(ref)
|
||||||
|
if git_ref_exists(ref):
|
||||||
|
return ref
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def changed_files_and_base() -> tuple[list[str], str]:
|
||||||
|
target = resolve_target_ref()
|
||||||
|
|
||||||
|
if target:
|
||||||
|
print(f"Vergleiche gegen Ziel-Ref: {target}")
|
||||||
|
out = run(f"git diff --name-only {target}...HEAD")
|
||||||
|
files = [line.strip() for line in out.splitlines() if line.strip()]
|
||||||
|
return files, target
|
||||||
|
|
||||||
|
if is_pull_request_build():
|
||||||
|
print("ERROR: Kein gültiger Ziel-Branch-Ref für PR-Build gefunden.")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
if git_ref_exists("HEAD~1"):
|
||||||
|
print("Kein Ziel-Branch-Ref gefunden, verwende HEAD~1 für Branch-Build.")
|
||||||
|
out = run("git diff --name-only HEAD~1..HEAD")
|
||||||
|
files = [line.strip() for line in out.splitlines() if line.strip()]
|
||||||
|
return files, "HEAD~1"
|
||||||
|
|
||||||
|
print("Keine Vergleichsbasis gefunden, behandle alle versionierten Dateien als geändert.")
|
||||||
|
out = run("git ls-files")
|
||||||
|
files = [line.strip() for line in out.splitlines() if line.strip()]
|
||||||
|
return files, ""
|
||||||
|
|
||||||
|
|
||||||
|
def commits_in_range(base: str) -> list[str]:
|
||||||
|
if base:
|
||||||
|
if base == "HEAD~1":
|
||||||
|
out = run("git rev-list HEAD~1..HEAD")
|
||||||
|
else:
|
||||||
|
out = run(f"git rev-list {base}..HEAD")
|
||||||
|
else:
|
||||||
|
out = run("git rev-list HEAD")
|
||||||
|
return [line.strip() for line in out.splitlines() if line.strip()]
|
||||||
|
|
||||||
|
|
||||||
|
def is_cpp_file(path: Path) -> bool:
|
||||||
|
return path.suffix.lower() in CPP_EXTENSIONS
|
||||||
|
|
||||||
|
|
||||||
|
def require_clang_format():
|
||||||
|
if not (ROOT / ".clang-format").exists():
|
||||||
|
print("ERROR: .clang-format fehlt im Repository-Root.")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
def require_allowed_signers():
|
||||||
|
if not ALLOWED_SIGNERS_FILE.exists():
|
||||||
|
print(f"ERROR: {ALLOWED_SIGNERS_FILE} fehlt.")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
def check_format(path: Path):
|
||||||
|
subprocess.check_call(f"clang-format --dry-run --Werror '{path}'", shell=True)
|
||||||
|
|
||||||
|
|
||||||
|
def candidate_names(path: Path):
|
||||||
|
stem = path.stem.lower()
|
||||||
|
names = {stem}
|
||||||
|
for suffix in ["_p", "_impl", "_private", "_priv", "_ui"]:
|
||||||
|
if stem.endswith(suffix):
|
||||||
|
names.add(stem[:-len(suffix)])
|
||||||
|
return sorted(n for n in names if n)
|
||||||
|
|
||||||
|
|
||||||
|
def iter_test_files():
|
||||||
|
for test_dir in TEST_DIRS:
|
||||||
|
if test_dir.exists():
|
||||||
|
yield from (p for p in test_dir.rglob("*") if p.is_file())
|
||||||
|
|
||||||
|
|
||||||
|
def has_related_test(path: Path) -> bool:
|
||||||
|
test_files = list(iter_test_files())
|
||||||
|
if not test_files:
|
||||||
|
return False
|
||||||
|
|
||||||
|
test_names = [p.name.lower() for p in test_files]
|
||||||
|
|
||||||
|
for name in candidate_names(path):
|
||||||
|
for pattern in TEST_PATTERNS:
|
||||||
|
if pattern.format(name=name).lower() in test_names:
|
||||||
|
return True
|
||||||
|
for test_name in test_names:
|
||||||
|
if name in test_name and ("test" in test_name or "gtest" in test_name):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def verify_commit_signature(commit: str):
|
||||||
|
env = os.environ.copy()
|
||||||
|
env["GIT_CONFIG_COUNT"] = "1"
|
||||||
|
env["GIT_CONFIG_KEY_0"] = "gpg.ssh.allowedSignersFile"
|
||||||
|
env["GIT_CONFIG_VALUE_0"] = str(ALLOWED_SIGNERS_FILE)
|
||||||
|
|
||||||
|
subprocess.check_call(
|
||||||
|
f"git verify-commit {commit}",
|
||||||
|
shell=True,
|
||||||
|
env=env,
|
||||||
|
stdout=subprocess.DEVNULL,
|
||||||
|
stderr=subprocess.DEVNULL,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
require_clang_format()
|
||||||
|
require_allowed_signers()
|
||||||
|
|
||||||
|
files, base = changed_files_and_base()
|
||||||
|
if not files:
|
||||||
|
print("Keine geänderten Dateien erkannt.")
|
||||||
|
return
|
||||||
|
|
||||||
|
commits = commits_in_range(base)
|
||||||
|
if not commits:
|
||||||
|
print("Keine neuen Commits im Vergleichsbereich erkannt.")
|
||||||
|
else:
|
||||||
|
for commit in commits:
|
||||||
|
print(f"Prüfe SSH-Signatur: {commit}")
|
||||||
|
try:
|
||||||
|
verify_commit_signature(commit)
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
print(
|
||||||
|
"ERROR: Commit ist nicht gültig mit erlaubtem SSH-Signierer signiert: "
|
||||||
|
f"{commit}"
|
||||||
|
)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
for rel in files:
|
||||||
|
path = ROOT / rel
|
||||||
|
if not path.exists():
|
||||||
|
continue
|
||||||
|
if is_cpp_file(path):
|
||||||
|
print(f"Prüfe: {rel}")
|
||||||
|
try:
|
||||||
|
check_format(path)
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
print(f"ERROR: Formatfehler in {rel}")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
if not has_related_test(path):
|
||||||
|
print(
|
||||||
|
"ERROR: Kein passender Test unter tests/, test/ oder "
|
||||||
|
"qt6-after/qt6-migrated-benchmark/tests/ gefunden für: "
|
||||||
|
f"{rel}"
|
||||||
|
)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
print("PR-Policy-Prüfungen erfolgreich.")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -0,0 +1,337 @@
|
|||||||
|
# Entwicklerhinweise: Anforderungen bei Push und Pull Request
|
||||||
|
|
||||||
|
Dieses Repository verwendet Jenkins-basierte PR- und Branch-Policies.
|
||||||
|
Ziel ist, dass Code bereits **vor dem Merge** bestimmte Qualitätsanforderungen erfüllt.
|
||||||
|
|
||||||
|
Diese Datei beschreibt, **was bei einem Push erwartet wird**, **was in Jenkins geprüft wird** und **wie du Fehler lokal vermeiden kannst**.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Überblick
|
||||||
|
|
||||||
|
Bei Pushes und Pull Requests werden automatisierte Policies ausgeführt.
|
||||||
|
|
||||||
|
Je nach Build-Typ gelten leicht unterschiedliche Vergleichsregeln:
|
||||||
|
|
||||||
|
- **bei Pull Requests** wird gegen den Zielbranch verglichen, z. B. `origin/main`
|
||||||
|
- **bei normalen Branch-Builds** wird auf eine lokale Vergleichsbasis zurückgefallen, z. B. `HEAD~1`, falls kein Zielbranch-Ref verfügbar ist
|
||||||
|
|
||||||
|
Die eigentlichen Qualitätsanforderungen bleiben gleich.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Was beim Push / PR geprüft wird
|
||||||
|
|
||||||
|
### 1. `.clang-format` muss vorhanden sein
|
||||||
|
Im Repository-Root muss eine Datei `.clang-format` liegen.
|
||||||
|
|
||||||
|
Ohne diese Datei schlägt der Policy-Check fehl.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 2. Geänderte C/C++-Dateien müssen korrekt formatiert sein
|
||||||
|
Für geänderte C/C++-Dateien wird `clang-format` geprüft.
|
||||||
|
|
||||||
|
Betroffen sind insbesondere Dateien mit diesen Endungen:
|
||||||
|
|
||||||
|
- `.c`
|
||||||
|
- `.cc`
|
||||||
|
- `.cpp`
|
||||||
|
- `.cxx`
|
||||||
|
- `.h`
|
||||||
|
- `.hh`
|
||||||
|
- `.hpp`
|
||||||
|
- `.hxx`
|
||||||
|
|
||||||
|
Wenn eine Datei nicht korrekt formatiert ist, schlägt der Build fehl.
|
||||||
|
|
||||||
|
#### Lokal prüfen
|
||||||
|
```bash
|
||||||
|
clang-format --dry-run --Werror <datei>
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Lokal automatisch formatieren
|
||||||
|
```bash
|
||||||
|
clang-format -i <datei>
|
||||||
|
```
|
||||||
|
|
||||||
|
Beispiel:
|
||||||
|
```bash
|
||||||
|
clang-format -i main.cpp tests/test_main.cpp
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 3. Zu geänderten C/C++-Dateien muss ein passender Test existieren
|
||||||
|
Wenn du eine C/C++-Datei änderst, muss ein passender Test vorhanden sein.
|
||||||
|
|
||||||
|
Es wird nach Tests in diesen Verzeichnissen gesucht:
|
||||||
|
|
||||||
|
- `tests/`
|
||||||
|
- `test/`
|
||||||
|
- `qt6-after/qt6-migrated-benchmark/tests/`
|
||||||
|
|
||||||
|
Unterstützte typische Testnamen sind zum Beispiel:
|
||||||
|
|
||||||
|
- `test_<name>.cpp`
|
||||||
|
- `<name>_test.cpp`
|
||||||
|
- `<name>test.cpp`
|
||||||
|
- `<name>gtest.cpp`
|
||||||
|
|
||||||
|
Zusätzlich erkennt die Policy auch ähnliche Dateinamen heuristisch, solange `test` oder `gtest` im Dateinamen vorkommt.
|
||||||
|
|
||||||
|
#### Beispiel
|
||||||
|
Wenn du `main.cpp` änderst, ist z. B. passend:
|
||||||
|
|
||||||
|
```text
|
||||||
|
tests/test_main.cpp
|
||||||
|
```
|
||||||
|
|
||||||
|
Wenn kein passender Test gefunden wird, schlägt der Build fehl.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 4. Nur gültig SSH-signierte Commits sind erlaubt
|
||||||
|
Neue Commits im geprüften Bereich müssen gültig **mit SSH signiert** sein.
|
||||||
|
|
||||||
|
Die Jenkins-Policy prüft Commit-Signaturen gegen eine erlaubte Signiererdatei:
|
||||||
|
|
||||||
|
```text
|
||||||
|
ci/allowed_signers
|
||||||
|
```
|
||||||
|
|
||||||
|
Wenn ein Commit:
|
||||||
|
|
||||||
|
- nicht signiert ist
|
||||||
|
- nicht per SSH signiert ist
|
||||||
|
- mit einem nicht erlaubten SSH-Schlüssel signiert ist
|
||||||
|
|
||||||
|
dann schlägt der Build fehl.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## SSH-signierte Commits einrichten
|
||||||
|
|
||||||
|
### 1. SSH-Signing-Key erzeugen
|
||||||
|
Falls du noch keinen dedizierten Signing-Key hast:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519_signing -C "dein.name@example.com"
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 2. Git für SSH-Signing konfigurieren
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git config --global gpg.format ssh
|
||||||
|
git config --global user.signingkey ~/.ssh/id_ed25519_signing.pub
|
||||||
|
git config --global commit.gpgsign true
|
||||||
|
```
|
||||||
|
|
||||||
|
Damit werden neue Commits automatisch mit deinem SSH-Key signiert.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 3. Öffentlichen Schlüssel zur Allowlist hinzufügen
|
||||||
|
Dein öffentlicher Schlüssel muss in `ci/allowed_signers` eingetragen sein.
|
||||||
|
|
||||||
|
Format:
|
||||||
|
|
||||||
|
```text
|
||||||
|
<principal> <public-key>
|
||||||
|
```
|
||||||
|
|
||||||
|
Beispiel:
|
||||||
|
|
||||||
|
```text
|
||||||
|
max.mustermann@example.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA...
|
||||||
|
```
|
||||||
|
|
||||||
|
Ohne Eintrag in `ci/allowed_signers` wird dein signierter Commit in Jenkins trotzdem abgelehnt.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 4. Optional: lokale Verifikation aktivieren
|
||||||
|
Wenn du lokal dieselbe Vertrauenskette wie Jenkins verwenden willst:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdir -p ~/.config/git
|
||||||
|
cp ci/allowed_signers ~/.config/git/allowed_signers
|
||||||
|
git config --global gpg.ssh.allowedSignersFile ~/.config/git/allowed_signers
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 5. Signierten Commit erstellen
|
||||||
|
```bash
|
||||||
|
git add .
|
||||||
|
git commit -S -m "Meine Änderung"
|
||||||
|
git push
|
||||||
|
```
|
||||||
|
|
||||||
|
Wenn `commit.gpgsign=true` gesetzt ist, signiert Git Commits in der Regel automatisch.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 6. Signatur lokal prüfen
|
||||||
|
```bash
|
||||||
|
git log --show-signature -1
|
||||||
|
git verify-commit HEAD
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Lokaler Minimal-Check vor dem Push
|
||||||
|
|
||||||
|
Vor dem Push solltest du mindestens diese Schritte ausführen:
|
||||||
|
|
||||||
|
### Format anwenden
|
||||||
|
```bash
|
||||||
|
clang-format -i main.cpp tests/test_main.cpp
|
||||||
|
```
|
||||||
|
|
||||||
|
### Policy lokal ausführen
|
||||||
|
```bash
|
||||||
|
python3 ci/check_pr_policies.py
|
||||||
|
```
|
||||||
|
|
||||||
|
## Projekt lokal im CI-Container bauen
|
||||||
|
|
||||||
|
Zuerst das lokale CI-Image bauen:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker build -t lifemaps/ci-cpp:latest -f Dockerfile.ci .
|
||||||
|
```
|
||||||
|
|
||||||
|
Danach das Projekt im Container bauen und testen:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run --rm -it \
|
||||||
|
-v "$PWD:/workspace" \
|
||||||
|
-w /workspace \
|
||||||
|
lifemaps/ci-cpp:latest \
|
||||||
|
bash -lc '
|
||||||
|
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug &&
|
||||||
|
cmake --build build --parallel &&
|
||||||
|
ctest --test-dir build --output-on-failure
|
||||||
|
'
|
||||||
|
```
|
||||||
|
|
||||||
|
Damit wird dieselbe Toolchain verwendet wie in der Jenkins-CI.
|
||||||
|
|
||||||
|
|
||||||
|
## Policy-Check lokal im CI-Container ausführen
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run --rm -it \
|
||||||
|
-v "$PWD:/workspace" \
|
||||||
|
-w /workspace \
|
||||||
|
lifemaps/ci-cpp:latest \
|
||||||
|
bash -lc 'python3 ci/check_pr_policies.py'
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Verhalten in Jenkins
|
||||||
|
|
||||||
|
Die Jenkins-Pipeline umfasst typischerweise diese Stages:
|
||||||
|
|
||||||
|
1. **Checkout**
|
||||||
|
2. **Policy Checks**
|
||||||
|
3. **Configure**
|
||||||
|
4. **Build**
|
||||||
|
5. **Test**
|
||||||
|
6. **Cleanup**
|
||||||
|
|
||||||
|
Wenn die Policy-Checks fehlschlagen, werden die späteren Build- und Test-Stages nicht mehr ausgeführt.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Typische Fehlerursachen
|
||||||
|
|
||||||
|
### Formatfehler
|
||||||
|
Beispiel:
|
||||||
|
```text
|
||||||
|
ERROR: Formatfehler in tests/test_main.cpp
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Lösung
|
||||||
|
```bash
|
||||||
|
clang-format -i tests/test_main.cpp
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Kein passender Test gefunden
|
||||||
|
Beispiel:
|
||||||
|
```text
|
||||||
|
ERROR: Kein passender Test unter tests/, test/ oder qt6-after/qt6-migrated-benchmark/tests für main.cpp gefunden.
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Lösung
|
||||||
|
- passenden Test anlegen
|
||||||
|
- Testdatei passend benennen
|
||||||
|
- Test in einem der erlaubten Testverzeichnisse ablegen
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Commit nicht gültig SSH-signiert
|
||||||
|
Beispiel:
|
||||||
|
```text
|
||||||
|
ERROR: Commit ist nicht gültig mit erlaubtem SSH-Signierer signiert: <sha>
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Lösung
|
||||||
|
- SSH-Signing lokal korrekt konfigurieren
|
||||||
|
- prüfen, ob der richtige Schlüssel verwendet wird
|
||||||
|
- prüfen, ob der öffentliche Schlüssel in `ci/allowed_signers` eingetragen ist
|
||||||
|
- Commit neu erstellen oder neu signieren
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### `.clang-format` fehlt
|
||||||
|
Beispiel:
|
||||||
|
```text
|
||||||
|
ERROR: .clang-format fehlt im Repository-Root.
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Lösung
|
||||||
|
- `.clang-format` im Repository-Root anlegen oder wiederherstellen
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Empfohlener Workflow
|
||||||
|
|
||||||
|
1. Feature-Branch erstellen
|
||||||
|
2. Änderungen implementieren
|
||||||
|
3. Test ergänzen oder anpassen
|
||||||
|
4. Code formatieren
|
||||||
|
5. Commit SSH-signiert erstellen
|
||||||
|
6. lokal Policy, Build und Tests ausführen
|
||||||
|
7. pushen
|
||||||
|
8. Pull Request öffnen
|
||||||
|
9. Jenkins-Ergebnis prüfen
|
||||||
|
10. erst bei grünem Status mergen
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Kurz-Checkliste vor jedem Push
|
||||||
|
|
||||||
|
- [ ] C/C++-Dateien sind formatiert
|
||||||
|
- [ ] passender Test existiert
|
||||||
|
- [ ] Commit ist SSH-signiert
|
||||||
|
- [ ] öffentlicher Schlüssel steht in `ci/allowed_signers`
|
||||||
|
- [ ] `python3 ci/check_pr_policies.py` läuft erfolgreich
|
||||||
|
- [ ] Build und Tests laufen lokal
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Ziel der Regeln
|
||||||
|
|
||||||
|
Die Policies sollen sicherstellen, dass:
|
||||||
|
|
||||||
|
- Code konsistent formatiert ist
|
||||||
|
- Änderungen nachvollziehbar getestet sind
|
||||||
|
- nur autorisierte Signierer Commits einbringen
|
||||||
|
- PRs frühzeitig automatisiert validiert werden
|
||||||
@@ -0,0 +1,336 @@
|
|||||||
|
# Entire auf Headless-Server mit EU-Kontext einrichten
|
||||||
|
|
||||||
|
Diese Anleitung beschreibt die Einrichtung von Entire auf einem Headless-Host mit bestehendem Git-Repository auf einem eigenen Gitea-Server und Nutzung des **EU-Kontexts**.
|
||||||
|
|
||||||
|
## Ziel
|
||||||
|
|
||||||
|
- Entire ohne GUI/Browser auf dem Server verwenden
|
||||||
|
- Login über Device-Code-Flow
|
||||||
|
- Tokens ohne OS-Keyring in Datei speichern
|
||||||
|
- EU-Jurisdiktion / EU-Cluster verwenden
|
||||||
|
- Entire lokal in einem bestehenden Git-Repository aktivieren
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Voraussetzungen
|
||||||
|
|
||||||
|
- `entire` CLI ist installiert
|
||||||
|
- Zugriff per SSH auf den Headless-Server
|
||||||
|
- funktionierendes lokales Git-Checkout
|
||||||
|
- `origin`-Remote ist gesetzt
|
||||||
|
- Browser auf einem **anderen lokalen Rechner** verfügbar
|
||||||
|
|
||||||
|
Beispiel prüfen:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git remote -v
|
||||||
|
```
|
||||||
|
|
||||||
|
Beispielausgabe:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
origin git@devel:lifemaps/qt-migration-copilot-demo.git (fetch)
|
||||||
|
origin git@devel:lifemaps/qt-migration-copilot-demo.git (push)
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 1. Token-Speicherung für Headless-Betrieb aktivieren
|
||||||
|
|
||||||
|
Auf Headless-Systemen gibt es oft keinen Linux-Keyring (`org.freedesktop.secrets`).
|
||||||
|
Deshalb sollten Entire-Tokens in einer Datei gespeichert werden.
|
||||||
|
|
||||||
|
Empfohlene Umgebungsvariablen:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export ENTIRE_TOKEN_STORE=file
|
||||||
|
export ENTIRE_TOKEN_STORE_PATH="$HOME/.config/entire/tokens.json"
|
||||||
|
export ACCESSIBLE=1
|
||||||
|
```
|
||||||
|
|
||||||
|
Temporär in der aktuellen Shell:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export ENTIRE_TOKEN_STORE=file
|
||||||
|
export ENTIRE_TOKEN_STORE_PATH="$HOME/.config/entire/tokens.json"
|
||||||
|
export ACCESSIBLE=1
|
||||||
|
```
|
||||||
|
|
||||||
|
Dauerhaft in `~/.bashrc`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
echo 'export ENTIRE_TOKEN_STORE=file' >> ~/.bashrc
|
||||||
|
echo 'export ENTIRE_TOKEN_STORE_PATH="$HOME/.config/entire/tokens.json"' >> ~/.bashrc
|
||||||
|
echo 'export ACCESSIBLE=1' >> ~/.bashrc
|
||||||
|
source ~/.bashrc
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2. Im EU-Kontext anmelden
|
||||||
|
|
||||||
|
Für Headless-Systeme den Device-Code-Flow verwenden:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
entire login --device --server https://eu.auth.entire.io
|
||||||
|
```
|
||||||
|
|
||||||
|
Das CLI zeigt dann etwa:
|
||||||
|
|
||||||
|
- einen **Device Code**
|
||||||
|
- eine **Login-URL**
|
||||||
|
|
||||||
|
Die URL im Browser **auf dem lokalen Rechner** öffnen und die Anmeldung dort bestätigen.
|
||||||
|
|
||||||
|
### Wichtiger Hinweis
|
||||||
|
|
||||||
|
Wenn auf dem Server kein Browser verfügbar ist, ist eine Meldung wie diese normal:
|
||||||
|
|
||||||
|
```text
|
||||||
|
Warning: failed to open browser: xdg-open not found
|
||||||
|
```
|
||||||
|
|
||||||
|
Das ist **nicht** das eigentliche Problem.
|
||||||
|
|
||||||
|
Falls Entire versucht, Tokens im Keyring zu speichern und dabei fehlschlägt, war `ENTIRE_TOKEN_STORE=file` nicht gesetzt.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3. Login prüfen
|
||||||
|
|
||||||
|
Nach erfolgreicher Anmeldung:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
entire auth status
|
||||||
|
```
|
||||||
|
|
||||||
|
Beispiel:
|
||||||
|
|
||||||
|
```text
|
||||||
|
Logged in to https://eu.auth.entire.io
|
||||||
|
Context: eu.auth.entire.io
|
||||||
|
Token: stored in file /home/<user>/.config/entire/tokens.json
|
||||||
|
```
|
||||||
|
|
||||||
|
Falls mehrere Kontexte existieren:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
entire auth contexts
|
||||||
|
entire auth use --help
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 4. Prüfen, ob wirklich EU verwendet wird
|
||||||
|
|
||||||
|
Zusätzlich zum Login-Kontext sollte geprüft werden, auf welchem Cluster die Entire-Repositories liegen.
|
||||||
|
|
||||||
|
Projekt-Repositories anzeigen:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
entire repo list <project-id>
|
||||||
|
```
|
||||||
|
|
||||||
|
Wenn in der Spalte `CLUSTER` z. B. Folgendes erscheint:
|
||||||
|
|
||||||
|
```text
|
||||||
|
aws-eu-central-1.entire.io
|
||||||
|
```
|
||||||
|
|
||||||
|
dann liegen diese Repositories auf einem **EU-Cluster**.
|
||||||
|
|
||||||
|
### Empfohlener Doppel-Check
|
||||||
|
|
||||||
|
```bash
|
||||||
|
entire auth status
|
||||||
|
entire repo list <project-id>
|
||||||
|
```
|
||||||
|
|
||||||
|
EU ist praktisch bestätigt, wenn:
|
||||||
|
|
||||||
|
- `Context: eu.auth.entire.io` aktiv ist
|
||||||
|
- die Repositories auf `aws-eu-central-1.entire.io` liegen
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 5. Entire im lokalen Repository aktivieren
|
||||||
|
|
||||||
|
In das lokale Repository wechseln:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd ~/coplint.d/qt-migration-copilot-demo
|
||||||
|
```
|
||||||
|
|
||||||
|
Dann Entire aktivieren:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
entire enable
|
||||||
|
```
|
||||||
|
|
||||||
|
Status prüfen:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
entire status
|
||||||
|
```
|
||||||
|
|
||||||
|
Beispiel:
|
||||||
|
|
||||||
|
```text
|
||||||
|
● Enabled · branch bugfix/ci-pipeline-commissioning
|
||||||
|
Agents · Copilot CLI
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 6. Agent-Integration prüfen oder ergänzen
|
||||||
|
|
||||||
|
Verfügbare Agenten anzeigen:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
entire agent list
|
||||||
|
```
|
||||||
|
|
||||||
|
Hilfe für das Hinzufügen:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
entire agent add --help
|
||||||
|
```
|
||||||
|
|
||||||
|
Neuen Agenten hinzufügen:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
entire agent add <name>
|
||||||
|
```
|
||||||
|
|
||||||
|
Danach erneut prüfen:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
entire status
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 7. Unterschied zwischen lokalem Git-Repo und Entire-Repo verstehen
|
||||||
|
|
||||||
|
Wichtig: Entire verwendet hier **zwei verschiedene Konzepte**.
|
||||||
|
|
||||||
|
### Lokales Git-Repository
|
||||||
|
Das echte Code-Repository, z. B.:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git@devel:lifemaps/qt-migration-copilot-demo.git
|
||||||
|
```
|
||||||
|
|
||||||
|
### Entire-Repository
|
||||||
|
Ein separates Objekt in Entire, verwaltet über:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
entire repo list <project-id>
|
||||||
|
entire repo get <repo> --project <project-id>
|
||||||
|
entire repo create <name> --project <project-id>
|
||||||
|
```
|
||||||
|
|
||||||
|
### Konsequenz
|
||||||
|
|
||||||
|
`entire enable` aktiviert das **lokale Git-Repository**,
|
||||||
|
aber es erzeugt **nicht automatisch** ein neues `entire repo`-Objekt.
|
||||||
|
|
||||||
|
Darum kann es sein, dass:
|
||||||
|
|
||||||
|
- `entire status` = aktiviert
|
||||||
|
- aber `entire repo list <project-id>` dein lokales Repo **nicht** zeigt
|
||||||
|
|
||||||
|
Das ist normales Verhalten.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 8. Optional: Entire-Repo im Projekt anlegen
|
||||||
|
|
||||||
|
Wenn zusätzlich ein eigenes Entire-Repo-Objekt für das lokale Projekt gewünscht ist:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
entire repo create qt-migration-copilot-demo --project <project-id>
|
||||||
|
```
|
||||||
|
|
||||||
|
Danach prüfen:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
entire repo list <project-id>
|
||||||
|
```
|
||||||
|
|
||||||
|
### Hinweis
|
||||||
|
|
||||||
|
Nach bisherigem CLI-Verhalten wird dabei nur ein **Entire-internes Repo-Objekt** erzeugt.
|
||||||
|
Es gibt in der gezeigten Hilfe keinen Hinweis darauf, dass dabei automatisch eine Git-URL aus Gitea importiert oder synchronisiert wird.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 9. Typischer Minimal-Workflow
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export ENTIRE_TOKEN_STORE=file
|
||||||
|
export ENTIRE_TOKEN_STORE_PATH="$HOME/.config/entire/tokens.json"
|
||||||
|
export ACCESSIBLE=1
|
||||||
|
|
||||||
|
entire login --device --server https://eu.auth.entire.io
|
||||||
|
entire auth status
|
||||||
|
|
||||||
|
cd ~/coplint.d/qt-migration-copilot-demo
|
||||||
|
entire enable
|
||||||
|
entire status
|
||||||
|
entire agent list
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 10. Troubleshooting
|
||||||
|
|
||||||
|
### Kein Browser auf dem Server
|
||||||
|
Normal auf Headless-Hosts.
|
||||||
|
Device-Code-URL auf lokalem Rechner öffnen.
|
||||||
|
|
||||||
|
### Login erfolgreich, aber `Not logged in`
|
||||||
|
Ursache meist fehlender Keyring und keine Datei-Speicherung.
|
||||||
|
|
||||||
|
Lösung:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export ENTIRE_TOKEN_STORE=file
|
||||||
|
entire login --device --server https://eu.auth.entire.io
|
||||||
|
```
|
||||||
|
|
||||||
|
### Entire ist aktiviert, aber nicht in `entire repo list`
|
||||||
|
Das ist erwartbar, weil lokales Git-Repo und Entire-Projektrepo getrennte Objekte sind.
|
||||||
|
|
||||||
|
### Diagnose
|
||||||
|
Bei Problemen:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
entire doctor
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 11. Empfehlung für dieses Setup
|
||||||
|
|
||||||
|
Für ein Setup mit **Gitea + Jenkins + Entire** gilt:
|
||||||
|
|
||||||
|
- **Gitea** bleibt Source-of-Truth für den Code
|
||||||
|
- **Jenkins** bleibt CI/CD-System
|
||||||
|
- **Entire** ergänzt Session-, Agent- und Checkpoint-Tracking im lokalen Repository
|
||||||
|
- **Entire-Projekte/Repos** sind zusätzliche Verwaltungsobjekte und nicht identisch mit dem Gitea-Remote
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 12. Nützliche Befehle
|
||||||
|
|
||||||
|
```bash
|
||||||
|
entire auth status
|
||||||
|
entire auth contexts
|
||||||
|
entire project list
|
||||||
|
entire repo list <project-id>
|
||||||
|
entire enable
|
||||||
|
entire status
|
||||||
|
entire agent list
|
||||||
|
entire doctor
|
||||||
|
```
|
||||||
@@ -0,0 +1,280 @@
|
|||||||
|
# scripts/
|
||||||
|
|
||||||
|
Dieses Verzeichnis enthält Hilfsskripte für den Demo- und Benchmark-Workflow rund um:
|
||||||
|
|
||||||
|
- **Qt5 → Qt6**
|
||||||
|
- **C++11 → C++23**
|
||||||
|
- **Copilot CLI**
|
||||||
|
- **Entire CLI**
|
||||||
|
- **Scaleway BYOK / OpenAI-kompatibler Provider**
|
||||||
|
- **lokale Reproduzierbarkeit der Migration**
|
||||||
|
|
||||||
|
## Übersicht
|
||||||
|
|
||||||
|
### `create-qt5-legacy-benchmark.sh`
|
||||||
|
Erzeugt das Legacy-Beispielprojekt unter:
|
||||||
|
|
||||||
|
```text
|
||||||
|
qt5-before/qt5-legacy-migration-benchmark
|
||||||
|
```
|
||||||
|
|
||||||
|
Das Projekt ist absichtlich veraltet aufgebaut, um eine realistische Migration zu erzwingen, z. B. mit:
|
||||||
|
|
||||||
|
- `QRegExp`
|
||||||
|
- `QDesktopWidget`
|
||||||
|
- `QTextCodec`
|
||||||
|
- alter `SIGNAL/SLOT`-Syntax
|
||||||
|
- `Qt5::Core`, `Qt5::Gui`, `Qt5::Widgets`
|
||||||
|
- `C++11`
|
||||||
|
|
||||||
|
### `run-entire-copilot-migration.sh`
|
||||||
|
Standard-Workflow für eine Copilot-CLI-Migration mit Entire:
|
||||||
|
|
||||||
|
1. Entire für Copilot CLI aktivieren
|
||||||
|
2. Baseline committen
|
||||||
|
3. Copilot-Session starten
|
||||||
|
4. Ergebnis committen
|
||||||
|
5. Checkpoints anzeigen
|
||||||
|
6. letzten Stand mit Entire erklären
|
||||||
|
|
||||||
|
Dieses Skript ist für den normalen Migrationslauf gedacht.
|
||||||
|
|
||||||
|
**Modellwahl:**
|
||||||
|
Das Skript akzeptiert optional ein Modell als zweiten Parameter.
|
||||||
|
|
||||||
|
Default:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./scripts/run-entire-copilot-migration.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
verwendet intern:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
copilot --model "qwen3.5-397b-a17b"
|
||||||
|
```
|
||||||
|
|
||||||
|
Mit explizitem Modell:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./scripts/run-entire-copilot-migration.sh qt5-before/qt5-legacy-migration-benchmark gpt-5
|
||||||
|
```
|
||||||
|
|
||||||
|
### `run-entire-copilot-migration-with-optional-rewind-resume.sh`
|
||||||
|
Wie das Standardskript, aber zusätzlich mit optionalem:
|
||||||
|
|
||||||
|
- `entire checkpoint rewind`
|
||||||
|
- `entire session resume <branch>`
|
||||||
|
|
||||||
|
**Modellwahl:**
|
||||||
|
Auch dieses Skript akzeptiert optional ein Modell als zweiten Parameter.
|
||||||
|
|
||||||
|
Beispiel:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./scripts/run-entire-copilot-migration-with-optional-rewind-resume.sh qt5-before/qt5-legacy-migration-benchmark claude-sonnet-4
|
||||||
|
```
|
||||||
|
|
||||||
|
**Wichtig:**
|
||||||
|
Die Entire-Dokumentation ist bei Copilot CLI in Bezug auf Rewind/Resume nicht ganz konsistent.
|
||||||
|
Die Copilot-CLI-Seite beschreibt Rewind und Resume, während die allgemeine Agent-Übersicht teils eingeschränkte Aussagen macht.
|
||||||
|
|
||||||
|
Darum behandelt dieses Skript Rewind/Resume bewusst als **optional** und **fehlertolerant**.
|
||||||
|
|
||||||
|
### `use-scaleway-copilot-debug.sh`
|
||||||
|
Hilfsskript zum Setzen einer **Scaleway OpenAI-kompatiblen BYOK-Konfiguration** für Copilot CLI.
|
||||||
|
|
||||||
|
Typischer Zweck:
|
||||||
|
|
||||||
|
- Provider-Umgebungsvariablen setzen
|
||||||
|
- Copilot CLI mit Scaleway testen
|
||||||
|
- Modellname konfigurieren
|
||||||
|
- Token-Limits für nicht im Copilot-Katalog enthaltene Modelle explizit setzen
|
||||||
|
- Debugging eines externen Providers vereinfachen
|
||||||
|
|
||||||
|
Ein typischer Inhalt wäre z. B.:
|
||||||
|
|
||||||
|
- `COPILOT_PROVIDER_TYPE=openai`
|
||||||
|
- `COPILOT_PROVIDER_BASE_URL=https://api.scaleway.ai/v1`
|
||||||
|
- `COPILOT_PROVIDER_API_KEY=...`
|
||||||
|
- `COPILOT_MODEL=qwen3.5-397b-a17b`
|
||||||
|
- `COPILOT_PROVIDER_MAX_PROMPT_TOKENS=...`
|
||||||
|
- `COPILOT_PROVIDER_MAX_OUTPUT_TOKENS=...`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## NOTE: Secret in `.envrc` hinterlegen
|
||||||
|
|
||||||
|
Das Secret für den verwendeten LLM-Provider soll **nicht** direkt in die Skripte geschrieben oder committed werden.
|
||||||
|
|
||||||
|
Lege den API-Key stattdessen in einer lokalen `.envrc` ab, z. B.:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export SCW_SECRET_KEY="YOUR_PROVIDER_SECRET_HERE"
|
||||||
|
```
|
||||||
|
|
||||||
|
oder allgemeiner:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export OPENAI_API_KEY="YOUR_PROVIDER_SECRET_HERE"
|
||||||
|
```
|
||||||
|
|
||||||
|
Danach die Umgebung neu laden, z. B. mit:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
direnv allow
|
||||||
|
```
|
||||||
|
|
||||||
|
oder die Datei manuell sourcen, falls du kein `direnv` verwendest.
|
||||||
|
|
||||||
|
**Wichtig:**
|
||||||
|
- `.envrc` nicht committen
|
||||||
|
- Secrets nicht im Repository speichern
|
||||||
|
- Provider-Zugangsdaten nur lokal halten
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Empfohlene Reihenfolge
|
||||||
|
|
||||||
|
### 1. Legacy-Projekt erzeugen
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./scripts/create-qt5-legacy-benchmark.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Optional: Copilot mit Scaleway konfigurieren
|
||||||
|
|
||||||
|
```bash
|
||||||
|
source ./scripts/use-scaleway-copilot-debug.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Danach kannst du prüfen, ob die Variablen gesetzt sind:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
echo "$COPILOT_PROVIDER_BASE_URL"
|
||||||
|
echo "$COPILOT_MODEL"
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Migration mit Entire + Copilot starten
|
||||||
|
|
||||||
|
Standard mit Default-Modell:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./scripts/run-entire-copilot-migration.sh qt5-before/qt5-legacy-migration-benchmark
|
||||||
|
```
|
||||||
|
|
||||||
|
Standard mit explizitem Modell:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./scripts/run-entire-copilot-migration.sh qt5-before/qt5-legacy-migration-benchmark qwen3.5-397b-a17b
|
||||||
|
```
|
||||||
|
|
||||||
|
Mit optionalem Rewind/Resume:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./scripts/run-entire-copilot-migration-with-optional-rewind-resume.sh qt5-before/qt5-legacy-migration-benchmark qwen3.5-397b-a17b
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Copilot-Prompt für die Migration
|
||||||
|
|
||||||
|
Die Migrationsskripte verwenden sinngemäß einen Prompt in dieser Richtung:
|
||||||
|
|
||||||
|
```text
|
||||||
|
Migrate the legacy Qt5/C++11 desktop application to Qt6/C++23.
|
||||||
|
|
||||||
|
Requirements:
|
||||||
|
- Read the legacy source project from qt5-before/qt5-legacy-migration-benchmark
|
||||||
|
- Write the migrated project into qt6-after/qt6-migrated-benchmark
|
||||||
|
- Do not modify the legacy source tree in place
|
||||||
|
- Update CMake from Qt5 to Qt6
|
||||||
|
- Keep Core, Gui, and Widgets explicitly linked
|
||||||
|
- Replace QRegExp with QRegularExpression
|
||||||
|
- Replace QDesktopWidget / QApplication::desktop() usage with QScreen-based Qt6 APIs
|
||||||
|
- Remove legacy QTextCodec usage and use modern Qt6-safe text handling
|
||||||
|
- Modernize old SIGNAL/SLOT syntax to function-pointer connect syntax
|
||||||
|
- Replace legacy null pointer literals with nullptr
|
||||||
|
- Preserve the .ui and .qrc integration
|
||||||
|
- Preserve application behavior
|
||||||
|
- Upgrade the project from C++11 to C++23
|
||||||
|
- For every code change inside a method, add at least three tests covering the changed behavior
|
||||||
|
- Place all generated tests in qt6-after/qt6-migrated-benchmark/tests
|
||||||
|
- Update CMake so the migrated application and all tests build successfully with CTest
|
||||||
|
- Keep the test file naming compatible with repository policy checks
|
||||||
|
- Briefly explain each migration change
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Entire-Hinweise
|
||||||
|
|
||||||
|
Entire erfasst bei unterstützten Agenten u. a.:
|
||||||
|
|
||||||
|
- Gesprächsverlauf
|
||||||
|
- Dateiveränderungen
|
||||||
|
- Zeitstempel
|
||||||
|
- Checkpoints bei Commits
|
||||||
|
- Session-Kontext auf dem Branch `entire/checkpoints/v1`
|
||||||
|
|
||||||
|
Typischer Entire-Grundablauf:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
entire agent add copilot-cli
|
||||||
|
copilot --model "qwen3.5-397b-a17b"
|
||||||
|
git add .
|
||||||
|
git commit -m "..."
|
||||||
|
entire checkpoint list
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Hinweise zu `use-scaleway-copilot-debug.sh`
|
||||||
|
|
||||||
|
Das Skript sollte **gesourct** werden, nicht als eigener Prozess laufen, damit exportierte Variablen in deiner aktuellen Shell erhalten bleiben:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
source ./scripts/use-scaleway-copilot-debug.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
oder kurz:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
. ./scripts/use-scaleway-copilot-debug.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Außerdem:
|
||||||
|
|
||||||
|
- keine echten Secrets committen
|
||||||
|
- API-Keys nicht im Repo speichern
|
||||||
|
- sensible Werte aus `.envrc` oder bereits gesetzten Umgebungsvariablen übernehmen
|
||||||
|
|
||||||
|
Beispiel:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export SCW_SECRET_KEY="..."
|
||||||
|
source ./scripts/use-scaleway-copilot-debug.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Empfohlene Erweiterungen
|
||||||
|
|
||||||
|
Optional kannst du später noch ergänzen:
|
||||||
|
|
||||||
|
- `build-qt6-after.sh`
|
||||||
|
- `run-ctest-qt6-after.sh`
|
||||||
|
- `compare-before-after.sh`
|
||||||
|
- `capture-copilot-env.sh`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Kurzfassung
|
||||||
|
|
||||||
|
Der `scripts/`-Ordner enthält alles, um:
|
||||||
|
|
||||||
|
1. ein Legacy-Qt5-Projekt zu erzeugen,
|
||||||
|
2. Copilot CLI optional mit einem externen Modell zu konfigurieren,
|
||||||
|
3. Secrets lokal über `.envrc` bereitzustellen,
|
||||||
|
4. eine Qt6/C++23-Migration mit Entire zu dokumentieren,
|
||||||
|
5. und den Migrationslauf reproduzierbar zu machen.
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
# Copilot CLI mit Scaleway verwenden
|
||||||
|
|
||||||
|
## 1) `.envrc` anlegen
|
||||||
|
|
||||||
|
Lege in deinem Projekt eine Datei `.envrc` an:
|
||||||
|
|
||||||
|
```bash name=.envrc
|
||||||
|
export STRIX_LLM="qwen3.5-397b-a17b"
|
||||||
|
export SCW_SECRET_KEY="REPLACE_WITH_YOURS"
|
||||||
|
|
||||||
|
export COPILOT_PROVIDER_TYPE="openai"
|
||||||
|
export COPILOT_PROVIDER_API_KEY="${SCW_SECRET_KEY}"
|
||||||
|
export COPILOT_PROVIDER_BASE_URL="https://api.scaleway.ai/v1"
|
||||||
|
export COPILOT_MODEL="${STRIX_LLM}"
|
||||||
|
|
||||||
|
export COPILOT_PROVIDER_MAX_PROMPT_TOKENS="32768"
|
||||||
|
export COPILOT_PROVIDER_MAX_OUTPUT_TOKENS="8192"
|
||||||
|
```
|
||||||
|
|
||||||
|
## 2) `direnv` erlauben
|
||||||
|
|
||||||
|
Falls `direnv` schon installiert ist:
|
||||||
|
|
||||||
|
```bash name=direnv-allow.sh
|
||||||
|
direnv allow
|
||||||
|
```
|
||||||
|
|
||||||
|
Wenn noch nicht in der Shell aktiviert, ergänze deine Shell-Config.
|
||||||
|
|
||||||
|
### Bash
|
||||||
|
```bash name=bash-direnv-hook.sh
|
||||||
|
eval "$(direnv hook bash)"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Zsh
|
||||||
|
```bash name=zsh-direnv-hook.sh
|
||||||
|
eval "$(direnv hook zsh)"
|
||||||
|
```
|
||||||
|
|
||||||
|
Danach Shell neu laden:
|
||||||
|
|
||||||
|
```bash name=reload-shell-config.sh
|
||||||
|
source ~/.bashrc
|
||||||
|
# oder
|
||||||
|
source ~/.zshrc
|
||||||
|
```
|
||||||
|
|
||||||
|
## 3) Startskript anlegen
|
||||||
|
|
||||||
|
```bash name=use-scaleway-copilot.sh
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
if ! command -v copilot >/dev/null 2>&1; then
|
||||||
|
echo "copilot CLI nicht gefunden."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
: "${COPILOT_PROVIDER_TYPE:?COPILOT_PROVIDER_TYPE fehlt}"
|
||||||
|
: "${COPILOT_PROVIDER_API_KEY:?COPILOT_PROVIDER_API_KEY fehlt}"
|
||||||
|
: "${COPILOT_PROVIDER_BASE_URL:?COPILOT_PROVIDER_BASE_URL fehlt}"
|
||||||
|
: "${COPILOT_MODEL:?COPILOT_MODEL fehlt}"
|
||||||
|
|
||||||
|
echo "Starte Copilot CLI mit:"
|
||||||
|
echo " Provider: ${COPILOT_PROVIDER_TYPE}"
|
||||||
|
echo " Base URL: ${COPILOT_PROVIDER_BASE_URL}"
|
||||||
|
echo " Modell: ${COPILOT_MODEL}"
|
||||||
|
|
||||||
|
exec copilot "$@"
|
||||||
|
```
|
||||||
|
|
||||||
|
Dann ausführbar machen:
|
||||||
|
|
||||||
|
```bash name=chmod-script.sh
|
||||||
|
chmod +x use-scaleway-copilot.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Start:
|
||||||
|
|
||||||
|
```bash name=start-script.sh
|
||||||
|
./use-scaleway-copilot.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Oder mit Argumenten:
|
||||||
|
|
||||||
|
```bash name=start-script-with-args.sh
|
||||||
|
./use-scaleway-copilot.sh --model="qwen3.5-397b-a17b"
|
||||||
|
```
|
||||||
|
|
||||||
|
## 4) `.gitignore` ergänzen
|
||||||
|
|
||||||
|
Falls noch nicht vorhanden:
|
||||||
|
|
||||||
|
```gitignore name=.gitignore
|
||||||
|
.env
|
||||||
|
.envrc
|
||||||
|
```
|
||||||
Whitespace-only changes.
Whitespace-only changes.
@@ -0,0 +1,157 @@
|
|||||||
|
# GitHub Copilot Instructions: Qt5/C++11 to Qt6/C++23 Migration
|
||||||
|
|
||||||
|
## Mission
|
||||||
|
Migrate the legacy Qt5/C++11 desktop application to Qt6/C++23, preserve behavior unless change is strictly required, and validate the result completely in the repository’s Docker-based CI workflow.
|
||||||
|
|
||||||
|
## Operating Mode
|
||||||
|
- Work autonomously from analysis through validation.
|
||||||
|
- Do not stop after editing code.
|
||||||
|
- Continue until configure, build, tests, and policy checks have been attempted in Docker.
|
||||||
|
- Do not ask for confirmation during normal implementation.
|
||||||
|
- Stop early only if required source material is missing, the task is impossible, or a destructive action would be required.
|
||||||
|
|
||||||
|
## Boundaries
|
||||||
|
- Read the legacy project from `${PROJECT_DIR}`.
|
||||||
|
- Write the migrated project to `qt6-after/qt6-migrated-benchmark`.
|
||||||
|
- Do not modify the legacy source tree in place.
|
||||||
|
- Limit changes to the target tree and only the CI/build/test files needed to support migration and validation.
|
||||||
|
|
||||||
|
## Main Migration Targets
|
||||||
|
- Upgrade Qt5 to Qt6.
|
||||||
|
- Upgrade C++11/14/17 code to C++23.
|
||||||
|
- Keep Qt Core, Gui, and Widgets explicitly linked.
|
||||||
|
- Replace `QRegExp` with `QRegularExpression`.
|
||||||
|
- Replace `QDesktopWidget` and `QApplication::desktop()` with `QScreen`-based Qt6 APIs.
|
||||||
|
- Remove legacy `QTextCodec` usage and adopt Qt6-safe text handling.
|
||||||
|
- Replace old `SIGNAL`/`SLOT` syntax with function-pointer connect syntax.
|
||||||
|
- Replace `0`/`NULL` pointer literals with `nullptr`.
|
||||||
|
- Preserve `.ui` and `.qrc` integration.
|
||||||
|
- Preserve behavior unless Qt6 compatibility requires adaptation.
|
||||||
|
|
||||||
|
## C++23 Modernization Rules
|
||||||
|
- Preserve semantics first; modernize second.
|
||||||
|
- Use `auto` when the type is obvious; avoid it when it hides important type information.
|
||||||
|
- Prefer structured bindings where clearer.
|
||||||
|
- Replace raw owning pointers/manual `delete` with RAII, usually `std::unique_ptr`.
|
||||||
|
- Use `std::make_unique` / `std::make_shared`; use `std::shared_ptr` only for real shared ownership.
|
||||||
|
- Use `std::string_view` only when lifetime safety is clear.
|
||||||
|
- Prefer `std::span` for non-owning contiguous data; use `std::mdspan` only when multidimensional access clearly benefits.
|
||||||
|
- Prefer `.contains()` over `find(...) != end()` where available.
|
||||||
|
- Prefer algorithms and ranges over manual loops when readability improves.
|
||||||
|
- Use `[[nodiscard]]` when ignoring a result is likely a bug.
|
||||||
|
- Prefer early returns over deeply nested control flow.
|
||||||
|
- Use `std::optional` monadic operations (`and_then`, `transform`, `or_else`) when clearer.
|
||||||
|
- Prefer `constexpr`, `if constexpr`, concepts, and `requires` over legacy `std::enable_if`/SFINAE where practical.
|
||||||
|
- Add `noexcept`, `override`, `final`, `= default`, and `= delete` where correct and useful.
|
||||||
|
- Prefer `enum class` over unscoped enums where practical.
|
||||||
|
- Prefer `std::print` / `std::println` when supported by the toolchain.
|
||||||
|
- Prefer typed `std::chrono` durations and `std::jthread` where appropriate.
|
||||||
|
|
||||||
|
## Safety Rules
|
||||||
|
- Do not change business logic unless explicitly requested or required for Qt6 compatibility.
|
||||||
|
- Do not introduce unsupported Qt6/C++23 features.
|
||||||
|
- Do not silently change ABI, ownership, lifetime, exception behavior, performance, UI behavior, or event ordering.
|
||||||
|
- Do not worsen readability for the sake of modernization.
|
||||||
|
- Avoid dangling references, dangling `std::string_view`, and ownership ambiguity.
|
||||||
|
- Keep includes minimal and preserve repository-local formatting/style.
|
||||||
|
|
||||||
|
## Tests
|
||||||
|
- For every code change inside a method, add at least three tests covering the changed behavior.
|
||||||
|
- Place generated tests in `qt6-after/qt6-migrated-benchmark/tests`.
|
||||||
|
- Use policy-compatible test filenames such as:
|
||||||
|
- `test_<name>.cpp`
|
||||||
|
- `<name>_test.cpp`
|
||||||
|
- `<name>test.cpp`
|
||||||
|
- `<name>gtest.cpp`
|
||||||
|
- Update CMake so the migrated app and all tests build and run with CTest.
|
||||||
|
- Ensure all tests are registered with CTest.
|
||||||
|
|
||||||
|
## Docker-First Validation
|
||||||
|
Use `lifemaps/ci-cpp:latest` as the authoritative environment. Do not substitute host tools for missing container tools. Treat `Dockerfile.ci` as the source of truth for CI dependencies.
|
||||||
|
|
||||||
|
### Required validation sequence
|
||||||
|
1. Configure in Docker
|
||||||
|
2. Build in Docker
|
||||||
|
3. Run tests in Docker
|
||||||
|
4. If tests pass, run `python3 ci/check_pr_policies.py` in Docker
|
||||||
|
|
||||||
|
### Recommended commands
|
||||||
|
- Configure:
|
||||||
|
`cmake -S qt6-after/qt6-migrated-benchmark -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug`
|
||||||
|
- Build:
|
||||||
|
`cmake --build build --parallel`
|
||||||
|
- Test:
|
||||||
|
`ctest --test-dir build --output-on-failure`
|
||||||
|
- Policy:
|
||||||
|
`python3 ci/check_pr_policies.py`
|
||||||
|
|
||||||
|
Adapt paths/flags only if repository inspection proves they must differ.
|
||||||
|
|
||||||
|
## Missing-Tool Remediation
|
||||||
|
If Docker validation fails because a required tool/package is missing:
|
||||||
|
- identify the exact missing dependency
|
||||||
|
- update `Dockerfile.ci` minimally
|
||||||
|
- rebuild `lifemaps/ci-cpp:latest`
|
||||||
|
- rerun the full validation sequence
|
||||||
|
|
||||||
|
Continue until:
|
||||||
|
- validation succeeds, or
|
||||||
|
- the next blocker is a genuine project/code issue
|
||||||
|
|
||||||
|
## Failure Classification
|
||||||
|
Environment failures:
|
||||||
|
- command not found
|
||||||
|
- missing compiler/toolchain utility
|
||||||
|
- missing Qt dev package
|
||||||
|
- missing CMake/Ninja/CTest support tool
|
||||||
|
- missing dependency required by `ci/check_pr_policies.py`
|
||||||
|
|
||||||
|
Project failures:
|
||||||
|
- compile errors
|
||||||
|
- linker errors
|
||||||
|
- failing tests
|
||||||
|
- formatting/policy failures caused by migration changes
|
||||||
|
|
||||||
|
## Policy Awareness
|
||||||
|
- `ci/check_pr_policies.py` checks formatting for changed C/C++ files, expects related tests, and verifies commit-signature conditions in its diff range.
|
||||||
|
- Ensure Docker validation runs with mounted workspace and git metadata available.
|
||||||
|
- Do not claim success unless the policy script passes.
|
||||||
|
|
||||||
|
## Execution Plan
|
||||||
|
1. Inspect `${PROJECT_DIR}` and the target tree.
|
||||||
|
2. Identify Qt5 and legacy C++ constructs to migrate.
|
||||||
|
3. Migrate incrementally in `qt6-after/qt6-migrated-benchmark`.
|
||||||
|
4. Add/update tests with each behavior-relevant change.
|
||||||
|
5. Update CMake/test registration.
|
||||||
|
6. Validate in Docker.
|
||||||
|
7. If missing dependencies are found, update `Dockerfile.ci`, rebuild, and rerun.
|
||||||
|
8. Repeat until success or a real project defect remains.
|
||||||
|
|
||||||
|
## Reporting
|
||||||
|
Group change explanations by:
|
||||||
|
- CMake / build-system migration
|
||||||
|
- Qt API replacements
|
||||||
|
- C++ modernization
|
||||||
|
- UI/resource preservation
|
||||||
|
- tests added
|
||||||
|
- `Dockerfile.ci` / container updates
|
||||||
|
|
||||||
|
Also provide a concise changed-files summary.
|
||||||
|
|
||||||
|
## Completion Criteria
|
||||||
|
Success requires:
|
||||||
|
- migrated project exists under `qt6-after/qt6-migrated-benchmark`
|
||||||
|
- configure succeeds in Docker
|
||||||
|
- build succeeds in Docker
|
||||||
|
- tests succeed in Docker
|
||||||
|
- `python3 ci/check_pr_policies.py` succeeds in Docker after tests pass
|
||||||
|
|
||||||
|
## Final Response
|
||||||
|
- State whether migration is fully validated or which blocker remains.
|
||||||
|
- List the exact Docker commands used for image rebuild, configure, build, test, and policy check.
|
||||||
|
- For every failed attempt, include:
|
||||||
|
- exact command
|
||||||
|
- key error
|
||||||
|
- environment vs project classification
|
||||||
|
- fix applied
|
||||||
|
- End with a short summary of any remaining blocker.
|
||||||
Executable
+233
@@ -0,0 +1,233 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
TARGET_DIR="${1:-qt5-before/qt5-legacy-migration-benchmark}"
|
||||||
|
mkdir -p "${TARGET_DIR}"
|
||||||
|
|
||||||
|
cat > "${TARGET_DIR}/CMakeLists.txt" <<'FILE_EOF'
|
||||||
|
cmake_minimum_required(VERSION 3.10)
|
||||||
|
|
||||||
|
project(Qt5LegacyMigrationBenchmark LANGUAGES CXX)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
|
set(CMAKE_AUTOMOC ON)
|
||||||
|
set(CMAKE_AUTOUIC ON)
|
||||||
|
set(CMAKE_AUTORCC ON)
|
||||||
|
|
||||||
|
find_package(Qt5 REQUIRED COMPONENTS Core Gui Widgets)
|
||||||
|
|
||||||
|
add_executable(Qt5LegacyMigrationBenchmark
|
||||||
|
main.cpp
|
||||||
|
MainWindow.h
|
||||||
|
MainWindow.cpp
|
||||||
|
MainWindow.ui
|
||||||
|
resources.qrc
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(Qt5LegacyMigrationBenchmark
|
||||||
|
Qt5::Core
|
||||||
|
Qt5::Gui
|
||||||
|
Qt5::Widgets
|
||||||
|
)
|
||||||
|
FILE_EOF
|
||||||
|
|
||||||
|
cat > "${TARGET_DIR}/MainWindow.h" <<'FILE_EOF'
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QMainWindow>
|
||||||
|
#include <QRegExp>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
namespace Ui {
|
||||||
|
class MainWindow;
|
||||||
|
}
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
class MainWindow : public QMainWindow
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit MainWindow(QWidget *parent = 0);
|
||||||
|
~MainWindow();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void onValidateClicked();
|
||||||
|
void onScreenInfoClicked();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::MainWindow *ui;
|
||||||
|
QRegExp legacyPattern;
|
||||||
|
};
|
||||||
|
FILE_EOF
|
||||||
|
|
||||||
|
cat > "${TARGET_DIR}/MainWindow.cpp" <<'FILE_EOF'
|
||||||
|
#include "MainWindow.h"
|
||||||
|
#include "ui_MainWindow.h"
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QDesktopWidget>
|
||||||
|
#include <QTextCodec>
|
||||||
|
#include <QPixmap>
|
||||||
|
#include <QString>
|
||||||
|
#include <QRect>
|
||||||
|
|
||||||
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
|
: QMainWindow(parent)
|
||||||
|
, ui(new Ui::MainWindow)
|
||||||
|
, legacyPattern("^[A-Za-z]+\\d+$")
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
QTextCodec *codec = QTextCodec::codecForName("UTF-8");
|
||||||
|
QString title = codec->toUnicode("Qt5 Legacy Migration Benchmark");
|
||||||
|
setWindowTitle(title);
|
||||||
|
|
||||||
|
ui->label->setText(codec->toUnicode("Bitte Text wie Test123 eingeben."));
|
||||||
|
ui->iconLabel->setPixmap(QPixmap(":/icons/app.png").scaled(48, 48));
|
||||||
|
|
||||||
|
connect(ui->validateButton, SIGNAL(clicked()), this, SLOT(onValidateClicked()));
|
||||||
|
connect(ui->screenButton, SIGNAL(clicked()), this, SLOT(onScreenInfoClicked()));
|
||||||
|
}
|
||||||
|
|
||||||
|
MainWindow::~MainWindow()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::onValidateClicked()
|
||||||
|
{
|
||||||
|
QString text = ui->lineEdit->text();
|
||||||
|
|
||||||
|
if (legacyPattern.exactMatch(text)) {
|
||||||
|
ui->resultLabel->setText("Match");
|
||||||
|
} else {
|
||||||
|
ui->resultLabel->setText("No match");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::onScreenInfoClicked()
|
||||||
|
{
|
||||||
|
QRect screenGeometry = QApplication::desktop()->screenGeometry();
|
||||||
|
QString info = QString("Screen: %1x%2")
|
||||||
|
.arg(screenGeometry.width())
|
||||||
|
.arg(screenGeometry.height());
|
||||||
|
|
||||||
|
ui->resultLabel->setText(info);
|
||||||
|
}
|
||||||
|
FILE_EOF
|
||||||
|
|
||||||
|
cat > "${TARGET_DIR}/main.cpp" <<'FILE_EOF'
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QTextCodec>
|
||||||
|
#include "MainWindow.h"
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
|
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
QApplication a(argc, argv);
|
||||||
|
MainWindow w;
|
||||||
|
w.show();
|
||||||
|
|
||||||
|
return a.exec();
|
||||||
|
}
|
||||||
|
FILE_EOF
|
||||||
|
|
||||||
|
cat > "${TARGET_DIR}/MainWindow.ui" <<'FILE_EOF'
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>MainWindow</class>
|
||||||
|
<widget class="QMainWindow" name="MainWindow">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>420</width>
|
||||||
|
<height>240</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Qt5 Legacy App</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="centralwidget">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Initial text</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit">
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>Enter value like Test123</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="iconLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="buttonLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="validateButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Validate</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="screenButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Screen Info</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="resultLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Result appears here</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
|
FILE_EOF
|
||||||
|
|
||||||
|
cat > "${TARGET_DIR}/resources.qrc" <<'FILE_EOF'
|
||||||
|
<RCC>
|
||||||
|
<qresource prefix="/icons">
|
||||||
|
<file>app.png</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
||||||
|
FILE_EOF
|
||||||
|
|
||||||
|
(
|
||||||
|
cd "${TARGET_DIR}"
|
||||||
|
python3 - <<'FILE_EOF'
|
||||||
|
import base64
|
||||||
|
png = base64.b64decode(
|
||||||
|
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAusB9Wn8nKsAAAAASUVORK5CYII="
|
||||||
|
)
|
||||||
|
with open("app.png", "wb") as f:
|
||||||
|
f.write(png)
|
||||||
|
FILE_EOF
|
||||||
|
)
|
||||||
|
|
||||||
|
echo "Qt5 legacy benchmark created at: ${TARGET_DIR}"
|
||||||
@@ -0,0 +1,119 @@
|
|||||||
|
# GitHub Copilot Repository Instructions: C++ Modernization
|
||||||
|
|
||||||
|
## Project Context
|
||||||
|
- **Language:** C++
|
||||||
|
- **Target Standard:** C++23 (Strict enforcement)
|
||||||
|
- **Migration Goal:** Systematically upgrade legacy C++11/C++14/C++17 code to modern C++23 paradigms.
|
||||||
|
|
||||||
|
## Core Objective
|
||||||
|
Modernize the codebase incrementally and safely. Preserve existing behavior unless the task explicitly requests functional changes. Prefer small, reviewable refactors that improve correctness, safety, readability, and maintainability.
|
||||||
|
|
||||||
|
## Global Migration Principles
|
||||||
|
- Preserve semantics first; modernize second.
|
||||||
|
- Prefer standard C++23 library facilities over custom utilities where equivalent.
|
||||||
|
- Favor compile-time validation, explicit ownership, and strong type safety.
|
||||||
|
- Reduce boilerplate only when readability improves.
|
||||||
|
- Avoid unnecessary churn in code that is already modern and clear.
|
||||||
|
- Keep ABI-sensitive or externally exposed interfaces stable unless breaking changes are explicitly allowed.
|
||||||
|
- For larger migrations, refactor file-by-file or subsystem-by-subsystem.
|
||||||
|
|
||||||
|
## Migration Rules
|
||||||
|
|
||||||
|
### 1. Type Inference & Variables
|
||||||
|
- Replace explicit types with `auto` where the type is obvious from the initializer.
|
||||||
|
- Do not use `auto` when it obscures important type information or changes value/reference semantics unintentionally.
|
||||||
|
- Prefer `const auto` and `const auto&` where appropriate.
|
||||||
|
- Use structured bindings (`auto [x, y] = ...`) instead of `std::tie`, `.first/.second`, or tuple indexing where it improves clarity.
|
||||||
|
- Prefer uniform initialization where appropriate.
|
||||||
|
|
||||||
|
### 2. Memory & Resource Management
|
||||||
|
- Replace raw owning pointers and manual `delete` with `std::unique_ptr` or `std::shared_ptr`.
|
||||||
|
- Prefer `std::unique_ptr` by default; use `std::shared_ptr` only for true shared ownership.
|
||||||
|
- Use `std::make_unique` and `std::make_shared`.
|
||||||
|
- Enforce RAII for all resource management.
|
||||||
|
- Replace manual lifetime management with scoped objects where possible.
|
||||||
|
- Distinguish clearly between owning and non-owning access; prefer references, `std::span`, or observer-style usage for non-owning views.
|
||||||
|
|
||||||
|
### 3. Containers, Views & Strings
|
||||||
|
- Use `std::string_view` for read-only string parameters where lifetime safety is guaranteed.
|
||||||
|
- Never introduce dangling `std::string_view`.
|
||||||
|
- Replace `if (items.find(key) != items.end())` with `if (items.contains(key))` where supported.
|
||||||
|
- Prefer `.starts_with()`, `.ends_with()`, and `.contains()` when they improve readability.
|
||||||
|
- Prefer `std::span` for non-owning contiguous views.
|
||||||
|
- Use `std::mdspan` for multidimensional indexing only where it meaningfully improves safety or clarity.
|
||||||
|
- Prefer standard algorithms and ranges over manual loops when they improve readability and maintainability.
|
||||||
|
- Avoid unnecessary copies; prefer move semantics, `emplace`, and views where safe.
|
||||||
|
|
||||||
|
### 4. Control Flow & Error Handling
|
||||||
|
- Prefer early returns over deep nesting.
|
||||||
|
- Use `[[nodiscard]]` for functions whose return values should not be ignored.
|
||||||
|
- Modernize `std::optional` usage with `.and_then()`, `.transform()`, and `.or_else()` where this makes the logic clearer.
|
||||||
|
- Replace sentinel values with `std::optional`, strong types, or `std::expected` if supported by the project/toolchain.
|
||||||
|
- Preserve existing exception guarantees and error behavior unless changes are explicitly requested.
|
||||||
|
|
||||||
|
### 5. Formatting & Output
|
||||||
|
- Replace `printf` and legacy `<iostream>` console output with `<print>` where toolchain support exists.
|
||||||
|
- Use `std::print` and `std::println` for standard console output.
|
||||||
|
- If `<print>` is unavailable in the project toolchain, note the limitation and prefer the most modern supported alternative.
|
||||||
|
- Do not mix output styles in the same updated code path without a strong reason.
|
||||||
|
|
||||||
|
### 6. Compile-Time Optimization & Templates
|
||||||
|
- Maximize appropriate use of `constexpr`.
|
||||||
|
- Use `consteval` and `constinit` where semantically beneficial.
|
||||||
|
- Replace legacy SFINAE / `std::enable_if` with Concepts and `requires` clauses.
|
||||||
|
- Use `if constexpr` to simplify compile-time branching.
|
||||||
|
- Prefer readable template constraints and diagnostics over complex metaprogramming.
|
||||||
|
|
||||||
|
### 7. API & Interface Modernization
|
||||||
|
- Add `noexcept` where correct and useful.
|
||||||
|
- Use `override` consistently for overridden virtual functions.
|
||||||
|
- Use `final` where appropriate.
|
||||||
|
- Prefer `= default` and `= delete` for special member functions.
|
||||||
|
- Prefer `enum class` over unscoped enums where practical.
|
||||||
|
- Replace output parameters with return values or small result structs where this improves clarity and does not break required interfaces.
|
||||||
|
|
||||||
|
### 8. Concurrency & Time
|
||||||
|
- Prefer modern standard library concurrency primitives.
|
||||||
|
- Use `std::jthread` instead of `std::thread` where automatic joining and cancellation semantics are beneficial.
|
||||||
|
- Prefer typed `std::chrono` durations and literals over raw integer time values.
|
||||||
|
|
||||||
|
## Code Style Enforcement
|
||||||
|
- Avoid C-style macros where `constexpr`, `const`, enums, or inline functions are better.
|
||||||
|
- Never introduce deprecated or removed standard library facilities.
|
||||||
|
- Prefer expressive, self-documenting code over mechanical modernization.
|
||||||
|
- Keep includes minimal and correct.
|
||||||
|
- Avoid hidden lifetime bugs, dangling references, dangling views, and ownership ambiguity.
|
||||||
|
- Preserve repository formatting and local style conventions unless explicitly changing them.
|
||||||
|
|
||||||
|
## Safety Constraints
|
||||||
|
- Do not change business logic unless explicitly requested.
|
||||||
|
- Do not silently alter ownership semantics without calling it out.
|
||||||
|
- Do not replace code with newer constructs if the result is harder to read.
|
||||||
|
- Do not introduce C++23 features that are unsupported by the project compiler/toolchain.
|
||||||
|
- Highlight any modernization that may affect ABI, performance, exception behavior, or object lifetime.
|
||||||
|
|
||||||
|
## Review Checklist
|
||||||
|
For each proposed migration, verify:
|
||||||
|
- Behavior is preserved.
|
||||||
|
- Ownership and lifetime are clearer and safer.
|
||||||
|
- Readability is improved.
|
||||||
|
- Interface compatibility is maintained unless breaking changes are allowed.
|
||||||
|
- C++23 features are applied only where beneficial.
|
||||||
|
- Toolchain compatibility is respected.
|
||||||
|
- Tests and warnings should still pass after the change.
|
||||||
|
|
||||||
|
## Expected Copilot Behavior
|
||||||
|
When modernizing code:
|
||||||
|
1. Start from the existing implementation and refactor incrementally.
|
||||||
|
2. Prefer minimal, reviewable patches over broad rewrites.
|
||||||
|
3. Briefly explain non-trivial modernizations.
|
||||||
|
4. Call out risky or behavior-adjacent changes explicitly.
|
||||||
|
5. Provide optional follow-up refactors separately when they are useful but non-essential.
|
||||||
|
6. Avoid touching unrelated code.
|
||||||
|
|
||||||
|
## Preferred Output Format
|
||||||
|
For each migration task, provide:
|
||||||
|
- the modernized code,
|
||||||
|
- a short rationale,
|
||||||
|
- any compatibility/toolchain caveats,
|
||||||
|
- and optional next-step improvements.tes
|
||||||
@@ -0,0 +1,152 @@
|
|||||||
|
Migrate the legacy Qt5/C++11 desktop application to Qt6/C++23 and validate the migration completely using the repository’s Docker-based CI workflow.
|
||||||
|
|
||||||
|
Operating mode:
|
||||||
|
- Execute the task autonomously from analysis through validation.
|
||||||
|
- Do not stop after code edits; continue until configure, build, tests, and policy checks have been attempted in the CI container workflow.
|
||||||
|
- Do not ask for confirmation between normal implementation steps.
|
||||||
|
- Only stop early if the repository is missing required source material, the task is logically impossible, or a destructive action would be required.
|
||||||
|
|
||||||
|
Project boundaries:
|
||||||
|
- Read the legacy source project from ${PROJECT_DIR}.
|
||||||
|
- Write the migrated project into qt6-after/qt6-migrated-benchmark.
|
||||||
|
- Do not modify the legacy source tree in place.
|
||||||
|
- Keep the migration isolated to the target tree and related CI/build/test files only when necessary.
|
||||||
|
|
||||||
|
Primary migration goals:
|
||||||
|
- Update the build system from Qt5 to Qt6.
|
||||||
|
- Upgrade the language standard from C++11 to C++23.
|
||||||
|
- Keep Qt Core, Gui, and Widgets explicitly linked.
|
||||||
|
- Replace QRegExp with QRegularExpression.
|
||||||
|
- Replace QDesktopWidget and QApplication::desktop() usage with QScreen-based Qt6 APIs.
|
||||||
|
- Remove legacy QTextCodec usage and adopt modern Qt6-safe text handling.
|
||||||
|
- Replace old SIGNAL/SLOT syntax with function-pointer connect syntax.
|
||||||
|
- Replace legacy null pointer literals with nullptr.
|
||||||
|
- Preserve .ui integration.
|
||||||
|
- Preserve .qrc integration.
|
||||||
|
- Preserve application behavior unless a Qt6-compatible adaptation is strictly necessary.
|
||||||
|
|
||||||
|
Testing requirements:
|
||||||
|
- For every code change inside a method, add at least three tests covering the changed behavior.
|
||||||
|
- Place all generated tests in qt6-after/qt6-migrated-benchmark/tests.
|
||||||
|
- Keep test filenames compatible with repository policy checks, for example patterns like:
|
||||||
|
- test_<name>.cpp
|
||||||
|
- <name>_test.cpp
|
||||||
|
- <name>test.cpp
|
||||||
|
- <name>gtest.cpp
|
||||||
|
- Update CMake so the migrated application and all tests are buildable and runnable with CTest.
|
||||||
|
- Ensure tests are actually registered with CTest.
|
||||||
|
|
||||||
|
Container-first build policy:
|
||||||
|
- Use lifemaps/ci-cpp:latest as the authoritative environment for configure, build, test, and policy validation.
|
||||||
|
- Do not rely on host-installed build tools as a substitute for missing container tools.
|
||||||
|
- Execute all validation commands inside Docker using the mounted repository workspace.
|
||||||
|
- Treat Dockerfile.ci as the source of truth for CI dependencies and container tool availability.
|
||||||
|
|
||||||
|
Execution plan:
|
||||||
|
1. Inspect the legacy project under ${PROJECT_DIR}.
|
||||||
|
2. Inspect the target tree qt6-after/qt6-migrated-benchmark.
|
||||||
|
3. Identify all Qt5/C++11 constructs that must be migrated.
|
||||||
|
4. Apply the migration incrementally in the target tree.
|
||||||
|
5. Add or update tests together with each behavior-relevant code change.
|
||||||
|
6. Update CMake and test registration.
|
||||||
|
7. Validate inside the Docker container.
|
||||||
|
8. If validation reveals missing tools inside the container, update Dockerfile.ci, rebuild the image, and rerun validation.
|
||||||
|
9. Repeat until full success or until a genuine project defect remains.
|
||||||
|
|
||||||
|
Mandatory container validation sequence:
|
||||||
|
- Run CMake configure inside lifemaps/ci-cpp:latest.
|
||||||
|
- Run the build inside lifemaps/ci-cpp:latest.
|
||||||
|
- Run tests with CTest inside lifemaps/ci-cpp:latest.
|
||||||
|
- Only if tests succeed, run:
|
||||||
|
python3 ci/check_pr_policies.py
|
||||||
|
inside the same Docker container against the mounted workspace.
|
||||||
|
|
||||||
|
Missing-tool remediation loop:
|
||||||
|
- If configure, build, test, or policy validation fails because a required tool or package is missing in the container:
|
||||||
|
- identify the missing tool precisely
|
||||||
|
- update Dockerfile.ci to install it
|
||||||
|
- rebuild the Docker image
|
||||||
|
- rerun the full validation sequence in the rebuilt image
|
||||||
|
- Do not stop after rebuilding once if another missing dependency appears.
|
||||||
|
- Continue until:
|
||||||
|
- the environment is complete and the next failure is a real project/code issue, or
|
||||||
|
- the entire validation flow succeeds
|
||||||
|
|
||||||
|
Failure classification rules:
|
||||||
|
- Treat these as environment failures:
|
||||||
|
- command not found
|
||||||
|
- missing compiler/toolchain utility
|
||||||
|
- missing Qt development package
|
||||||
|
- missing CMake/Ninja/CTest support tool
|
||||||
|
- missing formatting or git verification dependency needed by ci/check_pr_policies.py
|
||||||
|
- Treat these as project failures:
|
||||||
|
- compile errors in migrated source
|
||||||
|
- linker errors caused by project configuration or code
|
||||||
|
- failing tests
|
||||||
|
- policy check failures caused by formatting, missing tests, or related project issues introduced by the migration
|
||||||
|
|
||||||
|
Policy-check awareness:
|
||||||
|
- The repository policy script checks changed C/C++ files for formatting via clang-format.
|
||||||
|
- The policy script also expects related tests for changed C/C++ files.
|
||||||
|
- The policy script verifies commit signatures in its comparison range.
|
||||||
|
- When running local validation in the container, ensure the workspace and git metadata are available so the script can evaluate diffs properly.
|
||||||
|
- If the script fails because of issues caused by your migration, fix them and rerun validation.
|
||||||
|
- Do not claim policy success unless the script passes.
|
||||||
|
|
||||||
|
Container command expectations:
|
||||||
|
- Use Docker commands that mount the current repository into /workspace or an equivalent work directory.
|
||||||
|
- Run commands from the mounted repository root.
|
||||||
|
- Use explicit configure/build/test commands rather than vague summaries.
|
||||||
|
- Reuse the same image name lifemaps/ci-cpp:latest unless Dockerfile.ci changes require rebuilding that image.
|
||||||
|
|
||||||
|
Recommended validation shape:
|
||||||
|
- Configure:
|
||||||
|
cmake -S qt6-after/qt6-migrated-benchmark -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug
|
||||||
|
- Build:
|
||||||
|
cmake --build build --parallel
|
||||||
|
- Test:
|
||||||
|
ctest --test-dir build --output-on-failure
|
||||||
|
- Policy:
|
||||||
|
python3 ci/check_pr_policies.py
|
||||||
|
- If the repository uses a different build directory or requires additional flags discovered during inspection, adapt accordingly.
|
||||||
|
|
||||||
|
Dockerfile maintenance rules:
|
||||||
|
- If you modify Dockerfile.ci, keep changes minimal and focused on missing CI dependencies.
|
||||||
|
- Do not remove already needed packages without evidence.
|
||||||
|
- After editing Dockerfile.ci, rebuild the CI image before retrying validation.
|
||||||
|
- Use the rebuilt image for all subsequent validation attempts.
|
||||||
|
|
||||||
|
Change reporting requirements:
|
||||||
|
- Briefly explain each migration change.
|
||||||
|
- Group the explanation by:
|
||||||
|
- CMake / build-system migration
|
||||||
|
- Qt API replacements
|
||||||
|
- C++ modernization
|
||||||
|
- UI/resource preservation
|
||||||
|
- tests added
|
||||||
|
- Dockerfile.ci / container updates
|
||||||
|
- Include a concise changed-files summary.
|
||||||
|
|
||||||
|
Completion criteria:
|
||||||
|
- Success requires all of the following:
|
||||||
|
- migrated project exists under qt6-after/qt6-migrated-benchmark
|
||||||
|
- configure succeeds in the Docker container
|
||||||
|
- build succeeds in the Docker container
|
||||||
|
- tests succeed in the Docker container
|
||||||
|
- python3 ci/check_pr_policies.py succeeds in the Docker container after tests pass
|
||||||
|
- If full success is not achieved, continue until the remaining blocker is a genuine project problem rather than a missing CI dependency.
|
||||||
|
|
||||||
|
Final response requirements:
|
||||||
|
- State whether the migration is fully validated or which blocker remains.
|
||||||
|
- List the exact Docker commands used for:
|
||||||
|
- image rebuild
|
||||||
|
- configure
|
||||||
|
- build
|
||||||
|
- test
|
||||||
|
- policy check
|
||||||
|
- For every failed attempt, report:
|
||||||
|
- the exact command
|
||||||
|
- the key error
|
||||||
|
- whether it was an environment issue or a project issue
|
||||||
|
- the fix applied, if any
|
||||||
|
- End with a short summary of what remains, if anything.
|
||||||
Executable
+50
@@ -0,0 +1,50 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
PROJECT_DIR="${1:-qt5-before/qt5-legacy-migration-benchmark}"
|
||||||
|
COPILOT_MODEL="${2:-qwen3.5-397b-a17b}"
|
||||||
|
|
||||||
|
need_cmd() {
|
||||||
|
command -v "$1" >/dev/null 2>&1 || {
|
||||||
|
echo "ERROR: '$1' not found in PATH." >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
need_cmd entire
|
||||||
|
need_cmd copilot
|
||||||
|
need_cmd git
|
||||||
|
|
||||||
|
if ! git rev-parse --show-toplevel >/dev/null 2>&1; then
|
||||||
|
echo "ERROR: Dieses Skript muss innerhalb eines bestehenden Git-Repositories gestartet werden." >&2
|
||||||
|
echo "Bitte zuerst im Repo-Root 'git init' oder in einem bestehenden Repo arbeiten." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
REPO_ROOT="$(git rev-parse --show-toplevel)"
|
||||||
|
cd "$REPO_ROOT"
|
||||||
|
|
||||||
|
if [ ! -d "$PROJECT_DIR" ]; then
|
||||||
|
echo "ERROR: project directory '$PROJECT_DIR' not found relative to repo root '$REPO_ROOT'." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Repo root: $REPO_ROOT"
|
||||||
|
echo "Legacy project: $PROJECT_DIR"
|
||||||
|
echo "Copilot model: $COPILOT_MODEL"
|
||||||
|
|
||||||
|
entire agent add copilot-cli
|
||||||
|
entire status
|
||||||
|
|
||||||
|
git add .
|
||||||
|
if git diff --cached --quiet; then
|
||||||
|
git commit --allow-empty -m "baseline: Qt5/C++11 legacy benchmark before Qt6/C++23 migration"
|
||||||
|
else
|
||||||
|
git commit -m "baseline: Qt5/C++11 legacy benchmark before Qt6/C++23 migration"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "== Checkpoints vor der Session =="
|
||||||
|
entire checkpoint list
|
||||||
|
|
||||||
|
envsubst < scripts/migration.prompt
|
||||||
Executable
+34
@@ -0,0 +1,34 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
PROJECT_DIR="${1:-qt5-before/qt5-legacy-migration-benchmark}"
|
||||||
|
COPILOT_MODEL="${2:-qwen3.5-397b-a17b}"
|
||||||
|
|
||||||
|
need_cmd() {
|
||||||
|
command -v "$1" >/dev/null 2>&1 || {
|
||||||
|
echo "ERROR: '$1' not found in PATH." >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
need_cmd entire
|
||||||
|
need_cmd copilot
|
||||||
|
need_cmd git
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "== Git status after Copilot session =="
|
||||||
|
git status --short
|
||||||
|
|
||||||
|
git add .
|
||||||
|
|
||||||
|
if git diff --cached --quiet; then
|
||||||
|
echo "No changes to commit."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
git commit -m "migrate: Qt5/C++11 app to Qt6/C++23 with tests and modern Qt APIs"
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "== Checkpoints nach der Session =="
|
||||||
|
entire checkpoint list
|
||||||
|
entire checkpoint explain HEAD || true
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
PROJECT_DIR="${1:-qt5-before/qt5-legacy-migration-benchmark}"
|
||||||
|
COPILOT_MODEL="${2:-qwen3.5-397b-a17b}"
|
||||||
|
|
||||||
|
need_cmd() {
|
||||||
|
command -v "$1" >/dev/null 2>&1 || {
|
||||||
|
echo "ERROR: '$1' not found in PATH." >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
need_cmd entire
|
||||||
|
need_cmd copilot
|
||||||
|
need_cmd git
|
||||||
|
|
||||||
|
if ! git rev-parse --show-toplevel >/dev/null 2>&1; then
|
||||||
|
echo "ERROR: Dieses Skript muss innerhalb eines bestehenden Git-Repositories gestartet werden." >&2
|
||||||
|
echo "Bitte zuerst im Repo-Root 'git init' oder in einem bestehenden Repo arbeiten." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
REPO_ROOT="$(git rev-parse --show-toplevel)"
|
||||||
|
cd "$REPO_ROOT"
|
||||||
|
|
||||||
|
if [ ! -d "$PROJECT_DIR" ]; then
|
||||||
|
echo "ERROR: project directory '$PROJECT_DIR' not found relative to repo root '$REPO_ROOT'." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Repo root: $REPO_ROOT"
|
||||||
|
echo "Legacy project: $PROJECT_DIR"
|
||||||
|
echo "Copilot model: $COPILOT_MODEL"
|
||||||
|
|
||||||
|
entire agent add copilot-cli
|
||||||
|
entire status
|
||||||
|
|
||||||
|
git add .
|
||||||
|
if git diff --cached --quiet; then
|
||||||
|
git commit --allow-empty -m "baseline: Qt5/C++11 legacy benchmark before Qt6/C++23 migration"
|
||||||
|
else
|
||||||
|
git commit -m "baseline: Qt5/C++11 legacy benchmark before Qt6/C++23 migration"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "== Checkpoints vor der Session =="
|
||||||
|
entire checkpoint list
|
||||||
|
|
||||||
|
envsubst < scripts/migration.prompt | copilot --model "${COPILOT_MODEL}"
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "== Git status after Copilot session =="
|
||||||
|
git status --short
|
||||||
|
git add .
|
||||||
|
|
||||||
|
if git diff --cached --quiet; then
|
||||||
|
echo "No changes to commit."
|
||||||
|
else
|
||||||
|
git commit -m "migrate: Qt5/C++11 app to Qt6/C++23 with tests and modern Qt APIs"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "== Checkpoints nach der Session =="
|
||||||
|
entire checkpoint list
|
||||||
|
entire checkpoint explain HEAD || true
|
||||||
|
|
||||||
|
read -r -p "Optional Rewind testen? [y/N] " DO_REWIND
|
||||||
|
if [[ "${DO_REWIND:-N}" =~ ^[Yy]$ ]]; then
|
||||||
|
if ! entire checkpoint rewind; then
|
||||||
|
echo "WARN: rewind not supported or failed."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
read -r -p "Optional Session-Resume-Hinweis ausgeben? [y/N] " DO_RESUME
|
||||||
|
if [[ "${DO_RESUME:-N}" =~ ^[Yy]$ ]]; then
|
||||||
|
CURRENT_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
|
||||||
|
if ! entire session resume "${CURRENT_BRANCH}"; then
|
||||||
|
echo "WARN: resume not supported or failed."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
Executable
+68
@@ -0,0 +1,68 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
PROJECT_DIR="${1:-qt5-before/qt5-legacy-migration-benchmark}"
|
||||||
|
COPILOT_MODEL="${2:-qwen3.5-397b-a17b}"
|
||||||
|
|
||||||
|
need_cmd() {
|
||||||
|
command -v "$1" >/dev/null 2>&1 || {
|
||||||
|
echo "ERROR: '$1' not found in PATH." >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
need_cmd entire
|
||||||
|
need_cmd copilot
|
||||||
|
need_cmd git
|
||||||
|
|
||||||
|
if ! git rev-parse --show-toplevel >/dev/null 2>&1; then
|
||||||
|
echo "ERROR: Dieses Skript muss innerhalb eines bestehenden Git-Repositories gestartet werden." >&2
|
||||||
|
echo "Bitte zuerst im Repo-Root 'git init' oder in einem bestehenden Repo arbeiten." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
REPO_ROOT="$(git rev-parse --show-toplevel)"
|
||||||
|
cd "$REPO_ROOT"
|
||||||
|
|
||||||
|
if [ ! -d "$PROJECT_DIR" ]; then
|
||||||
|
echo "ERROR: project directory '$PROJECT_DIR' not found relative to repo root '$REPO_ROOT'." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Repo root: $REPO_ROOT"
|
||||||
|
echo "Legacy project: $PROJECT_DIR"
|
||||||
|
echo "Copilot model: $COPILOT_MODEL"
|
||||||
|
|
||||||
|
entire agent add copilot-cli
|
||||||
|
entire status
|
||||||
|
|
||||||
|
git add .
|
||||||
|
if git diff --cached --quiet; then
|
||||||
|
git commit --allow-empty -m "baseline: Qt5/C++11 legacy benchmark before Qt6/C++23 migration"
|
||||||
|
else
|
||||||
|
git commit -m "baseline: Qt5/C++11 legacy benchmark before Qt6/C++23 migration"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "== Checkpoints vor der Session =="
|
||||||
|
entire checkpoint list
|
||||||
|
|
||||||
|
envsubst < scripts/migration.prompt | copilot --model "${COPILOT_MODEL}"
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "== Git status after Copilot session =="
|
||||||
|
git status --short
|
||||||
|
|
||||||
|
git add .
|
||||||
|
|
||||||
|
if git diff --cached --quiet; then
|
||||||
|
echo "No changes to commit."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
git commit -m "migrate: Qt5/C++11 app to Qt6/C++23 with tests and modern Qt APIs"
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "== Checkpoints nach der Session =="
|
||||||
|
entire checkpoint list
|
||||||
|
entire checkpoint explain HEAD || true
|
||||||
Executable
+149
@@ -0,0 +1,149 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
red() { printf "\033[31m%s\033[0m\n" "$*"; }
|
||||||
|
green() { printf "\033[32m%s\033[0m\n" "$*"; }
|
||||||
|
yellow() { printf "\033[33m%s\033[0m\n" "$*"; }
|
||||||
|
blue() { printf "\033[34m%s\033[0m\n" "$*"; }
|
||||||
|
|
||||||
|
fail() {
|
||||||
|
red "FEHLER: $*"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
check_cmd() {
|
||||||
|
command -v "$1" >/dev/null 2>&1 || fail "'$1' nicht gefunden"
|
||||||
|
}
|
||||||
|
|
||||||
|
mask() {
|
||||||
|
local s="${1:-}"
|
||||||
|
local n=${#s}
|
||||||
|
if [ "$n" -le 8 ]; then
|
||||||
|
printf '********'
|
||||||
|
else
|
||||||
|
printf '%s****%s' "${s:0:4}" "${s: -4}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
check_env() {
|
||||||
|
[ -n "${COPILOT_PROVIDER_TYPE:-}" ] || fail "COPILOT_PROVIDER_TYPE fehlt"
|
||||||
|
[ -n "${COPILOT_PROVIDER_API_KEY:-}" ] || fail "COPILOT_PROVIDER_API_KEY fehlt"
|
||||||
|
[ -n "${COPILOT_PROVIDER_BASE_URL:-}" ] || fail "COPILOT_PROVIDER_BASE_URL fehlt"
|
||||||
|
[ -n "${COPILOT_MODEL:-}" ] || fail "COPILOT_MODEL fehlt"
|
||||||
|
}
|
||||||
|
|
||||||
|
print_env_summary() {
|
||||||
|
blue "== Konfiguration =="
|
||||||
|
echo "Provider : ${COPILOT_PROVIDER_TYPE}"
|
||||||
|
echo "Base URL : ${COPILOT_PROVIDER_BASE_URL}"
|
||||||
|
echo "Modell : ${COPILOT_MODEL}"
|
||||||
|
echo "API Key : $(mask "${COPILOT_PROVIDER_API_KEY}")"
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
probe_models() {
|
||||||
|
blue "== Prüfe Models-Endpoint =="
|
||||||
|
local models_url="${COPILOT_PROVIDER_BASE_URL%/}/models"
|
||||||
|
|
||||||
|
local http_code
|
||||||
|
http_code="$(curl -sS -o /tmp/copilot_models_probe.json \
|
||||||
|
-w "%{http_code}" \
|
||||||
|
-H "Authorization: Bearer ${COPILOT_PROVIDER_API_KEY}" \
|
||||||
|
"$models_url" || true)"
|
||||||
|
|
||||||
|
echo "GET $models_url"
|
||||||
|
echo "HTTP $http_code"
|
||||||
|
|
||||||
|
if [ "$http_code" = "200" ]; then
|
||||||
|
green "Models-Endpoint erreichbar"
|
||||||
|
if command -v jq >/dev/null 2>&1; then
|
||||||
|
echo
|
||||||
|
yellow "Gefundene Modelle (erste 20):"
|
||||||
|
jq -r '
|
||||||
|
if .data then .data[]?.id
|
||||||
|
elif type=="array" then .[]?.id
|
||||||
|
else empty end
|
||||||
|
' /tmp/copilot_models_probe.json | head -20
|
||||||
|
echo
|
||||||
|
if jq -e --arg model "${COPILOT_MODEL}" '
|
||||||
|
if .data then any(.data[]?; .id == $model)
|
||||||
|
elif type=="array" then any(.[]?; .id == $model)
|
||||||
|
else false end
|
||||||
|
' /tmp/copilot_models_probe.json >/dev/null 2>&1; then
|
||||||
|
green "Modell '${COPILOT_MODEL}' im Models-Endpoint gefunden"
|
||||||
|
else
|
||||||
|
yellow "Modell '${COPILOT_MODEL}' nicht eindeutig im Models-Endpoint gefunden"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
yellow "jq nicht installiert; JSON-Antwort nicht geparst"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
red "Models-Endpoint nicht erfolgreich erreichbar"
|
||||||
|
echo
|
||||||
|
sed -n '1,120p' /tmp/copilot_models_probe.json || true
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
probe_chat() {
|
||||||
|
blue "== Prüfe Chat-Completions minimal =="
|
||||||
|
local chat_url="${COPILOT_PROVIDER_BASE_URL%/}/chat/completions"
|
||||||
|
|
||||||
|
cat >/tmp/copilot_chat_probe.json <<JSON
|
||||||
|
{
|
||||||
|
"model": "${COPILOT_MODEL}",
|
||||||
|
"messages": [
|
||||||
|
{ "role": "user", "content": "Reply with exactly: OK" }
|
||||||
|
],
|
||||||
|
"stream": false
|
||||||
|
}
|
||||||
|
JSON
|
||||||
|
|
||||||
|
local http_code
|
||||||
|
http_code="$(curl -sS -o /tmp/copilot_chat_probe_response.json \
|
||||||
|
-w "%{http_code}" \
|
||||||
|
-H "Authorization: Bearer ${COPILOT_PROVIDER_API_KEY}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d @/tmp/copilot_chat_probe.json \
|
||||||
|
"$chat_url" || true)"
|
||||||
|
|
||||||
|
echo "POST $chat_url"
|
||||||
|
echo "HTTP $http_code"
|
||||||
|
|
||||||
|
if [ "$http_code" = "200" ]; then
|
||||||
|
green "Chat-Completions funktioniert"
|
||||||
|
if command -v jq >/dev/null 2>&1; then
|
||||||
|
echo
|
||||||
|
yellow "Antwortauszug:"
|
||||||
|
jq -r '.choices[0].message.content // .choices[0].delta.content // "keine textantwort gefunden"' \
|
||||||
|
/tmp/copilot_chat_probe_response.json
|
||||||
|
echo
|
||||||
|
else
|
||||||
|
sed -n '1,80p' /tmp/copilot_chat_probe_response.json || true
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
red "Chat-Completions fehlgeschlagen"
|
||||||
|
echo
|
||||||
|
sed -n '1,160p' /tmp/copilot_chat_probe_response.json || true
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
run_copilot() {
|
||||||
|
blue "== Starte Copilot CLI =="
|
||||||
|
exec copilot "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
check_cmd curl
|
||||||
|
check_cmd copilot
|
||||||
|
check_env
|
||||||
|
print_env_summary
|
||||||
|
probe_models
|
||||||
|
echo
|
||||||
|
probe_chat
|
||||||
|
echo
|
||||||
|
run_copilot "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
Reference in new issue
Block a user