feat: initial commit

This commit is contained in:
2026-08-29 13:17:59 +02:00
commit 142f5f5759
91 changed files with 6155 additions and 0 deletions
+98
View File
@@ -0,0 +1,98 @@
# Szablon do włączenia w repozytorium docelowym:
#
# include:
# - project: 'pubi/agentic-codemod-pipeline'
# ref: 'v0.1.0'
# file: '/.gitlab/ci/agentic-codemod.template.yml'
# inputs:
# image: 'registry.internal/pubi/agentic-codemod:0.1.0'
# target_branch: 'main'
#
# Szablon dodaje trzy joby: przygotowanie kontekstu APM, plan (bez zmian w kodzie)
# oraz wdrożenie zmian za bramką manualną.
spec:
inputs:
image:
default: "registry.internal/pubi/agentic-codemod:0.1.0"
description: "Obraz runnera z zainstalowanym agentic-codemod i APM CLI"
stage_context:
default: "prepare"
stage_plan:
default: "plan"
stage_apply:
default: "apply"
target_branch:
default: "main"
description: "Gałąź docelowa merge requesta"
apm_root:
default: "."
description: "Katalog z apm.yml i .apm/ (kontekst agentowy)"
---
.codemod-base:
image: $[[ inputs.image ]]
variables:
GIT_DEPTH: "0"
CODEMOD_RUN_DIR: "$CI_PROJECT_DIR/.runs/$CI_PIPELINE_ID"
CODEMOD_APM_ROOT: $[[ inputs.apm_root ]]
before_script:
- git config --global --add safe.directory "$CI_PROJECT_DIR"
artifacts:
when: always
expire_in: 90 days
paths:
- .runs/
codemod:context:
extends: .codemod-base
stage: $[[ inputs.stage_context ]]
script:
# Kontekst agentowy jest zależnością jak każda inna: instalowany z pinów, audytowany,
# a lockfile ląduje w artefaktach jako dowód, co dokładnie dostał model.
- apm install
- apm audit
- agentic-codemod context --apm-root "$CODEMOD_APM_ROOT" --json | tee .runs/apm-context.json
artifacts:
when: always
expire_in: 90 days
paths:
- apm_modules/
- apm.lock.yaml
- .runs/
reports:
dotenv: []
codemod:plan:
extends: .codemod-base
stage: $[[ inputs.stage_plan ]]
needs: ["codemod:context"]
script:
- |
agentic-codemod run \
--repo "$CI_PROJECT_DIR" --in-place --plan-only \
--package "$CODEMOD_PACKAGE" --to-version "$CODEMOD_TO_VERSION" \
--module "${CODEMOD_MODULE:-}" --constraints "${CODEMOD_CONSTRAINTS:-}" \
--run-dir "$CODEMOD_RUN_DIR"
rules:
- if: '$CODEMOD_PACKAGE'
codemod:apply:
extends: .codemod-base
stage: $[[ inputs.stage_apply ]]
needs: ["codemod:plan"]
# Bramka człowieka przed jakąkolwiek modyfikacją kodu i przed utworzeniem MR.
# Świadomie NIE automatyzujemy tego kroku - podpis pod zmianą ma mieć właściciela.
when: manual
allow_failure: false
script:
- |
agentic-codemod run \
--repo "$CI_PROJECT_DIR" --in-place --publish \
--package "$CODEMOD_PACKAGE" --to-version "$CODEMOD_TO_VERSION" \
--module "${CODEMOD_MODULE:-}" --constraints "${CODEMOD_CONSTRAINTS:-}" \
--issue "${CODEMOD_ISSUE:-}" \
--target-branch $[[ inputs.target_branch ]] \
--run-dir "$CODEMOD_RUN_DIR"
rules:
- if: '$CODEMOD_PACKAGE'