Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

step-01-preflight.md 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. ---
  2. name: 'step-01-preflight'
  3. description: 'Verify prerequisites and detect CI platform'
  4. nextStepFile: '{skill-root}/steps-c/step-02-generate-pipeline.md'
  5. outputFile: '{test_artifacts}/ci-pipeline-progress.md'
  6. ---
  7. # Step 1: Preflight Checks
  8. ## STEP GOAL
  9. Verify CI prerequisites and determine target CI platform.
  10. ## MANDATORY EXECUTION RULES
  11. - 📖 Read the entire step file before acting
  12. - ✅ Speak in `{communication_language}`
  13. - 🚫 Halt if requirements fail
  14. ---
  15. ## EXECUTION PROTOCOLS:
  16. - 🎯 Follow the MANDATORY SEQUENCE exactly
  17. - 💾 Record outputs before proceeding
  18. - 📖 Load the next step only when instructed
  19. ## CONTEXT BOUNDARIES:
  20. - Available context: config, loaded artifacts, and knowledge fragments
  21. - Focus: this step's goal only
  22. - Limits: do not execute future steps
  23. - Dependencies: prior steps' outputs (if any)
  24. ## MANDATORY SEQUENCE
  25. **CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise.
  26. ## 1. Verify Git Repository
  27. - `.git/` exists
  28. - Remote configured (if available)
  29. If missing: **HALT** with "Git repository required for CI/CD setup."
  30. ---
  31. ## 2. Detect Test Stack Type
  32. Determine the project's test stack type (`test_stack_type`) using the following algorithm:
  33. 1. If `test_stack_type` is explicitly set in config (not `"auto"`), use that value.
  34. 2. Otherwise, auto-detect by scanning project manifests:
  35. - **Frontend indicators**: `playwright.config.*`, `cypress.config.*`, `vite.config.*`, `next.config.*`, `src/components/`, `src/pages/`, `src/app/`
  36. - **Backend indicators**: `pyproject.toml`, `pom.xml`/`build.gradle`, `go.mod`, `*.csproj`/`*.sln`, `Gemfile`, `Cargo.toml`, `jest.config.*`, `vitest.config.*`, `src/routes/`, `src/controllers/`, `src/api/`, `Dockerfile`, `serverless.yml`
  37. - **Both present** → `fullstack`
  38. - **Only frontend** → `frontend`
  39. - **Only backend** → `backend`
  40. - **Cannot determine** → default to `fullstack` and note assumption
  41. Record detected `test_stack_type` in step output.
  42. ---
  43. ## 3. Verify Test Framework
  44. - Check for framework configuration based on detected stack:
  45. - **Frontend/Fullstack**: `playwright.config.*` or `cypress.config.*` exists
  46. - **Backend (Node.js)**: `jest.config.*` or `vitest.config.*` or test scripts in `package.json`
  47. - **Backend (Python)**: `pyproject.toml` with `[tool.pytest]` or `pytest.ini` or `setup.cfg` with pytest config
  48. - **Backend (Java/Kotlin)**: `pom.xml` with surefire/failsafe plugins or `build.gradle` with test task
  49. - **Backend (Go)**: `*_test.go` files present (Go convention — no config file needed)
  50. - **Backend (C#/.NET)**: `*.csproj` with xUnit/NUnit/MSTest references
  51. - **Backend (Ruby)**: `Gemfile` with rspec or `.rspec` config file
  52. - If `test_framework` is `"auto"`, detect from config files and project manifests found
  53. - Verify test dependencies are installed (language-appropriate package manager)
  54. If missing: **HALT** with "Run `framework` workflow first."
  55. ---
  56. ## 4. Ensure Tests Pass Locally
  57. - Run the main test command based on detected stack and framework:
  58. - **Node.js**: `npm test` or `npm run test:e2e`
  59. - **Python**: `pytest` or `python -m pytest`
  60. - **Java**: `mvn test` or `gradle test`
  61. - **Go**: `go test ./...`
  62. - **C#/.NET**: `dotnet test`
  63. - **Ruby**: `bundle exec rspec`
  64. - If failing: **HALT** and request fixes before CI setup
  65. ---
  66. ## 5. Detect CI Platform
  67. - If `ci_platform` is explicitly set in config (not `"auto"`), use that value.
  68. - Otherwise, scan for existing CI configuration files:
  69. - `.github/workflows/*.yml` → `github-actions`
  70. - `.gitlab-ci.yml` → `gitlab-ci`
  71. - `Jenkinsfile` → `jenkins`
  72. - `azure-pipelines.yml` → `azure-devops`
  73. - `.harness/*.yaml` → `harness`
  74. - `.circleci/config.yml` → `circle-ci`
  75. - If found, ask whether to update or replace
  76. - If not found, infer from git remote (github.com → `github-actions`, gitlab.com → `gitlab-ci`)
  77. - If still unresolved, default to `github-actions`
  78. Record detected `ci_platform` in step output.
  79. ---
  80. ## 6. Read Environment Context
  81. - Read environment context based on detected stack:
  82. - **Node.js**: Read `.nvmrc` if present (default to Node 24+ LTS if missing); read `package.json` for dependency caching strategy
  83. - **Python**: Read `.python-version` or `pyproject.toml` for Python version; note `pip`/`poetry`/`pipenv` for caching
  84. - **Java**: Read `pom.xml`/`build.gradle` for Java version; note Maven/Gradle for caching
  85. - **Go**: Read `go.mod` for Go version; note Go module cache path
  86. - **C#/.NET**: Read `*.csproj`/`global.json` for .NET SDK version; note NuGet cache
  87. - **Ruby**: Read `.ruby-version` or `Gemfile` for Ruby version; note Bundler cache
  88. ---
  89. ### 7. Save Progress
  90. **Save this step's accumulated work to `{outputFile}`.**
  91. - **If `{outputFile}` does not exist** (first save), create it with YAML frontmatter:
  92. ```yaml
  93. ---
  94. stepsCompleted: ['step-01-preflight']
  95. lastStep: 'step-01-preflight'
  96. lastSaved: '{date}'
  97. ---
  98. ```
  99. Then write this step's output below the frontmatter.
  100. - **If `{outputFile}` already exists**, update:
  101. - Add `'step-01-preflight'` to `stepsCompleted` array (only if not already present)
  102. - Set `lastStep: 'step-01-preflight'`
  103. - Set `lastSaved: '{date}'`
  104. - Append this step's output to the appropriate section of the document.
  105. Load next step: `{nextStepFile}`
  106. ## 🚨 SYSTEM SUCCESS/FAILURE METRICS:
  107. ### ✅ SUCCESS:
  108. - Step completed in full with required outputs
  109. ### ❌ SYSTEM FAILURE:
  110. - Skipped sequence steps or missing outputs
  111. **Master Rule:** Skipping steps is FORBIDDEN.