@hivehub/rulebook 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +191 -0
- package/README.md +539 -0
- package/dist/agents/claude-code.d.ts +69 -0
- package/dist/agents/claude-code.d.ts.map +1 -0
- package/dist/agents/claude-code.js +180 -0
- package/dist/agents/claude-code.js.map +1 -0
- package/dist/agents/cursor-agent.d.ts +184 -0
- package/dist/agents/cursor-agent.d.ts.map +1 -0
- package/dist/agents/cursor-agent.js +299 -0
- package/dist/agents/cursor-agent.js.map +1 -0
- package/dist/agents/gemini-cli.d.ts +69 -0
- package/dist/agents/gemini-cli.d.ts.map +1 -0
- package/dist/agents/gemini-cli.js +180 -0
- package/dist/agents/gemini-cli.js.map +1 -0
- package/dist/cli/commands.d.ts +57 -0
- package/dist/cli/commands.d.ts.map +1 -0
- package/dist/cli/commands.js +1370 -0
- package/dist/cli/commands.js.map +1 -0
- package/dist/cli/docs-prompts.d.ts +3 -0
- package/dist/cli/docs-prompts.d.ts.map +1 -0
- package/dist/cli/docs-prompts.js +45 -0
- package/dist/cli/docs-prompts.js.map +1 -0
- package/dist/cli/prompts.d.ts +6 -0
- package/dist/cli/prompts.d.ts.map +1 -0
- package/dist/cli/prompts.js +376 -0
- package/dist/cli/prompts.js.map +1 -0
- package/dist/core/agent-manager.d.ts +89 -0
- package/dist/core/agent-manager.d.ts.map +1 -0
- package/dist/core/agent-manager.js +546 -0
- package/dist/core/agent-manager.js.map +1 -0
- package/dist/core/auto-fixer.d.ts +14 -0
- package/dist/core/auto-fixer.d.ts.map +1 -0
- package/dist/core/auto-fixer.js +207 -0
- package/dist/core/auto-fixer.js.map +1 -0
- package/dist/core/changelog-generator.d.ts +44 -0
- package/dist/core/changelog-generator.d.ts.map +1 -0
- package/dist/core/changelog-generator.js +222 -0
- package/dist/core/changelog-generator.js.map +1 -0
- package/dist/core/cli-bridge.d.ts +113 -0
- package/dist/core/cli-bridge.d.ts.map +1 -0
- package/dist/core/cli-bridge.js +1094 -0
- package/dist/core/cli-bridge.js.map +1 -0
- package/dist/core/config-manager.d.ts +65 -0
- package/dist/core/config-manager.d.ts.map +1 -0
- package/dist/core/config-manager.js +266 -0
- package/dist/core/config-manager.js.map +1 -0
- package/dist/core/coverage-checker.d.ts +14 -0
- package/dist/core/coverage-checker.d.ts.map +1 -0
- package/dist/core/coverage-checker.js +176 -0
- package/dist/core/coverage-checker.js.map +1 -0
- package/dist/core/custom-templates.d.ts +27 -0
- package/dist/core/custom-templates.d.ts.map +1 -0
- package/dist/core/custom-templates.js +122 -0
- package/dist/core/custom-templates.js.map +1 -0
- package/dist/core/dependency-checker.d.ts +21 -0
- package/dist/core/dependency-checker.d.ts.map +1 -0
- package/dist/core/dependency-checker.js +247 -0
- package/dist/core/dependency-checker.js.map +1 -0
- package/dist/core/detector.d.ts +3 -0
- package/dist/core/detector.d.ts.map +1 -0
- package/dist/core/detector.js +1443 -0
- package/dist/core/detector.js.map +1 -0
- package/dist/core/docs-generator.d.ts +9 -0
- package/dist/core/docs-generator.d.ts.map +1 -0
- package/dist/core/docs-generator.js +531 -0
- package/dist/core/docs-generator.js.map +1 -0
- package/dist/core/generator.d.ts +16 -0
- package/dist/core/generator.d.ts.map +1 -0
- package/dist/core/generator.js +561 -0
- package/dist/core/generator.js.map +1 -0
- package/dist/core/gitignore-generator.d.ts +13 -0
- package/dist/core/gitignore-generator.d.ts.map +1 -0
- package/dist/core/gitignore-generator.js +307 -0
- package/dist/core/gitignore-generator.js.map +1 -0
- package/dist/core/health-scorer.d.ts +22 -0
- package/dist/core/health-scorer.d.ts.map +1 -0
- package/dist/core/health-scorer.js +395 -0
- package/dist/core/health-scorer.js.map +1 -0
- package/dist/core/logger.d.ts +116 -0
- package/dist/core/logger.d.ts.map +1 -0
- package/dist/core/logger.js +289 -0
- package/dist/core/logger.js.map +1 -0
- package/dist/core/merger.d.ts +6 -0
- package/dist/core/merger.d.ts.map +1 -0
- package/dist/core/merger.js +131 -0
- package/dist/core/merger.js.map +1 -0
- package/dist/core/migrator.d.ts +19 -0
- package/dist/core/migrator.d.ts.map +1 -0
- package/dist/core/migrator.js +102 -0
- package/dist/core/migrator.js.map +1 -0
- package/dist/core/minimal-scaffolder.d.ts +8 -0
- package/dist/core/minimal-scaffolder.d.ts.map +1 -0
- package/dist/core/minimal-scaffolder.js +51 -0
- package/dist/core/minimal-scaffolder.js.map +1 -0
- package/dist/core/modern-console-new.d.ts +81 -0
- package/dist/core/modern-console-new.d.ts.map +1 -0
- package/dist/core/modern-console-new.js +340 -0
- package/dist/core/modern-console-new.js.map +1 -0
- package/dist/core/modern-console.d.ts +99 -0
- package/dist/core/modern-console.d.ts.map +1 -0
- package/dist/core/modern-console.js +568 -0
- package/dist/core/modern-console.js.map +1 -0
- package/dist/core/openspec-manager.d.ts +133 -0
- package/dist/core/openspec-manager.d.ts.map +1 -0
- package/dist/core/openspec-manager.js +605 -0
- package/dist/core/openspec-manager.js.map +1 -0
- package/dist/core/openspec-migrator.d.ts +27 -0
- package/dist/core/openspec-migrator.d.ts.map +1 -0
- package/dist/core/openspec-migrator.js +255 -0
- package/dist/core/openspec-migrator.js.map +1 -0
- package/dist/core/task-manager.d.ts +65 -0
- package/dist/core/task-manager.d.ts.map +1 -0
- package/dist/core/task-manager.js +318 -0
- package/dist/core/task-manager.js.map +1 -0
- package/dist/core/test-task-manager.d.ts +49 -0
- package/dist/core/test-task-manager.d.ts.map +1 -0
- package/dist/core/test-task-manager.js +121 -0
- package/dist/core/test-task-manager.js.map +1 -0
- package/dist/core/validator.d.ts +21 -0
- package/dist/core/validator.d.ts.map +1 -0
- package/dist/core/validator.js +177 -0
- package/dist/core/validator.js.map +1 -0
- package/dist/core/version-bumper.d.ts +19 -0
- package/dist/core/version-bumper.d.ts.map +1 -0
- package/dist/core/version-bumper.js +180 -0
- package/dist/core/version-bumper.js.map +1 -0
- package/dist/core/watcher.d.ts +9 -0
- package/dist/core/watcher.d.ts.map +1 -0
- package/dist/core/watcher.js +22 -0
- package/dist/core/watcher.js.map +1 -0
- package/dist/core/workflow-generator.d.ts +10 -0
- package/dist/core/workflow-generator.d.ts.map +1 -0
- package/dist/core/workflow-generator.js +279 -0
- package/dist/core/workflow-generator.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +159 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/handlers/archive-task.d.ts +17 -0
- package/dist/mcp/handlers/archive-task.d.ts.map +1 -0
- package/dist/mcp/handlers/archive-task.js +36 -0
- package/dist/mcp/handlers/archive-task.js.map +1 -0
- package/dist/mcp/handlers/create-task.d.ts +17 -0
- package/dist/mcp/handlers/create-task.d.ts.map +1 -0
- package/dist/mcp/handlers/create-task.js +56 -0
- package/dist/mcp/handlers/create-task.js.map +1 -0
- package/dist/mcp/handlers/list-tasks.d.ts +22 -0
- package/dist/mcp/handlers/list-tasks.d.ts.map +1 -0
- package/dist/mcp/handlers/list-tasks.js +42 -0
- package/dist/mcp/handlers/list-tasks.js.map +1 -0
- package/dist/mcp/handlers/show-task.d.ts +25 -0
- package/dist/mcp/handlers/show-task.d.ts.map +1 -0
- package/dist/mcp/handlers/show-task.js +43 -0
- package/dist/mcp/handlers/show-task.js.map +1 -0
- package/dist/mcp/handlers/update-task.d.ts +17 -0
- package/dist/mcp/handlers/update-task.d.ts.map +1 -0
- package/dist/mcp/handlers/update-task.js +35 -0
- package/dist/mcp/handlers/update-task.js.map +1 -0
- package/dist/mcp/handlers/validate-task.d.ts +15 -0
- package/dist/mcp/handlers/validate-task.d.ts.map +1 -0
- package/dist/mcp/handlers/validate-task.js +27 -0
- package/dist/mcp/handlers/validate-task.js.map +1 -0
- package/dist/mcp/rulebook-config.d.ts +22 -0
- package/dist/mcp/rulebook-config.d.ts.map +1 -0
- package/dist/mcp/rulebook-config.js +65 -0
- package/dist/mcp/rulebook-config.js.map +1 -0
- package/dist/mcp/rulebook-server.d.ts +4 -0
- package/dist/mcp/rulebook-server.d.ts.map +1 -0
- package/dist/mcp/rulebook-server.js +246 -0
- package/dist/mcp/rulebook-server.js.map +1 -0
- package/dist/types.d.ts +190 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/file-system.d.ts +9 -0
- package/dist/utils/file-system.d.ts.map +1 -0
- package/dist/utils/file-system.js +51 -0
- package/dist/utils/file-system.js.map +1 -0
- package/dist/utils/git-hooks.d.ts +8 -0
- package/dist/utils/git-hooks.d.ts.map +1 -0
- package/dist/utils/git-hooks.js +440 -0
- package/dist/utils/git-hooks.js.map +1 -0
- package/dist/utils/rulesignore.d.ts +9 -0
- package/dist/utils/rulesignore.d.ts.map +1 -0
- package/dist/utils/rulesignore.js +42 -0
- package/dist/utils/rulesignore.js.map +1 -0
- package/package.json +106 -0
- package/templates/cli/AIDER.md +49 -0
- package/templates/cli/AMAZON_Q.md +25 -0
- package/templates/cli/AUGGIE.md +32 -0
- package/templates/cli/CLAUDE.md +32 -0
- package/templates/cli/CLAUDE_CODE.md +35 -0
- package/templates/cli/CLINE.md +32 -0
- package/templates/cli/CODEBUDDY.md +20 -0
- package/templates/cli/CODEIUM.md +20 -0
- package/templates/cli/CODEX.md +21 -0
- package/templates/cli/CONTINUE.md +34 -0
- package/templates/cli/CURSOR_CLI.md +28 -0
- package/templates/cli/FACTORY.md +18 -0
- package/templates/cli/GEMINI.md +35 -0
- package/templates/cli/KILOCODE.md +18 -0
- package/templates/cli/OPENCODE.md +18 -0
- package/templates/cli/_GENERIC_TEMPLATE.md +29 -0
- package/templates/commands/rulebook-task-apply.md +67 -0
- package/templates/commands/rulebook-task-archive.md +70 -0
- package/templates/commands/rulebook-task-create.md +93 -0
- package/templates/commands/rulebook-task-list.md +42 -0
- package/templates/commands/rulebook-task-show.md +52 -0
- package/templates/commands/rulebook-task-validate.md +53 -0
- package/templates/core/AGENT_AUTOMATION.md +184 -0
- package/templates/core/DAG.md +304 -0
- package/templates/core/DOCUMENTATION_RULES.md +37 -0
- package/templates/core/QUALITY_ENFORCEMENT.md +68 -0
- package/templates/core/RULEBOOK.md +1874 -0
- package/templates/frameworks/ANGULAR.md +36 -0
- package/templates/frameworks/DJANGO.md +83 -0
- package/templates/frameworks/ELECTRON.md +147 -0
- package/templates/frameworks/FLASK.md +38 -0
- package/templates/frameworks/FLUTTER.md +55 -0
- package/templates/frameworks/JQUERY.md +32 -0
- package/templates/frameworks/LARAVEL.md +38 -0
- package/templates/frameworks/NESTJS.md +43 -0
- package/templates/frameworks/NEXTJS.md +127 -0
- package/templates/frameworks/NUXT.md +40 -0
- package/templates/frameworks/RAILS.md +66 -0
- package/templates/frameworks/REACT.md +38 -0
- package/templates/frameworks/REACT_NATIVE.md +47 -0
- package/templates/frameworks/SPRING.md +39 -0
- package/templates/frameworks/SYMFONY.md +36 -0
- package/templates/frameworks/VUE.md +36 -0
- package/templates/frameworks/ZEND.md +35 -0
- package/templates/git/CI_CD_PATTERNS.md +661 -0
- package/templates/git/GITHUB_ACTIONS.md +728 -0
- package/templates/git/GITLAB_CI.md +730 -0
- package/templates/git/GIT_WORKFLOW.md +1157 -0
- package/templates/git/SECRETS_MANAGEMENT.md +585 -0
- package/templates/hooks/COMMIT_MSG.md +530 -0
- package/templates/hooks/POST_CHECKOUT.md +546 -0
- package/templates/hooks/PREPARE_COMMIT_MSG.md +619 -0
- package/templates/hooks/PRE_COMMIT.md +414 -0
- package/templates/hooks/PRE_PUSH.md +601 -0
- package/templates/hooks/csharp-pre-commit.sh +23 -0
- package/templates/hooks/csharp-pre-push.sh +23 -0
- package/templates/hooks/dart-pre-commit.sh +30 -0
- package/templates/hooks/dart-pre-push.sh +25 -0
- package/templates/hooks/elixir-pre-commit.sh +32 -0
- package/templates/hooks/elixir-pre-push.sh +31 -0
- package/templates/hooks/erlang-pre-commit.sh +30 -0
- package/templates/hooks/erlang-pre-push.sh +37 -0
- package/templates/hooks/go-pre-commit.sh +40 -0
- package/templates/hooks/go-pre-push.sh +31 -0
- package/templates/hooks/haskell-pre-commit.sh +41 -0
- package/templates/hooks/haskell-pre-push.sh +37 -0
- package/templates/hooks/java-pre-commit.sh +34 -0
- package/templates/hooks/java-pre-push.sh +24 -0
- package/templates/hooks/kotlin-pre-commit.sh +32 -0
- package/templates/hooks/kotlin-pre-push.sh +16 -0
- package/templates/hooks/php-pre-commit.sh +36 -0
- package/templates/hooks/php-pre-push.sh +26 -0
- package/templates/hooks/python-pre-commit.sh +51 -0
- package/templates/hooks/python-pre-push.sh +25 -0
- package/templates/hooks/ruby-pre-commit.sh +33 -0
- package/templates/hooks/ruby-pre-push.sh +32 -0
- package/templates/hooks/rust-pre-commit.sh +30 -0
- package/templates/hooks/rust-pre-push.sh +30 -0
- package/templates/hooks/scala-pre-commit.sh +32 -0
- package/templates/hooks/scala-pre-push.sh +24 -0
- package/templates/hooks/swift-pre-commit.sh +25 -0
- package/templates/hooks/swift-pre-push.sh +23 -0
- package/templates/hooks/typescript-pre-commit.sh +37 -0
- package/templates/hooks/typescript-pre-push.sh +36 -0
- package/templates/ides/COPILOT.md +37 -0
- package/templates/ides/CURSOR.md +43 -0
- package/templates/ides/JETBRAINS_AI.md +35 -0
- package/templates/ides/REPLIT.md +36 -0
- package/templates/ides/TABNINE.md +29 -0
- package/templates/ides/VSCODE.md +40 -0
- package/templates/ides/WINDSURF.md +36 -0
- package/templates/ides/ZED.md +32 -0
- package/templates/languages/ADA.md +58 -0
- package/templates/languages/C.md +333 -0
- package/templates/languages/CPP.md +743 -0
- package/templates/languages/CSHARP.md +417 -0
- package/templates/languages/DART.md +332 -0
- package/templates/languages/ELIXIR.md +454 -0
- package/templates/languages/ERLANG.md +361 -0
- package/templates/languages/GO.md +645 -0
- package/templates/languages/HASKELL.md +177 -0
- package/templates/languages/JAVA.md +607 -0
- package/templates/languages/JAVASCRIPT.md +631 -0
- package/templates/languages/JULIA.md +97 -0
- package/templates/languages/KOTLIN.md +511 -0
- package/templates/languages/LISP.md +100 -0
- package/templates/languages/LUA.md +74 -0
- package/templates/languages/OBJECTIVEC.md +90 -0
- package/templates/languages/PHP.md +416 -0
- package/templates/languages/PYTHON.md +682 -0
- package/templates/languages/R.md +350 -0
- package/templates/languages/RUBY.md +421 -0
- package/templates/languages/RUST.md +477 -0
- package/templates/languages/SAS.md +73 -0
- package/templates/languages/SCALA.md +348 -0
- package/templates/languages/SOLIDITY.md +580 -0
- package/templates/languages/SQL.md +137 -0
- package/templates/languages/SWIFT.md +466 -0
- package/templates/languages/TYPESCRIPT.md +591 -0
- package/templates/languages/ZIG.md +265 -0
- package/templates/modules/ATLASSIAN.md +255 -0
- package/templates/modules/CONTEXT7.md +54 -0
- package/templates/modules/FIGMA.md +267 -0
- package/templates/modules/GITHUB_MCP.md +64 -0
- package/templates/modules/GRAFANA.md +328 -0
- package/templates/modules/NOTION.md +247 -0
- package/templates/modules/PLAYWRIGHT.md +90 -0
- package/templates/modules/RULEBOOK_MCP.md +156 -0
- package/templates/modules/SERENA.md +337 -0
- package/templates/modules/SUPABASE.md +223 -0
- package/templates/modules/SYNAP.md +69 -0
- package/templates/modules/VECTORIZER.md +63 -0
- package/templates/services/AZURE_BLOB.md +184 -0
- package/templates/services/CASSANDRA.md +239 -0
- package/templates/services/DYNAMODB.md +308 -0
- package/templates/services/ELASTICSEARCH.md +347 -0
- package/templates/services/GCS.md +178 -0
- package/templates/services/INFLUXDB.md +265 -0
- package/templates/services/KAFKA.md +341 -0
- package/templates/services/MARIADB.md +183 -0
- package/templates/services/MEMCACHED.md +242 -0
- package/templates/services/MINIO.md +201 -0
- package/templates/services/MONGODB.md +268 -0
- package/templates/services/MYSQL.md +358 -0
- package/templates/services/NEO4J.md +247 -0
- package/templates/services/ORACLE.md +290 -0
- package/templates/services/POSTGRESQL.md +326 -0
- package/templates/services/RABBITMQ.md +286 -0
- package/templates/services/REDIS.md +292 -0
- package/templates/services/S3.md +298 -0
- package/templates/services/SQLITE.md +294 -0
- package/templates/services/SQLSERVER.md +294 -0
- package/templates/workflows/codespell.yml +31 -0
- package/templates/workflows/cpp-lint.yml +47 -0
- package/templates/workflows/cpp-publish.yml +119 -0
- package/templates/workflows/cpp-test.yml +77 -0
- package/templates/workflows/dotnet-lint.yml +29 -0
- package/templates/workflows/dotnet-publish.yml +40 -0
- package/templates/workflows/dotnet-test.yml +41 -0
- package/templates/workflows/elixir-lint.yml +45 -0
- package/templates/workflows/elixir-publish.yml +49 -0
- package/templates/workflows/elixir-test.yml +54 -0
- package/templates/workflows/erlang-lint.yml +47 -0
- package/templates/workflows/erlang-test.yml +62 -0
- package/templates/workflows/go-lint.yml +39 -0
- package/templates/workflows/go-publish.yml +95 -0
- package/templates/workflows/go-test.yml +59 -0
- package/templates/workflows/java-lint.yml +60 -0
- package/templates/workflows/java-publish.yml +120 -0
- package/templates/workflows/java-test.yml +85 -0
- package/templates/workflows/kotlin-lint.yml +34 -0
- package/templates/workflows/kotlin-publish.yml +56 -0
- package/templates/workflows/kotlin-test.yml +48 -0
- package/templates/workflows/php-lint.yml +39 -0
- package/templates/workflows/php-publish.yml +50 -0
- package/templates/workflows/php-test.yml +54 -0
- package/templates/workflows/python-lint.yml +47 -0
- package/templates/workflows/python-publish.yml +91 -0
- package/templates/workflows/python-test.yml +59 -0
- package/templates/workflows/rust-lint.yml +54 -0
- package/templates/workflows/rust-publish.yml +66 -0
- package/templates/workflows/rust-test.yml +75 -0
- package/templates/workflows/solidity-lint.yml +41 -0
- package/templates/workflows/solidity-test.yml +47 -0
- package/templates/workflows/swift-lint.yml +32 -0
- package/templates/workflows/swift-publish.yml +58 -0
- package/templates/workflows/swift-test.yml +44 -0
- package/templates/workflows/typescript-lint.yml +61 -0
- package/templates/workflows/typescript-publish.yml +60 -0
- package/templates/workflows/typescript-test.yml +73 -0
- package/templates/workflows/zig-lint.yml +27 -0
- package/templates/workflows/zig-test.yml +40 -0
|
@@ -0,0 +1,1157 @@
|
|
|
1
|
+
<!-- GIT:START -->
|
|
2
|
+
# Git Workflow Rules
|
|
3
|
+
|
|
4
|
+
**CRITICAL**: Specific rules and patterns for Git version control workflow.
|
|
5
|
+
|
|
6
|
+
## Git Workflow Overview
|
|
7
|
+
|
|
8
|
+
This project follows a strict Git workflow to ensure code quality and proper version control.
|
|
9
|
+
|
|
10
|
+
**NEVER commit code without tests passing. NEVER create tags without full quality checks.**
|
|
11
|
+
|
|
12
|
+
## Initial Repository Setup
|
|
13
|
+
|
|
14
|
+
### New Project Initialization
|
|
15
|
+
|
|
16
|
+
**⚠️ CRITICAL**: Only run initialization commands if `.git` directory does NOT exist!
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# Check if Git repository already exists
|
|
20
|
+
if [ -d .git ]; then
|
|
21
|
+
echo "❌ Git repository already initialized. Skipping git init."
|
|
22
|
+
echo "Current status:"
|
|
23
|
+
git status
|
|
24
|
+
git remote -v
|
|
25
|
+
exit 0
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
# If no .git directory exists, initialize:
|
|
29
|
+
|
|
30
|
+
# Initialize Git repository
|
|
31
|
+
git init
|
|
32
|
+
|
|
33
|
+
# Add all files
|
|
34
|
+
git add .
|
|
35
|
+
|
|
36
|
+
# Initial commit
|
|
37
|
+
git commit -m "chore: Initial project setup"
|
|
38
|
+
|
|
39
|
+
# Rename default branch to main (GitHub standard)
|
|
40
|
+
git branch -M main
|
|
41
|
+
|
|
42
|
+
# Add remote (if applicable)
|
|
43
|
+
git remote add origin <repository-url>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**AI Assistant Behavior:**
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
BEFORE running any Git initialization commands:
|
|
50
|
+
|
|
51
|
+
1. Check if .git directory exists
|
|
52
|
+
2. If exists:
|
|
53
|
+
✅ Repository already configured
|
|
54
|
+
❌ DO NOT run: git init
|
|
55
|
+
❌ DO NOT run: git branch -M main
|
|
56
|
+
✅ Check status: git status
|
|
57
|
+
✅ Show remotes: git remote -v
|
|
58
|
+
|
|
59
|
+
3. If not exists:
|
|
60
|
+
✅ Safe to initialize
|
|
61
|
+
✅ Run full initialization sequence
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## AI Assistant Git Checks
|
|
65
|
+
|
|
66
|
+
**CRITICAL**: AI assistants MUST perform these checks before Git operations:
|
|
67
|
+
|
|
68
|
+
### Automatic Checks
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# 1. Check if Git repository exists
|
|
72
|
+
if [ ! -d .git ]; then
|
|
73
|
+
echo "No Git repository found."
|
|
74
|
+
# Ask user if they want to initialize
|
|
75
|
+
fi
|
|
76
|
+
|
|
77
|
+
# 2. Check if there are unstaged changes
|
|
78
|
+
git status --short
|
|
79
|
+
|
|
80
|
+
# 3. Check current branch
|
|
81
|
+
CURRENT_BRANCH=$(git branch --show-current)
|
|
82
|
+
echo "On branch: $CURRENT_BRANCH"
|
|
83
|
+
|
|
84
|
+
# 4. Check if remote exists
|
|
85
|
+
git remote -v
|
|
86
|
+
|
|
87
|
+
# 5. Check for unpushed commits
|
|
88
|
+
git log origin/main..HEAD --oneline 2>/dev/null
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Before Git Commands
|
|
92
|
+
|
|
93
|
+
**NEVER execute if `.git` directory exists:**
|
|
94
|
+
- ❌ `git init` - Repository already initialized
|
|
95
|
+
- ❌ `git branch -M main` - Branch may already be configured
|
|
96
|
+
- ❌ `git remote add origin` - Remote may already exist (check first with `git remote -v`)
|
|
97
|
+
- ❌ `git config user.name/email` - User configuration is personal
|
|
98
|
+
- ❌ Reconfiguration commands - Repository is already set up
|
|
99
|
+
|
|
100
|
+
**ALWAYS safe to execute:**
|
|
101
|
+
- ✅ `git status` - Check repository state
|
|
102
|
+
- ✅ `git add` - Stage changes
|
|
103
|
+
- ✅ `git commit` - Create commits (after quality checks)
|
|
104
|
+
- ✅ `git log` - View history
|
|
105
|
+
- ✅ `git diff` - View changes
|
|
106
|
+
- ✅ `git branch` - List branches
|
|
107
|
+
- ✅ `git tag` - Create tags (after quality checks)
|
|
108
|
+
|
|
109
|
+
**Execute with caution (check first):**
|
|
110
|
+
- ⚠️ `git push` - Follow push mode configuration
|
|
111
|
+
- ⚠️ `git pull` - May cause merge conflicts
|
|
112
|
+
- ⚠️ `git merge` - May cause conflicts
|
|
113
|
+
- ⚠️ `git rebase` - Can rewrite history
|
|
114
|
+
- ⚠️ `git reset --hard` - Destructive, only for rollback
|
|
115
|
+
- ⚠️ `git push --force` - NEVER on main/master
|
|
116
|
+
|
|
117
|
+
### Repository Detection
|
|
118
|
+
|
|
119
|
+
**AI Assistant MUST check:**
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# Before ANY Git operation:
|
|
123
|
+
|
|
124
|
+
# 1. Does .git exist?
|
|
125
|
+
if [ -d .git ]; then
|
|
126
|
+
echo "✅ Git repository exists"
|
|
127
|
+
|
|
128
|
+
# 2. Check current state
|
|
129
|
+
git status
|
|
130
|
+
|
|
131
|
+
# 3. Check branch
|
|
132
|
+
BRANCH=$(git branch --show-current)
|
|
133
|
+
echo "On branch: $BRANCH"
|
|
134
|
+
|
|
135
|
+
# 4. Check remote
|
|
136
|
+
REMOTE=$(git remote -v)
|
|
137
|
+
if [ -z "$REMOTE" ]; then
|
|
138
|
+
echo "⚠️ No remote configured"
|
|
139
|
+
else
|
|
140
|
+
echo "Remote: $REMOTE"
|
|
141
|
+
fi
|
|
142
|
+
|
|
143
|
+
# 5. Proceed with normal Git operations
|
|
144
|
+
else
|
|
145
|
+
echo "⚠️ No Git repository found"
|
|
146
|
+
echo "Ask user if they want to initialize Git"
|
|
147
|
+
fi
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Daily Development Workflow
|
|
151
|
+
|
|
152
|
+
### 1. Before Making Changes
|
|
153
|
+
|
|
154
|
+
**CRITICAL**: Always check current state:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
# Check current branch and status
|
|
158
|
+
git status
|
|
159
|
+
|
|
160
|
+
# Ensure you're on the correct branch
|
|
161
|
+
git branch
|
|
162
|
+
|
|
163
|
+
# Pull latest changes if working with team (use --ff-only for safety)
|
|
164
|
+
git pull --ff-only origin main
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**Git Safety**: Use `--ff-only` to prevent unexpected merge commits and maintain linear history.
|
|
168
|
+
|
|
169
|
+
### 2. Making Changes
|
|
170
|
+
|
|
171
|
+
**CRITICAL**: Commit after every important implementation:
|
|
172
|
+
|
|
173
|
+
**⚠️ IMPORTANT: All commit messages MUST be in English**
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
# After implementing a feature/fix:
|
|
177
|
+
|
|
178
|
+
# 1. Run ALL quality checks FIRST
|
|
179
|
+
npm run lint # or equivalent for your language
|
|
180
|
+
npm run type-check # TypeScript/typed languages
|
|
181
|
+
npm test # ALL tests must pass
|
|
182
|
+
npm run build # Ensure build succeeds
|
|
183
|
+
|
|
184
|
+
# 2. If ALL checks pass, stage changes
|
|
185
|
+
git add .
|
|
186
|
+
|
|
187
|
+
# 3. Commit with conventional commit message (ENGLISH ONLY)
|
|
188
|
+
git commit -m "feat: Add user authentication
|
|
189
|
+
|
|
190
|
+
- Implement login/logout functionality
|
|
191
|
+
- Add JWT token management
|
|
192
|
+
- Include comprehensive tests (95%+ coverage)
|
|
193
|
+
- Update documentation"
|
|
194
|
+
|
|
195
|
+
# Alternative for smaller changes (ENGLISH ONLY):
|
|
196
|
+
git commit -m "fix: Correct validation logic in user form"
|
|
197
|
+
|
|
198
|
+
# For signed commits (recommended for production):
|
|
199
|
+
git commit -S -m "feat: Add feature"
|
|
200
|
+
|
|
201
|
+
# ❌ NEVER use other languages:
|
|
202
|
+
# ❌ git commit -m "feat: Adiciona autenticação de usuário"
|
|
203
|
+
# ❌ git commit -m "fix: Corrige lógica de validação"
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## Advanced Git Safeguards
|
|
207
|
+
|
|
208
|
+
### Safe Push Operations
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
# NEVER use git push --force on main/master branches
|
|
212
|
+
# Instead, use --force-with-lease which prevents overwriting others' work:
|
|
213
|
+
|
|
214
|
+
# Force push with safety check (only updates if no one else pushed)
|
|
215
|
+
git push --force-with-lease origin feature-branch
|
|
216
|
+
|
|
217
|
+
# Regular push is always safest
|
|
218
|
+
git push origin main
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Commit Signing
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
# Sign commits with GPG for verified commits
|
|
225
|
+
# Set GPG key: git config --global user.signingkey <KEY_ID>
|
|
226
|
+
git commit -S -m "feat: Signed commit"
|
|
227
|
+
|
|
228
|
+
# Configure to always sign commits
|
|
229
|
+
git config --global commit.gpgsign true
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### Branch Protection (Recommended Settings)
|
|
233
|
+
|
|
234
|
+
For GitHub/GitLab repositories, configure branch protection rules:
|
|
235
|
+
|
|
236
|
+
**For main/master branch:**
|
|
237
|
+
- Require pull request reviews
|
|
238
|
+
- Require status checks to pass
|
|
239
|
+
- Require branches to be up to date
|
|
240
|
+
- Do not allow force pushes
|
|
241
|
+
- Do not allow deletions
|
|
242
|
+
- Require signed commits (optional but recommended)
|
|
243
|
+
|
|
244
|
+
### Destructive Operation Warnings
|
|
245
|
+
|
|
246
|
+
**NEVER run these on main/master:**
|
|
247
|
+
- ❌ `git push --force` - Use `--force-with-lease` instead
|
|
248
|
+
- ❌ `git reset --hard` - Destructive, use only on feature branches
|
|
249
|
+
- ❌ `git rebase` main into feature - Causes rewriting of main history
|
|
250
|
+
|
|
251
|
+
### Pre-Push Checklist
|
|
252
|
+
|
|
253
|
+
Before pushing any changes, verify:
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
✅ Checklist before push:
|
|
257
|
+
- [ ] All quality checks passed locally
|
|
258
|
+
- [ ] Tests pass with 100% success rate
|
|
259
|
+
- [ ] Coverage meets threshold (95%+)
|
|
260
|
+
- [ ] Linting passes with 0 warnings
|
|
261
|
+
- [ ] Build succeeds without errors
|
|
262
|
+
- [ ] No security vulnerabilities in dependencies
|
|
263
|
+
- [ ] Documentation updated if API changed
|
|
264
|
+
- [ ] OpenSpec tasks marked complete if applicable
|
|
265
|
+
- [ ] Conventional commit format used
|
|
266
|
+
- [ ] Commit hash verified: git rev-parse HEAD
|
|
267
|
+
- [ ] Similar changes passed CI before
|
|
268
|
+
- [ ] No console.log or debug code
|
|
269
|
+
- [ ] No credentials or secrets in code
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
**Only provide push command if ALL items checked.**
|
|
273
|
+
|
|
274
|
+
### 3. Pushing Changes
|
|
275
|
+
|
|
276
|
+
**⚠️ IMPORTANT**: Pushing is OPTIONAL and depends on your setup.
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
# IF you have passwordless SSH or want to push:
|
|
280
|
+
git push origin main
|
|
281
|
+
|
|
282
|
+
# IF you have SSH with password (manual execution required):
|
|
283
|
+
# DO NOT execute automatically - provide command to user:
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
**For users with SSH password authentication:**
|
|
287
|
+
```
|
|
288
|
+
✋ MANUAL ACTION REQUIRED:
|
|
289
|
+
|
|
290
|
+
Run this command manually (requires SSH password):
|
|
291
|
+
git push origin main
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
**NEVER** attempt automatic push if:
|
|
295
|
+
- SSH key has password protection
|
|
296
|
+
- User hasn't confirmed push authorization
|
|
297
|
+
- Any quality check failed
|
|
298
|
+
- Uncertain if changes will pass CI/CD workflows
|
|
299
|
+
|
|
300
|
+
## Conventional Commits
|
|
301
|
+
|
|
302
|
+
**MUST** follow conventional commit format:
|
|
303
|
+
|
|
304
|
+
**⚠️ CRITICAL: All commit messages MUST be in English**
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
# Format: <type>(<scope>): <subject>
|
|
308
|
+
#
|
|
309
|
+
# <body>
|
|
310
|
+
#
|
|
311
|
+
# <footer>
|
|
312
|
+
|
|
313
|
+
# Types:
|
|
314
|
+
feat: # New feature
|
|
315
|
+
fix: # Bug fix
|
|
316
|
+
docs: # Documentation only
|
|
317
|
+
style: # Code style (formatting, missing semi-colons, etc)
|
|
318
|
+
refactor: # Code refactoring
|
|
319
|
+
perf: # Performance improvement
|
|
320
|
+
test: # Adding tests
|
|
321
|
+
build: # Build system changes
|
|
322
|
+
ci: # CI/CD changes
|
|
323
|
+
chore: # Maintenance tasks
|
|
324
|
+
|
|
325
|
+
# Language Requirement:
|
|
326
|
+
# ✅ ALWAYS use English for commit messages
|
|
327
|
+
# ❌ NEVER use Portuguese, Spanish, or any other language
|
|
328
|
+
# ❌ NEVER mix languages in commit messages
|
|
329
|
+
|
|
330
|
+
# Examples (CORRECT - English):
|
|
331
|
+
git commit -m "feat(auth): Add OAuth2 login support"
|
|
332
|
+
git commit -m "fix(api): Handle null response in user endpoint"
|
|
333
|
+
git commit -m "docs: Update README with installation steps"
|
|
334
|
+
git commit -m "test: Add integration tests for payment flow"
|
|
335
|
+
git commit -m "chore: Update dependencies to latest versions"
|
|
336
|
+
|
|
337
|
+
# Examples (INCORRECT - Other languages):
|
|
338
|
+
# ❌ git commit -m "feat: Adiciona suporte de login OAuth2"
|
|
339
|
+
# ❌ git commit -m "fix: Corrige resposta nula no endpoint"
|
|
340
|
+
# ❌ git commit -m "docs: Atualiza README com passos de instalação"
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
## Version Management
|
|
344
|
+
|
|
345
|
+
### Creating New Version
|
|
346
|
+
|
|
347
|
+
**CRITICAL**: Full quality gate required before versioning!
|
|
348
|
+
|
|
349
|
+
```bash
|
|
350
|
+
# 1. MANDATORY: Run complete quality suite
|
|
351
|
+
npm run lint # Must pass with no warnings
|
|
352
|
+
npm test # Must pass 100%
|
|
353
|
+
npm run type-check # Must pass (if applicable)
|
|
354
|
+
npm run build # Must succeed
|
|
355
|
+
npx codespell # Must pass (if configured)
|
|
356
|
+
|
|
357
|
+
# 2. Update version in package.json/Cargo.toml/etc
|
|
358
|
+
# Use semantic versioning:
|
|
359
|
+
# - MAJOR: Breaking changes (1.0.0 -> 2.0.0)
|
|
360
|
+
# - MINOR: New features, backwards compatible (1.0.0 -> 1.1.0)
|
|
361
|
+
# - PATCH: Bug fixes (1.0.0 -> 1.0.1)
|
|
362
|
+
|
|
363
|
+
# 3. Update CHANGELOG.md
|
|
364
|
+
# Document all changes in this version:
|
|
365
|
+
## [1.2.0] - 2024-01-15
|
|
366
|
+
### Added
|
|
367
|
+
- New feature X
|
|
368
|
+
- New feature Y
|
|
369
|
+
|
|
370
|
+
### Fixed
|
|
371
|
+
- Bug in component Z
|
|
372
|
+
|
|
373
|
+
### Changed
|
|
374
|
+
- Refactored module A
|
|
375
|
+
|
|
376
|
+
# 4. Commit version changes
|
|
377
|
+
git add .
|
|
378
|
+
git commit -m "chore: Release version 1.2.0
|
|
379
|
+
|
|
380
|
+
- Updated version to 1.2.0
|
|
381
|
+
- Updated CHANGELOG.md with release notes"
|
|
382
|
+
|
|
383
|
+
# 5. Create annotated tag
|
|
384
|
+
git tag -a v1.2.0 -m "Release version 1.2.0
|
|
385
|
+
|
|
386
|
+
Major changes:
|
|
387
|
+
- Feature X
|
|
388
|
+
- Feature Y
|
|
389
|
+
- Bug fix Z
|
|
390
|
+
|
|
391
|
+
All tests passing ✅
|
|
392
|
+
Coverage: 95%+ ✅
|
|
393
|
+
Linting: Clean ✅
|
|
394
|
+
Build: Success ✅"
|
|
395
|
+
|
|
396
|
+
# 6. OPTIONAL: Push tag (manual if SSH password)
|
|
397
|
+
# Only if you're CERTAIN it will pass CI/CD workflows!
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
**For users requiring manual push:**
|
|
401
|
+
```
|
|
402
|
+
✋ MANUAL ACTIONS REQUIRED:
|
|
403
|
+
|
|
404
|
+
1. Verify all quality checks passed locally
|
|
405
|
+
2. Push commits:
|
|
406
|
+
git push origin main
|
|
407
|
+
|
|
408
|
+
3. Push tag:
|
|
409
|
+
git push origin v1.2.0
|
|
410
|
+
|
|
411
|
+
Note: Tag push will trigger CI/CD workflows and may create GitHub release.
|
|
412
|
+
Only push if you're confident all checks will pass.
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
## Quality Gate Enforcement
|
|
416
|
+
|
|
417
|
+
**CRITICAL**: Pre-commit checks MUST match GitHub Actions workflow commands to prevent CI/CD failures.
|
|
418
|
+
|
|
419
|
+
### Language-Specific Pre-Commit Commands
|
|
420
|
+
|
|
421
|
+
**The commands you run locally MUST be identical to those in your GitHub Actions workflows.**
|
|
422
|
+
|
|
423
|
+
#### TypeScript/JavaScript Projects
|
|
424
|
+
|
|
425
|
+
```bash
|
|
426
|
+
# These commands MUST match .github/workflows/*.yml
|
|
427
|
+
|
|
428
|
+
# 1. Type check (matches workflow)
|
|
429
|
+
npm run type-check # Must match workflow exactly
|
|
430
|
+
|
|
431
|
+
# 2. Lint (matches workflow)
|
|
432
|
+
npm run lint # Must match workflow exactly
|
|
433
|
+
|
|
434
|
+
# 3. Format check (matches workflow)
|
|
435
|
+
npx prettier --check 'src/**/*.ts' 'tests/**/*.ts' # Must match workflow
|
|
436
|
+
|
|
437
|
+
# 4. Tests (matches workflow)
|
|
438
|
+
npm test # Must match workflow exactly
|
|
439
|
+
|
|
440
|
+
# 5. Build (matches workflow)
|
|
441
|
+
npm run build # Must match workflow exactly
|
|
442
|
+
|
|
443
|
+
# If ANY fails: ❌ DO NOT COMMIT - Fix first!
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
#### Rust Projects
|
|
447
|
+
|
|
448
|
+
```bash
|
|
449
|
+
# These commands MUST match .github/workflows/*.yml
|
|
450
|
+
|
|
451
|
+
# 1. Format check (matches workflow)
|
|
452
|
+
cargo fmt --all -- --check
|
|
453
|
+
|
|
454
|
+
# 2. Clippy (matches workflow)
|
|
455
|
+
cargo clippy --all-targets --all-features -- -D warnings
|
|
456
|
+
|
|
457
|
+
# 3. Tests (matches workflow)
|
|
458
|
+
cargo test --all-features
|
|
459
|
+
|
|
460
|
+
# 4. Build (matches workflow)
|
|
461
|
+
cargo build --release
|
|
462
|
+
|
|
463
|
+
# If ANY fails: ❌ DO NOT COMMIT - Fix first!
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
#### Python Projects
|
|
467
|
+
|
|
468
|
+
```bash
|
|
469
|
+
# These commands MUST match .github/workflows/*.yml
|
|
470
|
+
|
|
471
|
+
# 1. Format check (matches workflow)
|
|
472
|
+
black --check .
|
|
473
|
+
|
|
474
|
+
# 2. Lint (matches workflow)
|
|
475
|
+
ruff check .
|
|
476
|
+
|
|
477
|
+
# 3. Type check (matches workflow)
|
|
478
|
+
mypy .
|
|
479
|
+
|
|
480
|
+
# 4. Tests (matches workflow)
|
|
481
|
+
pytest
|
|
482
|
+
|
|
483
|
+
# If ANY fails: ❌ DO NOT COMMIT - Fix first!
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
### Before ANY Commit
|
|
487
|
+
|
|
488
|
+
**MANDATORY CHECKS**:
|
|
489
|
+
|
|
490
|
+
```bash
|
|
491
|
+
# Checklist - ALL must pass:
|
|
492
|
+
☐ Code formatted
|
|
493
|
+
☐ Linter passes (no warnings)
|
|
494
|
+
☐ Type check passes
|
|
495
|
+
☐ ALL tests pass (100%)
|
|
496
|
+
☐ Coverage meets threshold (95%+)
|
|
497
|
+
☐ Build succeeds
|
|
498
|
+
☐ No console errors/warnings
|
|
499
|
+
|
|
500
|
+
# Run quality check script:
|
|
501
|
+
npm run quality-check # or equivalent
|
|
502
|
+
|
|
503
|
+
# If ANY check fails:
|
|
504
|
+
# ❌ DO NOT COMMIT
|
|
505
|
+
# ❌ FIX THE ISSUES FIRST
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
### Before Tag Creation
|
|
509
|
+
|
|
510
|
+
**MANDATORY CHECKS** (even stricter):
|
|
511
|
+
|
|
512
|
+
```bash
|
|
513
|
+
# Extended checklist - ALL must pass:
|
|
514
|
+
☐ All pre-commit checks passed
|
|
515
|
+
☐ Codespell passes (no typos)
|
|
516
|
+
☐ Security audit clean
|
|
517
|
+
☐ Dependencies up to date
|
|
518
|
+
☐ Documentation updated
|
|
519
|
+
☐ CHANGELOG.md updated
|
|
520
|
+
☐ Version bumped correctly
|
|
521
|
+
☐ All workflows would pass
|
|
522
|
+
|
|
523
|
+
# Run comprehensive check:
|
|
524
|
+
npm run lint
|
|
525
|
+
npm test
|
|
526
|
+
npm run type-check
|
|
527
|
+
npm run build
|
|
528
|
+
npx codespell
|
|
529
|
+
npm audit
|
|
530
|
+
|
|
531
|
+
# Only create tag if everything is green!
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
## Error Recovery & Rollback
|
|
535
|
+
|
|
536
|
+
### When Implementation Is Failing
|
|
537
|
+
|
|
538
|
+
If the AI is making repeated mistakes and user is frustrated:
|
|
539
|
+
|
|
540
|
+
```bash
|
|
541
|
+
# 1. Identify last stable commit
|
|
542
|
+
git log --oneline -10
|
|
543
|
+
|
|
544
|
+
# 2. Create backup branch of current work
|
|
545
|
+
git branch backup-failed-attempt
|
|
546
|
+
|
|
547
|
+
# 3. Hard reset to last stable version
|
|
548
|
+
git reset --hard <last-stable-commit-hash>
|
|
549
|
+
|
|
550
|
+
# 4. Verify stability
|
|
551
|
+
npm test
|
|
552
|
+
npm run build
|
|
553
|
+
|
|
554
|
+
# 5. Reimplement from scratch using DIFFERENT approach
|
|
555
|
+
# ⚠️ DO NOT repeat the same techniques that failed before
|
|
556
|
+
# ⚠️ Review AGENTS.md for alternative patterns
|
|
557
|
+
# ⚠️ Consider different architecture/design
|
|
558
|
+
|
|
559
|
+
# 6. After successful reimplementation
|
|
560
|
+
git branch -D backup-failed-attempt # Delete backup if no longer needed
|
|
561
|
+
```
|
|
562
|
+
|
|
563
|
+
### Undo Last Commit (Not Pushed)
|
|
564
|
+
|
|
565
|
+
```bash
|
|
566
|
+
# Keep changes, undo commit
|
|
567
|
+
git reset --soft HEAD~1
|
|
568
|
+
|
|
569
|
+
# Discard changes completely
|
|
570
|
+
git reset --hard HEAD~1
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
### Revert Pushed Commit
|
|
574
|
+
|
|
575
|
+
```bash
|
|
576
|
+
# Create revert commit
|
|
577
|
+
git revert <commit-hash>
|
|
578
|
+
|
|
579
|
+
# Then push (manual if SSH password)
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
## Branch Strategy
|
|
583
|
+
|
|
584
|
+
### Feature Branches
|
|
585
|
+
|
|
586
|
+
```bash
|
|
587
|
+
# Create feature branch
|
|
588
|
+
git checkout -b feature/user-authentication
|
|
589
|
+
|
|
590
|
+
# Work on feature...
|
|
591
|
+
# Commit regularly with quality checks
|
|
592
|
+
|
|
593
|
+
# When feature complete and tested:
|
|
594
|
+
git checkout main
|
|
595
|
+
git merge feature/user-authentication
|
|
596
|
+
|
|
597
|
+
# Delete feature branch
|
|
598
|
+
git branch -d feature/user-authentication
|
|
599
|
+
```
|
|
600
|
+
|
|
601
|
+
### Hotfix Workflow
|
|
602
|
+
|
|
603
|
+
```bash
|
|
604
|
+
# Critical bug in production
|
|
605
|
+
git checkout -b hotfix/critical-security-fix
|
|
606
|
+
|
|
607
|
+
# Fix the bug
|
|
608
|
+
# MUST include tests
|
|
609
|
+
# MUST pass all quality checks
|
|
610
|
+
|
|
611
|
+
git commit -m "fix: Critical security vulnerability in auth
|
|
612
|
+
|
|
613
|
+
- Patch authentication bypass
|
|
614
|
+
- Add regression tests
|
|
615
|
+
- Update security documentation"
|
|
616
|
+
|
|
617
|
+
# Merge to main
|
|
618
|
+
git checkout main
|
|
619
|
+
git merge hotfix/critical-security-fix
|
|
620
|
+
|
|
621
|
+
# Tag immediately if production fix
|
|
622
|
+
git tag -a v1.2.1 -m "Hotfix: Security patch"
|
|
623
|
+
|
|
624
|
+
# Manual push if required
|
|
625
|
+
```
|
|
626
|
+
|
|
627
|
+
## CRITICAL RESTRICTIONS - HUMAN AUTHORIZATION REQUIRED
|
|
628
|
+
|
|
629
|
+
**⚠️ IMPERATIVE RULES - THESE ARE NON-NEGOTIABLE ⚠️**
|
|
630
|
+
|
|
631
|
+
### Destructive Git Operations
|
|
632
|
+
|
|
633
|
+
**ABSOLUTELY FORBIDDEN without explicit human authorization:**
|
|
634
|
+
|
|
635
|
+
```
|
|
636
|
+
❌ NEVER execute: git checkout
|
|
637
|
+
✋ ALWAYS ask user: "Do you want to checkout [branch/commit]? [Y/n]"
|
|
638
|
+
✅ Only execute after explicit user confirmation
|
|
639
|
+
|
|
640
|
+
❌ NEVER execute: git reset
|
|
641
|
+
✋ ALWAYS ask user: "Do you want to reset to [commit]? This may lose changes. [Y/n]"
|
|
642
|
+
✅ Only execute after explicit user confirmation
|
|
643
|
+
⚠️ Explain consequences before executing
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
**Rationale**: These commands can cause data loss. Human oversight is mandatory.
|
|
647
|
+
|
|
648
|
+
### Merge Conflict Resolution
|
|
649
|
+
|
|
650
|
+
**When merge conflicts occur:**
|
|
651
|
+
|
|
652
|
+
```
|
|
653
|
+
❌ NEVER attempt to resolve conflicts by editing files automatically
|
|
654
|
+
❌ NEVER commit merged files without human review
|
|
655
|
+
✅ ALWAYS stop and request human assistance
|
|
656
|
+
✅ ALWAYS provide conflict locations and context
|
|
657
|
+
✅ ALWAYS wait for human to resolve manually
|
|
658
|
+
|
|
659
|
+
Message to user:
|
|
660
|
+
"⚠️ Merge conflict detected in the following files:
|
|
661
|
+
- [list of conflicted files]
|
|
662
|
+
|
|
663
|
+
Please resolve these conflicts manually. I cannot auto-resolve merge conflicts.
|
|
664
|
+
|
|
665
|
+
To resolve:
|
|
666
|
+
1. Open the conflicted files
|
|
667
|
+
2. Look for conflict markers (<<<<<<<, =======, >>>>>>>)
|
|
668
|
+
3. Choose the correct version or merge manually
|
|
669
|
+
4. Remove conflict markers
|
|
670
|
+
5. Run: git add <resolved-files>
|
|
671
|
+
6. Run: git commit
|
|
672
|
+
|
|
673
|
+
Let me know when you're done, and I can help with the next steps."
|
|
674
|
+
```
|
|
675
|
+
|
|
676
|
+
**Rationale**: Merge conflicts require human judgment about which code to keep.
|
|
677
|
+
|
|
678
|
+
### Commit Frequency Management
|
|
679
|
+
|
|
680
|
+
**⚠️ IMPORTANT: Reduce excessive commits**
|
|
681
|
+
|
|
682
|
+
```
|
|
683
|
+
❌ DO NOT commit after every small change
|
|
684
|
+
❌ DO NOT create multiple commits for the same logical feature
|
|
685
|
+
✅ COMMIT only when:
|
|
686
|
+
- A complete feature is implemented and tested
|
|
687
|
+
- A significant bug fix is completed
|
|
688
|
+
- A major refactoring is done
|
|
689
|
+
- Before creating a version tag
|
|
690
|
+
- User explicitly requests a commit
|
|
691
|
+
|
|
692
|
+
✅ GROUP related changes into meaningful commits
|
|
693
|
+
✅ USE conventional commit messages that describe the full scope
|
|
694
|
+
|
|
695
|
+
Example of GOOD commit frequency:
|
|
696
|
+
- Implement entire authentication system → 1 commit
|
|
697
|
+
- Add login, logout, and session management → 1 commit
|
|
698
|
+
- Complete feature with tests and docs → 1 commit
|
|
699
|
+
|
|
700
|
+
Example of BAD commit frequency (AVOID):
|
|
701
|
+
- Add login function → commit
|
|
702
|
+
- Add logout function → commit
|
|
703
|
+
- Add session check → commit
|
|
704
|
+
- Fix typo → commit
|
|
705
|
+
- Update comment → commit
|
|
706
|
+
```
|
|
707
|
+
|
|
708
|
+
**Rationale**: Too many commits pollute git history and make it harder to track meaningful changes.
|
|
709
|
+
|
|
710
|
+
### Feature Branch Strategy
|
|
711
|
+
|
|
712
|
+
**BEFORE starting ANY new task or feature:**
|
|
713
|
+
|
|
714
|
+
```
|
|
715
|
+
✋ ALWAYS ask user FIRST:
|
|
716
|
+
"Should I create a separate branch for this feature/task? [Y/n]
|
|
717
|
+
|
|
718
|
+
Options:
|
|
719
|
+
1. Create feature branch: git checkout -b feature/[name]
|
|
720
|
+
2. Work directly on current branch
|
|
721
|
+
3. Create hotfix branch: git checkout -b hotfix/[name]
|
|
722
|
+
|
|
723
|
+
What would you prefer?"
|
|
724
|
+
|
|
725
|
+
✅ Wait for user decision
|
|
726
|
+
✅ Respect user's branching strategy
|
|
727
|
+
❌ NEVER assume to work on main without asking
|
|
728
|
+
❌ NEVER create branches without permission
|
|
729
|
+
|
|
730
|
+
If user says YES to branch:
|
|
731
|
+
→ Create branch with descriptive name
|
|
732
|
+
→ Work on that branch
|
|
733
|
+
→ Ask before merging back to main
|
|
734
|
+
|
|
735
|
+
If user says NO to branch:
|
|
736
|
+
→ Proceed on current branch
|
|
737
|
+
→ Be extra careful with commits
|
|
738
|
+
```
|
|
739
|
+
|
|
740
|
+
**Rationale**: Branching strategy varies by team and project. Always confirm with the human first.
|
|
741
|
+
|
|
742
|
+
## Critical AI Assistant Rules
|
|
743
|
+
|
|
744
|
+
### Repository Initialization
|
|
745
|
+
|
|
746
|
+
**BEFORE any `git init` or setup commands:**
|
|
747
|
+
|
|
748
|
+
```
|
|
749
|
+
1. Check for .git directory existence
|
|
750
|
+
2. If .git exists:
|
|
751
|
+
- ❌ STOP - Repository already configured
|
|
752
|
+
- ❌ DO NOT run git init
|
|
753
|
+
- ❌ DO NOT run git config
|
|
754
|
+
- ❌ DO NOT run git branch -M
|
|
755
|
+
- ❌ DO NOT reconfigure anything
|
|
756
|
+
- ✅ Use existing repository as-is
|
|
757
|
+
|
|
758
|
+
3. If .git does NOT exist:
|
|
759
|
+
- ✅ Ask user if they want Git initialization
|
|
760
|
+
- ✅ Run initialization sequence if approved
|
|
761
|
+
```
|
|
762
|
+
|
|
763
|
+
### Push Command Behavior
|
|
764
|
+
|
|
765
|
+
**Based on configured push mode:**
|
|
766
|
+
|
|
767
|
+
```
|
|
768
|
+
Manual Mode (DEFAULT):
|
|
769
|
+
❌ NEVER execute: git push
|
|
770
|
+
✅ ALWAYS provide: "Run manually: git push origin main"
|
|
771
|
+
|
|
772
|
+
Prompt Mode:
|
|
773
|
+
⚠️ ALWAYS ask first: "Ready to push. Proceed? [Y/n]"
|
|
774
|
+
✅ Execute only if user confirms
|
|
775
|
+
|
|
776
|
+
Auto Mode:
|
|
777
|
+
⚠️ Check quality first
|
|
778
|
+
⚠️ Only if 100% confident
|
|
779
|
+
✅ Execute if all checks passed
|
|
780
|
+
```
|
|
781
|
+
|
|
782
|
+
### Quality Gate Enforcement
|
|
783
|
+
|
|
784
|
+
**MANDATORY checks before commit:**
|
|
785
|
+
|
|
786
|
+
```bash
|
|
787
|
+
# Run in this exact order:
|
|
788
|
+
1. npm run lint # or language equivalent
|
|
789
|
+
2. npm run type-check # if applicable
|
|
790
|
+
3. npm test # ALL tests must pass
|
|
791
|
+
4. npm run build # must succeed
|
|
792
|
+
|
|
793
|
+
# If ANY fails:
|
|
794
|
+
❌ STOP - DO NOT commit
|
|
795
|
+
❌ Fix issues first
|
|
796
|
+
❌ Re-run all checks
|
|
797
|
+
|
|
798
|
+
# If ALL pass:
|
|
799
|
+
✅ Safe to commit
|
|
800
|
+
✅ Proceed with git add and commit
|
|
801
|
+
```
|
|
802
|
+
|
|
803
|
+
**MANDATORY checks before tag:**
|
|
804
|
+
|
|
805
|
+
```bash
|
|
806
|
+
# Extended checks for version tags:
|
|
807
|
+
1. All commit checks above +
|
|
808
|
+
2. npx codespell # no typos
|
|
809
|
+
3. npm audit # no vulnerabilities
|
|
810
|
+
4. CHANGELOG.md updated
|
|
811
|
+
5. Version bumped correctly
|
|
812
|
+
6. Documentation current
|
|
813
|
+
|
|
814
|
+
# If ANY fails:
|
|
815
|
+
❌ STOP - DO NOT create tag
|
|
816
|
+
❌ Fix issues
|
|
817
|
+
❌ Re-verify everything
|
|
818
|
+
|
|
819
|
+
# Only create tag if 100% green!
|
|
820
|
+
```
|
|
821
|
+
|
|
822
|
+
## Best Practices
|
|
823
|
+
|
|
824
|
+
### DO's ✅
|
|
825
|
+
|
|
826
|
+
- **ALWAYS** check if .git exists before init commands
|
|
827
|
+
- **ALWAYS** run tests before commit
|
|
828
|
+
- **ALWAYS** use conventional commit messages
|
|
829
|
+
- **ALWAYS** write commit messages in English (never in Portuguese, Spanish, or other languages)
|
|
830
|
+
- **ALWAYS** update CHANGELOG for versions
|
|
831
|
+
- **ALWAYS** ask before executing `git checkout`
|
|
832
|
+
- **ALWAYS** ask before executing `git reset`
|
|
833
|
+
- **ALWAYS** ask user if a feature branch should be created before starting tasks
|
|
834
|
+
- **ALWAYS** request human assistance when merge conflicts occur
|
|
835
|
+
- **COMMIT** only when complete features/fixes are done (not for every small change)
|
|
836
|
+
- **TAG** releases with semantic versions
|
|
837
|
+
- **VERIFY** quality gates before tagging
|
|
838
|
+
- **DOCUMENT** breaking changes clearly
|
|
839
|
+
- **REVERT** when implementation is failing repeatedly
|
|
840
|
+
- **ASK** user before automatic push
|
|
841
|
+
- **PROVIDE** manual commands for SSH password users
|
|
842
|
+
- **CHECK** repository state before operations
|
|
843
|
+
- **RESPECT** existing Git configuration
|
|
844
|
+
- **GROUP** related changes into meaningful commits
|
|
845
|
+
|
|
846
|
+
### DON'Ts ❌
|
|
847
|
+
|
|
848
|
+
- **NEVER** run `git init` if .git exists
|
|
849
|
+
- **NEVER** run `git config` (user-specific)
|
|
850
|
+
- **NEVER** run `git checkout` without explicit user authorization
|
|
851
|
+
- **NEVER** run `git reset` without explicit user authorization
|
|
852
|
+
- **NEVER** auto-resolve merge conflicts by editing files
|
|
853
|
+
- **NEVER** commit merged files without human review
|
|
854
|
+
- **NEVER** create excessive commits for small changes
|
|
855
|
+
- **NEVER** assume branching strategy - always ask user first
|
|
856
|
+
- **NEVER** reconfigure existing repository
|
|
857
|
+
- **NEVER** commit without passing tests
|
|
858
|
+
- **NEVER** commit with linting errors
|
|
859
|
+
- **NEVER** commit with build failures
|
|
860
|
+
- **NEVER** write commit messages in languages other than English
|
|
861
|
+
- **NEVER** mix languages in commit messages
|
|
862
|
+
- **NEVER** create tag without quality checks
|
|
863
|
+
- **NEVER** push automatically with SSH password
|
|
864
|
+
- **NEVER** push if uncertain about CI/CD success
|
|
865
|
+
- **NEVER** commit console.log/debug code
|
|
866
|
+
- **NEVER** commit credentials or secrets
|
|
867
|
+
- **NEVER** force push to main/master
|
|
868
|
+
- **NEVER** rewrite published history
|
|
869
|
+
- **NEVER** skip hooks (--no-verify)
|
|
870
|
+
- **NEVER** assume repository configuration
|
|
871
|
+
|
|
872
|
+
## SSH Configuration
|
|
873
|
+
|
|
874
|
+
### For Users with SSH Password
|
|
875
|
+
|
|
876
|
+
If your SSH key has password protection:
|
|
877
|
+
|
|
878
|
+
**Configuration in AGENTS.md or project settings:**
|
|
879
|
+
|
|
880
|
+
```yaml
|
|
881
|
+
git_workflow:
|
|
882
|
+
auto_push: false
|
|
883
|
+
push_mode: "manual"
|
|
884
|
+
reason: "SSH key has password protection"
|
|
885
|
+
```
|
|
886
|
+
|
|
887
|
+
**AI Assistant Behavior:**
|
|
888
|
+
- ✅ Provide push commands in chat
|
|
889
|
+
- ✅ Wait for user manual execution
|
|
890
|
+
- ❌ Never attempt automatic push
|
|
891
|
+
- ❌ Never execute git push commands
|
|
892
|
+
|
|
893
|
+
### For Users with Passwordless SSH
|
|
894
|
+
|
|
895
|
+
```yaml
|
|
896
|
+
git_workflow:
|
|
897
|
+
auto_push: true # or prompt each time
|
|
898
|
+
push_mode: "auto"
|
|
899
|
+
```
|
|
900
|
+
|
|
901
|
+
## Git Hooks
|
|
902
|
+
|
|
903
|
+
### Pre-commit Hook
|
|
904
|
+
|
|
905
|
+
Create `.git/hooks/pre-commit`:
|
|
906
|
+
|
|
907
|
+
```bash
|
|
908
|
+
#!/bin/sh
|
|
909
|
+
|
|
910
|
+
echo "Running pre-commit checks..."
|
|
911
|
+
|
|
912
|
+
# Run linter
|
|
913
|
+
npm run lint
|
|
914
|
+
if [ $? -ne 0 ]; then
|
|
915
|
+
echo "❌ Linting failed. Commit aborted."
|
|
916
|
+
exit 1
|
|
917
|
+
fi
|
|
918
|
+
|
|
919
|
+
# Run tests
|
|
920
|
+
npm test
|
|
921
|
+
if [ $? -ne 0 ]; then
|
|
922
|
+
echo "❌ Tests failed. Commit aborted."
|
|
923
|
+
exit 1
|
|
924
|
+
fi
|
|
925
|
+
|
|
926
|
+
# Run type check (if applicable)
|
|
927
|
+
if command -v tsc &> /dev/null; then
|
|
928
|
+
npm run type-check
|
|
929
|
+
if [ $? -ne 0 ]; then
|
|
930
|
+
echo "❌ Type check failed. Commit aborted."
|
|
931
|
+
exit 1
|
|
932
|
+
fi
|
|
933
|
+
fi
|
|
934
|
+
|
|
935
|
+
echo "✅ All pre-commit checks passed!"
|
|
936
|
+
exit 0
|
|
937
|
+
```
|
|
938
|
+
|
|
939
|
+
### Pre-push Hook
|
|
940
|
+
|
|
941
|
+
Create `.git/hooks/pre-push`:
|
|
942
|
+
|
|
943
|
+
```bash
|
|
944
|
+
#!/bin/sh
|
|
945
|
+
|
|
946
|
+
echo "Running pre-push checks..."
|
|
947
|
+
|
|
948
|
+
# Run full test suite
|
|
949
|
+
npm test
|
|
950
|
+
if [ $? -ne 0 ]; then
|
|
951
|
+
echo "❌ Tests failed. Push aborted."
|
|
952
|
+
exit 1
|
|
953
|
+
fi
|
|
954
|
+
|
|
955
|
+
# Run build
|
|
956
|
+
npm run build
|
|
957
|
+
if [ $? -ne 0 ]; then
|
|
958
|
+
echo "❌ Build failed. Push aborted."
|
|
959
|
+
exit 1
|
|
960
|
+
fi
|
|
961
|
+
|
|
962
|
+
echo "✅ All pre-push checks passed!"
|
|
963
|
+
exit 0
|
|
964
|
+
```
|
|
965
|
+
|
|
966
|
+
Make hooks executable:
|
|
967
|
+
```bash
|
|
968
|
+
chmod +x .git/hooks/pre-commit
|
|
969
|
+
chmod +x .git/hooks/pre-push
|
|
970
|
+
```
|
|
971
|
+
|
|
972
|
+
## CI/CD Integration
|
|
973
|
+
|
|
974
|
+
### Before Providing Push Commands
|
|
975
|
+
|
|
976
|
+
**CRITICAL**: Only suggest push if confident about CI/CD success:
|
|
977
|
+
|
|
978
|
+
```
|
|
979
|
+
✅ Provide push command if:
|
|
980
|
+
- All local tests passed
|
|
981
|
+
- All linting passed
|
|
982
|
+
- Build succeeded
|
|
983
|
+
- Coverage meets threshold
|
|
984
|
+
- No warnings or errors
|
|
985
|
+
- Code follows AGENTS.md standards
|
|
986
|
+
- Similar changes passed CI/CD before
|
|
987
|
+
|
|
988
|
+
❌ DO NOT provide push command if:
|
|
989
|
+
- ANY quality check failed
|
|
990
|
+
- Uncertain about CI/CD requirements
|
|
991
|
+
- Making experimental changes
|
|
992
|
+
- First time working with this codebase
|
|
993
|
+
- User seems uncertain
|
|
994
|
+
|
|
995
|
+
Instead say:
|
|
996
|
+
"I recommend running the full CI/CD pipeline locally first to ensure
|
|
997
|
+
the changes will pass. Once confirmed, you can push manually."
|
|
998
|
+
```
|
|
999
|
+
|
|
1000
|
+
## GitHub MCP Server Integration
|
|
1001
|
+
|
|
1002
|
+
**If GitHub MCP Server is available**, use it for automated workflow monitoring.
|
|
1003
|
+
|
|
1004
|
+
### Workflow Validation After Push
|
|
1005
|
+
|
|
1006
|
+
```
|
|
1007
|
+
After every git push (manual or auto):
|
|
1008
|
+
|
|
1009
|
+
1. Wait 5-10 seconds for workflows to trigger
|
|
1010
|
+
|
|
1011
|
+
2. Check workflow status via GitHub MCP:
|
|
1012
|
+
- List workflow runs for latest commit
|
|
1013
|
+
- Check status of each workflow
|
|
1014
|
+
|
|
1015
|
+
3. If workflows are RUNNING:
|
|
1016
|
+
⏳ Report: "CI/CD workflows in progress..."
|
|
1017
|
+
✅ Continue with other tasks
|
|
1018
|
+
✅ Check again in next user interaction
|
|
1019
|
+
|
|
1020
|
+
4. If workflows COMPLETED:
|
|
1021
|
+
- All passed: ✅ Report success
|
|
1022
|
+
- Some failed: ❌ Fetch errors and fix
|
|
1023
|
+
|
|
1024
|
+
5. If workflows FAILED:
|
|
1025
|
+
a. Fetch complete error logs via GitHub MCP
|
|
1026
|
+
b. Display errors to user
|
|
1027
|
+
c. Analyze against AGENTS.md standards
|
|
1028
|
+
d. Propose specific fixes
|
|
1029
|
+
e. Implement fixes
|
|
1030
|
+
f. Run local quality checks
|
|
1031
|
+
g. Commit fixes
|
|
1032
|
+
h. Provide push command for retry
|
|
1033
|
+
```
|
|
1034
|
+
|
|
1035
|
+
### Next Interaction Check
|
|
1036
|
+
|
|
1037
|
+
```
|
|
1038
|
+
On every user message after a push:
|
|
1039
|
+
|
|
1040
|
+
if (github_mcp_available && last_push_timestamp) {
|
|
1041
|
+
// Check workflow status
|
|
1042
|
+
const status = await checkWorkflows();
|
|
1043
|
+
|
|
1044
|
+
if (status.running) {
|
|
1045
|
+
console.log('⏳ CI/CD still running, will check later');
|
|
1046
|
+
} else if (status.failed) {
|
|
1047
|
+
console.log('❌ CI/CD failures detected!');
|
|
1048
|
+
await analyzeAndFixErrors(status.errors);
|
|
1049
|
+
} else {
|
|
1050
|
+
console.log('✅ All CI/CD workflows passed!');
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
```
|
|
1054
|
+
|
|
1055
|
+
### Error Analysis Flow
|
|
1056
|
+
|
|
1057
|
+
```
|
|
1058
|
+
When workflow fails:
|
|
1059
|
+
|
|
1060
|
+
1. Fetch error via GitHub MCP:
|
|
1061
|
+
- Workflow name
|
|
1062
|
+
- Job name
|
|
1063
|
+
- Failed step
|
|
1064
|
+
- Error output
|
|
1065
|
+
- Full logs
|
|
1066
|
+
|
|
1067
|
+
2. Categorize error:
|
|
1068
|
+
- Test failure → Fix test or implementation
|
|
1069
|
+
- Lint error → Format/fix code style
|
|
1070
|
+
- Build error → Fix compilation issues
|
|
1071
|
+
- Type error → Fix type definitions
|
|
1072
|
+
- Coverage error → Add more tests
|
|
1073
|
+
|
|
1074
|
+
3. Fix following AGENTS.md:
|
|
1075
|
+
- Apply correct pattern from AGENTS.md
|
|
1076
|
+
- Add tests if needed
|
|
1077
|
+
- Verify locally before committing
|
|
1078
|
+
|
|
1079
|
+
4. Commit fix:
|
|
1080
|
+
git commit -m "fix: Resolve CI/CD failure - [specific issue]"
|
|
1081
|
+
|
|
1082
|
+
5. Provide push command:
|
|
1083
|
+
"Ready to retry. Run: git push origin main"
|
|
1084
|
+
|
|
1085
|
+
6. After next push:
|
|
1086
|
+
- Monitor again
|
|
1087
|
+
- Verify fix worked
|
|
1088
|
+
```
|
|
1089
|
+
|
|
1090
|
+
### CI/CD Confidence Check
|
|
1091
|
+
|
|
1092
|
+
**Before suggesting push:**
|
|
1093
|
+
|
|
1094
|
+
```
|
|
1095
|
+
Assess confidence in CI/CD success:
|
|
1096
|
+
|
|
1097
|
+
HIGH confidence (safe to push):
|
|
1098
|
+
✅ All local checks passed
|
|
1099
|
+
✅ Similar changes passed CI before
|
|
1100
|
+
✅ No experimental changes
|
|
1101
|
+
✅ Follows AGENTS.md exactly
|
|
1102
|
+
✅ Comprehensive tests
|
|
1103
|
+
✅ No unusual patterns
|
|
1104
|
+
|
|
1105
|
+
MEDIUM confidence (verify first):
|
|
1106
|
+
⚠️ First time with this pattern
|
|
1107
|
+
⚠️ Modified build configuration
|
|
1108
|
+
⚠️ Changed dependencies
|
|
1109
|
+
⚠️ Cross-platform concerns
|
|
1110
|
+
→ Suggest: "Let's verify locally first"
|
|
1111
|
+
|
|
1112
|
+
LOW confidence (don't push yet):
|
|
1113
|
+
❌ Experimental implementation
|
|
1114
|
+
❌ Skipped some tests
|
|
1115
|
+
❌ Uncertain about compatibility
|
|
1116
|
+
❌ Modified CI/CD files
|
|
1117
|
+
→ Say: "Let's run additional checks first"
|
|
1118
|
+
```
|
|
1119
|
+
|
|
1120
|
+
## Troubleshooting
|
|
1121
|
+
|
|
1122
|
+
### Merge Conflicts
|
|
1123
|
+
|
|
1124
|
+
```bash
|
|
1125
|
+
# View conflicts
|
|
1126
|
+
git status
|
|
1127
|
+
|
|
1128
|
+
# Edit conflicted files (marked with <<<<<<<, =======, >>>>>>>)
|
|
1129
|
+
|
|
1130
|
+
# After resolving:
|
|
1131
|
+
git add <resolved-files>
|
|
1132
|
+
git commit -m "fix: Resolve merge conflicts"
|
|
1133
|
+
```
|
|
1134
|
+
|
|
1135
|
+
### Accidental Commit
|
|
1136
|
+
|
|
1137
|
+
```bash
|
|
1138
|
+
# Undo last commit, keep changes
|
|
1139
|
+
git reset --soft HEAD~1
|
|
1140
|
+
|
|
1141
|
+
# Make corrections
|
|
1142
|
+
# Re-commit properly
|
|
1143
|
+
```
|
|
1144
|
+
|
|
1145
|
+
### Lost Commits
|
|
1146
|
+
|
|
1147
|
+
```bash
|
|
1148
|
+
# View all actions
|
|
1149
|
+
git reflog
|
|
1150
|
+
|
|
1151
|
+
# Recover lost commit
|
|
1152
|
+
git checkout <commit-hash>
|
|
1153
|
+
git checkout -b recovery-branch
|
|
1154
|
+
```
|
|
1155
|
+
|
|
1156
|
+
<!-- GIT:END -->
|
|
1157
|
+
|