moai-adk 0.4.0__py3-none-any.whl β 0.4.1__py3-none-any.whl
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.
Potentially problematic release.
This version of moai-adk might be problematic. Click here for more details.
- moai_adk/__init__.py +1 -8
- moai_adk/cli/commands/init.py +10 -5
- moai_adk/cli/commands/update.py +274 -118
- moai_adk/cli/prompts/init_prompts.py +14 -18
- moai_adk/core/diagnostics/slash_commands.py +1 -1
- moai_adk/core/project/backup_utils.py +1 -0
- moai_adk/core/project/phase_executor.py +3 -1
- moai_adk/core/project/validator.py +3 -2
- moai_adk/core/template/backup.py +11 -3
- moai_adk/core/template/merger.py +16 -3
- moai_adk/core/template/processor.py +22 -3
- moai_adk/templates/.claude/agents/alfred/cc-manager.md +443 -424
- moai_adk/templates/.claude/agents/alfred/debug-helper.md +116 -103
- moai_adk/templates/.claude/agents/alfred/doc-syncer.md +130 -116
- moai_adk/templates/.claude/agents/alfred/git-manager.md +186 -174
- moai_adk/templates/.claude/agents/alfred/implementation-planner.md +227 -213
- moai_adk/templates/.claude/agents/alfred/project-manager.md +205 -125
- moai_adk/templates/.claude/agents/alfred/quality-gate.md +224 -209
- moai_adk/templates/.claude/agents/alfred/spec-builder.md +174 -160
- moai_adk/templates/.claude/agents/alfred/tag-agent.md +151 -139
- moai_adk/templates/.claude/agents/alfred/tdd-implementer.md +209 -196
- moai_adk/templates/.claude/agents/alfred/trust-checker.md +247 -233
- moai_adk/templates/.claude/commands/alfred/0-project.md +673 -640
- moai_adk/templates/.claude/commands/alfred/1-plan.md +342 -333
- moai_adk/templates/.claude/commands/alfred/2-run.md +295 -285
- moai_adk/templates/.claude/commands/alfred/3-sync.md +366 -356
- moai_adk/templates/.claude/hooks/alfred/README.md +52 -52
- moai_adk/templates/.claude/hooks/alfred/alfred_hooks.py +44 -48
- moai_adk/templates/.claude/hooks/alfred/core/__init__.py +17 -17
- moai_adk/templates/.claude/hooks/alfred/core/checkpoint.py +59 -59
- moai_adk/templates/.claude/hooks/alfred/core/context.py +19 -19
- moai_adk/templates/.claude/hooks/alfred/core/project.py +52 -52
- moai_adk/templates/.claude/hooks/alfred/handlers/__init__.py +1 -1
- moai_adk/templates/.claude/hooks/alfred/handlers/notification.py +4 -4
- moai_adk/templates/.claude/hooks/alfred/handlers/session.py +27 -27
- moai_adk/templates/.claude/hooks/alfred/handlers/tool.py +16 -17
- moai_adk/templates/.claude/hooks/alfred/handlers/user.py +11 -11
- moai_adk/templates/.claude/output-styles/alfred/agentic-coding.md +308 -307
- moai_adk/templates/.claude/output-styles/alfred/moai-adk-learning.md +297 -296
- moai_adk/templates/.claude/output-styles/alfred/study-with-alfred.md +191 -190
- moai_adk/templates/.claude/skills/moai-alfred-code-reviewer/SKILL.md +112 -0
- moai_adk/templates/.claude/skills/moai-alfred-debugger-pro/SKILL.md +103 -0
- moai_adk/templates/.claude/skills/moai-alfred-ears-authoring/SKILL.md +103 -0
- moai_adk/templates/.claude/skills/moai-alfred-git-workflow/SKILL.md +95 -0
- moai_adk/templates/.claude/skills/moai-alfred-language-detection/SKILL.md +99 -0
- moai_adk/templates/.claude/skills/moai-alfred-performance-optimizer/SKILL.md +105 -0
- moai_adk/templates/.claude/skills/moai-alfred-refactoring-coach/SKILL.md +97 -0
- moai_adk/templates/.claude/skills/moai-alfred-spec-metadata-validation/SKILL.md +97 -0
- moai_adk/templates/.claude/skills/moai-alfred-tag-scanning/SKILL.md +90 -0
- moai_adk/templates/.claude/skills/moai-alfred-trust-validation/SKILL.md +99 -0
- moai_adk/templates/.claude/skills/moai-alfred-tui-survey/SKILL.md +87 -0
- moai_adk/templates/.claude/skills/moai-alfred-tui-survey/examples.md +62 -0
- moai_adk/templates/.claude/skills/moai-claude-code/SKILL.md +70 -43
- moai_adk/templates/.claude/skills/moai-claude-code/examples.md +141 -141
- moai_adk/templates/.claude/skills/moai-claude-code/reference.md +179 -165
- moai_adk/templates/.claude/skills/moai-claude-code/templates/agent-full.md +78 -78
- moai_adk/templates/.claude/skills/moai-claude-code/templates/command-full.md +90 -90
- moai_adk/templates/.claude/skills/moai-claude-code/templates/plugin-full.json +39 -25
- moai_adk/templates/.claude/skills/moai-claude-code/templates/settings-full.json +117 -74
- moai_adk/templates/.claude/skills/moai-claude-code/templates/skill-full.md +131 -134
- moai_adk/templates/.claude/skills/moai-domain-backend/SKILL.md +43 -12
- moai_adk/templates/.claude/skills/moai-domain-cli-tool/SKILL.md +43 -12
- moai_adk/templates/.claude/skills/moai-domain-data-science/SKILL.md +43 -12
- moai_adk/templates/.claude/skills/moai-domain-database/SKILL.md +43 -12
- moai_adk/templates/.claude/skills/moai-domain-devops/SKILL.md +43 -12
- moai_adk/templates/.claude/skills/moai-domain-frontend/SKILL.md +43 -12
- moai_adk/templates/.claude/skills/moai-domain-ml/SKILL.md +43 -11
- moai_adk/templates/.claude/skills/moai-domain-mobile-app/SKILL.md +43 -12
- moai_adk/templates/.claude/skills/moai-domain-security/SKILL.md +43 -12
- moai_adk/templates/.claude/skills/moai-domain-web-api/SKILL.md +43 -12
- moai_adk/templates/.claude/skills/moai-essentials-debug/SKILL.md +47 -11
- moai_adk/templates/.claude/skills/moai-essentials-perf/SKILL.md +47 -11
- moai_adk/templates/.claude/skills/moai-essentials-refactor/SKILL.md +51 -14
- moai_adk/templates/.claude/skills/moai-essentials-review/SKILL.md +46 -10
- moai_adk/templates/.claude/skills/moai-foundation-ears/SKILL.md +62 -25
- moai_adk/templates/.claude/skills/moai-foundation-git/SKILL.md +44 -17
- moai_adk/templates/.claude/skills/moai-foundation-langs/SKILL.md +44 -14
- moai_adk/templates/.claude/skills/moai-foundation-specs/SKILL.md +45 -13
- moai_adk/templates/.claude/skills/moai-foundation-tags/SKILL.md +46 -14
- moai_adk/templates/.claude/skills/moai-foundation-trust/SKILL.md +48 -8
- moai_adk/templates/.claude/skills/moai-lang-c/SKILL.md +44 -12
- moai_adk/templates/.claude/skills/moai-lang-clojure/SKILL.md +44 -12
- moai_adk/templates/.claude/skills/moai-lang-cpp/SKILL.md +44 -11
- moai_adk/templates/.claude/skills/moai-lang-csharp/SKILL.md +44 -11
- moai_adk/templates/.claude/skills/moai-lang-dart/SKILL.md +44 -12
- moai_adk/templates/.claude/skills/moai-lang-elixir/SKILL.md +44 -11
- moai_adk/templates/.claude/skills/moai-lang-go/SKILL.md +44 -11
- moai_adk/templates/.claude/skills/moai-lang-haskell/SKILL.md +44 -11
- moai_adk/templates/.claude/skills/moai-lang-java/SKILL.md +44 -12
- moai_adk/templates/.claude/skills/moai-lang-javascript/SKILL.md +44 -12
- moai_adk/templates/.claude/skills/moai-lang-julia/SKILL.md +44 -12
- moai_adk/templates/.claude/skills/moai-lang-kotlin/SKILL.md +44 -12
- moai_adk/templates/.claude/skills/moai-lang-lua/SKILL.md +44 -11
- moai_adk/templates/.claude/skills/moai-lang-php/SKILL.md +44 -11
- moai_adk/templates/.claude/skills/moai-lang-python/SKILL.md +44 -12
- moai_adk/templates/.claude/skills/moai-lang-r/SKILL.md +44 -11
- moai_adk/templates/.claude/skills/moai-lang-ruby/SKILL.md +44 -11
- moai_adk/templates/.claude/skills/moai-lang-rust/SKILL.md +44 -12
- moai_adk/templates/.claude/skills/moai-lang-scala/SKILL.md +44 -12
- moai_adk/templates/.claude/skills/moai-lang-shell/SKILL.md +44 -11
- moai_adk/templates/.claude/skills/moai-lang-sql/SKILL.md +44 -12
- moai_adk/templates/.claude/skills/moai-lang-swift/SKILL.md +44 -12
- moai_adk/templates/.claude/skills/moai-lang-typescript/SKILL.md +44 -12
- moai_adk/templates/.github/PULL_REQUEST_TEMPLATE.md +44 -43
- moai_adk/templates/.github/workflows/moai-gitflow.yml +36 -35
- moai_adk/templates/.moai/config.json +9 -6
- moai_adk/templates/.moai/memory/development-guide.md +220 -221
- moai_adk/templates/.moai/memory/gitflow-protection-policy.md +85 -85
- moai_adk/templates/.moai/memory/spec-metadata.md +149 -150
- moai_adk/templates/.moai/project/product.md +90 -90
- moai_adk/templates/.moai/project/structure.md +85 -85
- moai_adk/templates/.moai/project/tech.md +117 -117
- moai_adk/templates/CLAUDE.md +350 -722
- moai_adk-0.4.1.dist-info/METADATA +303 -0
- moai_adk-0.4.1.dist-info/RECORD +152 -0
- moai_adk/templates/.claude/commands/alfred/1-spec.md +0 -31
- moai_adk/templates/.claude/commands/alfred/2-build.md +0 -30
- moai_adk/templates/.claude/skills/scripts/standardize_skills.py +0 -166
- moai_adk/templates/.claude/skills/scripts/verify_standardization.sh +0 -43
- moai_adk/templates/.moai/hooks/pre-push.sample +0 -88
- moai_adk-0.4.0.dist-info/METADATA +0 -1816
- moai_adk-0.4.0.dist-info/RECORD +0 -145
- {moai_adk-0.4.0.dist-info β moai_adk-0.4.1.dist-info}/WHEEL +0 -0
- {moai_adk-0.4.0.dist-info β moai_adk-0.4.1.dist-info}/entry_points.txt +0 -0
- {moai_adk-0.4.0.dist-info β moai_adk-0.4.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
"""
|
|
3
|
-
Skills νμ€ν ν΅ν© μ€ν¬λ¦½νΈ
|
|
4
|
-
- YAML νλ μ 리 (version, author, license, tags, model μ κ±°)
|
|
5
|
-
- allowed-tools μΆκ° (λλ½λ μ€ν¬μλ§)
|
|
6
|
-
"""
|
|
7
|
-
|
|
8
|
-
import sys
|
|
9
|
-
import re
|
|
10
|
-
from pathlib import Path
|
|
11
|
-
|
|
12
|
-
# Alfred μμ΄μ νΈ λꡬ
|
|
13
|
-
ALFRED_TOOLS = ["Read", "Write", "Edit", "Bash", "TodoWrite"]
|
|
14
|
-
# Lang μ€ν¬ λꡬ
|
|
15
|
-
LANG_TOOLS = ["Read", "Bash"]
|
|
16
|
-
# Domain μ€ν¬ λꡬ
|
|
17
|
-
DOMAIN_TOOLS = ["Read", "Bash"]
|
|
18
|
-
|
|
19
|
-
def parse_yaml_frontmatter(content):
|
|
20
|
-
"""YAML frontmatter νμ± (κ°λ¨ν νμ)"""
|
|
21
|
-
if not content.startswith('---'):
|
|
22
|
-
return None, content
|
|
23
|
-
|
|
24
|
-
parts = content.split('---', 2)
|
|
25
|
-
if len(parts) < 3:
|
|
26
|
-
return None, content
|
|
27
|
-
|
|
28
|
-
yaml_str = parts[1]
|
|
29
|
-
body = parts[2]
|
|
30
|
-
|
|
31
|
-
# YAML νμ± (λμ
λ리λ‘)
|
|
32
|
-
data = {}
|
|
33
|
-
current_key = None
|
|
34
|
-
in_list = False
|
|
35
|
-
|
|
36
|
-
for line in yaml_str.strip().split('\n'):
|
|
37
|
-
if not line.strip():
|
|
38
|
-
continue
|
|
39
|
-
|
|
40
|
-
# 리μ€νΈ μμ΄ν
|
|
41
|
-
if line.strip().startswith('-'):
|
|
42
|
-
if in_list and current_key:
|
|
43
|
-
if isinstance(data[current_key], list):
|
|
44
|
-
data[current_key].append(line.strip()[1:].strip())
|
|
45
|
-
continue
|
|
46
|
-
|
|
47
|
-
# ν€-κ° μ
|
|
48
|
-
if ':' in line:
|
|
49
|
-
key, value = line.split(':', 1)
|
|
50
|
-
key = key.strip()
|
|
51
|
-
value = value.strip()
|
|
52
|
-
|
|
53
|
-
if not value: # 리μ€νΈ μμ
|
|
54
|
-
in_list = True
|
|
55
|
-
current_key = key
|
|
56
|
-
data[key] = []
|
|
57
|
-
else:
|
|
58
|
-
in_list = False
|
|
59
|
-
current_key = None
|
|
60
|
-
data[key] = value
|
|
61
|
-
|
|
62
|
-
return data, body
|
|
63
|
-
|
|
64
|
-
def build_yaml_frontmatter(data):
|
|
65
|
-
"""λμ
λ리λ₯Ό YAML frontmatterλ‘ λ³ν"""
|
|
66
|
-
lines = []
|
|
67
|
-
for key, value in data.items():
|
|
68
|
-
if isinstance(value, list):
|
|
69
|
-
lines.append(f"{key}:")
|
|
70
|
-
for item in value:
|
|
71
|
-
lines.append(f" - {item}")
|
|
72
|
-
else:
|
|
73
|
-
lines.append(f"{key}: {value}")
|
|
74
|
-
|
|
75
|
-
return '\n'.join(lines)
|
|
76
|
-
|
|
77
|
-
def standardize_skill(skill_file):
|
|
78
|
-
"""μ€ν¬ νμΌ νμ€ν"""
|
|
79
|
-
content = skill_file.read_text()
|
|
80
|
-
|
|
81
|
-
data, body = parse_yaml_frontmatter(content)
|
|
82
|
-
|
|
83
|
-
if data is None:
|
|
84
|
-
print(f"β οΈ No YAML frontmatter: {skill_file}")
|
|
85
|
-
return False
|
|
86
|
-
|
|
87
|
-
# 보쑴ν νλλ§ μΆμΆ
|
|
88
|
-
preserved = {}
|
|
89
|
-
|
|
90
|
-
if 'name' in data:
|
|
91
|
-
preserved['name'] = data['name']
|
|
92
|
-
if 'description' in data:
|
|
93
|
-
preserved['description'] = data['description']
|
|
94
|
-
|
|
95
|
-
# allowed-tools μ²λ¦¬
|
|
96
|
-
if 'allowed-tools' in data:
|
|
97
|
-
# μ΄λ―Έ μμΌλ©΄ μ μ§
|
|
98
|
-
preserved['allowed-tools'] = data['allowed-tools']
|
|
99
|
-
else:
|
|
100
|
-
# μμΌλ©΄ μ€ν¬ μ νλ³λ‘ μΆκ°
|
|
101
|
-
name = data.get('name', '')
|
|
102
|
-
|
|
103
|
-
if 'alfred' in name:
|
|
104
|
-
tools = ALFRED_TOOLS
|
|
105
|
-
elif 'lang' in name:
|
|
106
|
-
tools = LANG_TOOLS
|
|
107
|
-
elif 'domain' in name:
|
|
108
|
-
tools = DOMAIN_TOOLS
|
|
109
|
-
elif 'claude-code' in name:
|
|
110
|
-
# moai-claude-codeλ μ΄λ―Έ allowed-tools μμ (건λλ°κΈ°)
|
|
111
|
-
tools = None
|
|
112
|
-
else:
|
|
113
|
-
# κΈ°λ³Έκ°
|
|
114
|
-
tools = ["Read"]
|
|
115
|
-
|
|
116
|
-
if tools:
|
|
117
|
-
preserved['allowed-tools'] = tools
|
|
118
|
-
|
|
119
|
-
# νμΌ μ¬μμ±
|
|
120
|
-
new_yaml = build_yaml_frontmatter(preserved)
|
|
121
|
-
new_content = f"---\n{new_yaml}\n---{body}"
|
|
122
|
-
|
|
123
|
-
skill_file.write_text(new_content)
|
|
124
|
-
print(f"β
Standardized: {skill_file.name}")
|
|
125
|
-
return True
|
|
126
|
-
|
|
127
|
-
def main():
|
|
128
|
-
"""λ©μΈ ν¨μ"""
|
|
129
|
-
base_dir = Path("/Users/goos/MoAI/MoAI-ADK")
|
|
130
|
-
|
|
131
|
-
# .claude/skills/
|
|
132
|
-
skills_dir = base_dir / ".claude/skills"
|
|
133
|
-
success_count = 0
|
|
134
|
-
fail_count = 0
|
|
135
|
-
|
|
136
|
-
for skill_dir in sorted(skills_dir.glob("moai-*")):
|
|
137
|
-
skill_file = skill_dir / "SKILL.md"
|
|
138
|
-
if skill_file.exists():
|
|
139
|
-
try:
|
|
140
|
-
if standardize_skill(skill_file):
|
|
141
|
-
success_count += 1
|
|
142
|
-
else:
|
|
143
|
-
fail_count += 1
|
|
144
|
-
except Exception as e:
|
|
145
|
-
print(f"β Error: {skill_file.name} - {e}")
|
|
146
|
-
fail_count += 1
|
|
147
|
-
|
|
148
|
-
# src/moai_adk/templates/.claude/skills/
|
|
149
|
-
templates_dir = base_dir / "src/moai_adk/templates/.claude/skills"
|
|
150
|
-
for skill_dir in sorted(templates_dir.glob("moai-*")):
|
|
151
|
-
skill_file = skill_dir / "SKILL.md"
|
|
152
|
-
if skill_file.exists():
|
|
153
|
-
try:
|
|
154
|
-
if standardize_skill(skill_file):
|
|
155
|
-
success_count += 1
|
|
156
|
-
else:
|
|
157
|
-
fail_count += 1
|
|
158
|
-
except Exception as e:
|
|
159
|
-
print(f"β Error: {skill_file.name} - {e}")
|
|
160
|
-
fail_count += 1
|
|
161
|
-
|
|
162
|
-
print(f"\nπ Summary: {success_count} succeeded, {fail_count} failed")
|
|
163
|
-
return 0 if fail_count == 0 else 1
|
|
164
|
-
|
|
165
|
-
if __name__ == "__main__":
|
|
166
|
-
sys.exit(main())
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
echo "=== Skills νμ€ν κ²μ¦ ==="
|
|
4
|
-
|
|
5
|
-
# 1. νμΌλͺ
κ²μ¦
|
|
6
|
-
skill_md_count=$(find .claude/skills/ -name "skill.md" 2>/dev/null | wc -l | tr -d ' ')
|
|
7
|
-
SKILL_md_count=$(find .claude/skills/ -name "SKILL.md" 2>/dev/null | wc -l | tr -d ' ')
|
|
8
|
-
|
|
9
|
-
echo "1. νμΌλͺ
νμ€ν:"
|
|
10
|
-
echo " - skill.md (λΉνμ€): $skill_md_count (0μ΄μ΄μΌ ν¨)"
|
|
11
|
-
echo " - SKILL.md (νμ€): $SKILL_md_count (46μ΄μ΄μΌ ν¨)"
|
|
12
|
-
|
|
13
|
-
# 2. μ€λ³΅ ν
νλ¦Ώ κ²μ¦
|
|
14
|
-
duplicate_count=$(ls .claude/skills/ 2>/dev/null | grep -c "moai-cc-.*-template" || echo 0)
|
|
15
|
-
|
|
16
|
-
echo "2. μ€λ³΅ ν
νλ¦Ώ:"
|
|
17
|
-
echo " - moai-cc-*-template: $duplicate_count (0μ΄μ΄μΌ ν¨)"
|
|
18
|
-
|
|
19
|
-
# 3. YAML νλ κ²μ¦
|
|
20
|
-
version_count=$(rg "^version:" .claude/skills/*/SKILL.md 2>/dev/null | wc -l | tr -d ' ')
|
|
21
|
-
model_count=$(rg "^model:" .claude/skills/*/SKILL.md 2>/dev/null | wc -l | tr -d ' ')
|
|
22
|
-
allowed_tools_count=$(rg "^allowed-tools:" .claude/skills/*/SKILL.md 2>/dev/null | wc -l | tr -d ' ')
|
|
23
|
-
|
|
24
|
-
echo "3. YAML νλ:"
|
|
25
|
-
echo " - version νλ: $version_count (0μ΄μ΄μΌ ν¨)"
|
|
26
|
-
echo " - model νλ: $model_count (0μ΄μ΄μΌ ν¨)"
|
|
27
|
-
echo " - allowed-tools νλ: $allowed_tools_count (46μ΄μ΄μΌ ν¨)"
|
|
28
|
-
|
|
29
|
-
# μ’
ν© νμ
|
|
30
|
-
if [ "$skill_md_count" -eq 0 ] && \
|
|
31
|
-
[ "$SKILL_md_count" -eq 46 ] && \
|
|
32
|
-
[ "$duplicate_count" -eq 0 ] && \
|
|
33
|
-
[ "$version_count" -eq 0 ] && \
|
|
34
|
-
[ "$model_count" -eq 0 ] && \
|
|
35
|
-
[ "$allowed_tools_count" -eq 46 ]; then
|
|
36
|
-
echo ""
|
|
37
|
-
echo "β
λͺ¨λ κ²μ¦ ν΅κ³Ό!"
|
|
38
|
-
exit 0
|
|
39
|
-
else
|
|
40
|
-
echo ""
|
|
41
|
-
echo "β κ²μ¦ μ€ν¨. μ νλͺ©μ νμΈνμΈμ."
|
|
42
|
-
exit 1
|
|
43
|
-
fi
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# MoAI-ADK GitFlow Main Branch Advisory Hook
|
|
4
|
-
# Purpose: Advisory warnings for main branch operations (not blocking)
|
|
5
|
-
# Enforces: Best practices with flexibility
|
|
6
|
-
#
|
|
7
|
-
# This hook runs before any git push operation and provides advisories:
|
|
8
|
-
# 1. Warns about direct push to main branch (but allows it)
|
|
9
|
-
# 2. Warns about force-push to main branch (but allows it)
|
|
10
|
-
# 3. Recommends GitFlow best practices
|
|
11
|
-
#
|
|
12
|
-
# Exit codes:
|
|
13
|
-
# 0 - Push allowed (always)
|
|
14
|
-
|
|
15
|
-
set -e
|
|
16
|
-
|
|
17
|
-
# Colors for output
|
|
18
|
-
RED='\033[0;31m'
|
|
19
|
-
YELLOW='\033[1;33m'
|
|
20
|
-
GREEN='\033[0;32m'
|
|
21
|
-
BLUE='\033[0;34m'
|
|
22
|
-
NC='\033[0m' # No Color
|
|
23
|
-
|
|
24
|
-
# Read from stdin (git sends remote, local ref info)
|
|
25
|
-
# Format: <local ref> <local oid> <remote ref> <remote oid>
|
|
26
|
-
while read local_ref local_oid remote_ref remote_oid; do
|
|
27
|
-
# Extract the remote branch name from the reference
|
|
28
|
-
# remote_ref format: refs/heads/main
|
|
29
|
-
remote_branch=$(echo "$remote_ref" | sed 's|refs/heads/||')
|
|
30
|
-
local_branch=$(echo "$local_ref" | sed 's|refs/heads/||')
|
|
31
|
-
|
|
32
|
-
# Check if attempting to push to main branch
|
|
33
|
-
if [ "$remote_branch" = "main" ] || [ "$remote_branch" = "master" ]; then
|
|
34
|
-
# Get the current branch to determine if this is the develop branch
|
|
35
|
-
current_branch=$(git rev-parse --abbrev-ref HEAD)
|
|
36
|
-
|
|
37
|
-
# Advisory: recommend develop -> main workflow
|
|
38
|
-
if [ "$local_branch" != "develop" ] && [ "${local_branch#release/}" = "$local_branch" ]; then
|
|
39
|
-
echo ""
|
|
40
|
-
echo -e "${YELLOW}β οΈ ADVISORY: Non-standard GitFlow detected${NC}"
|
|
41
|
-
echo ""
|
|
42
|
-
echo -e "${BLUE}Current branch: ${local_branch}${NC}"
|
|
43
|
-
echo -e "${BLUE}Target branch: ${remote_branch}${NC}"
|
|
44
|
-
echo ""
|
|
45
|
-
echo "Recommended GitFlow workflow:"
|
|
46
|
-
echo " 1. Work on feature/SPEC-{ID} branch (created from develop)"
|
|
47
|
-
echo " 2. Push to feature/SPEC-{ID} and create PR to develop"
|
|
48
|
-
echo " 3. Merge into develop after code review"
|
|
49
|
-
echo " 4. When develop is stable, create PR from develop to main"
|
|
50
|
-
echo " 5. Release manager merges develop -> main with tag"
|
|
51
|
-
echo ""
|
|
52
|
-
echo -e "${GREEN}β Push will proceed (flexibility mode enabled)${NC}"
|
|
53
|
-
echo ""
|
|
54
|
-
fi
|
|
55
|
-
|
|
56
|
-
# Check for delete operation
|
|
57
|
-
if [ "$local_oid" = "0000000000000000000000000000000000000000" ]; then
|
|
58
|
-
echo ""
|
|
59
|
-
echo -e "${RED}β οΈ WARNING: Attempting to delete main branch${NC}"
|
|
60
|
-
echo ""
|
|
61
|
-
echo -e "${YELLOW}This operation is highly discouraged.${NC}"
|
|
62
|
-
echo -e "${GREEN}β Push will proceed (flexibility mode enabled)${NC}"
|
|
63
|
-
echo ""
|
|
64
|
-
fi
|
|
65
|
-
|
|
66
|
-
# Check for force push attempts to main
|
|
67
|
-
if [ "$remote_branch" = "main" ] || [ "$remote_branch" = "master" ]; then
|
|
68
|
-
# Check if remote_oid exists (non-zero means we're trying to update existing ref)
|
|
69
|
-
if [ "$remote_oid" != "0000000000000000000000000000000000000000" ]; then
|
|
70
|
-
# Verify this is a fast-forward merge (no force push)
|
|
71
|
-
if ! git merge-base --is-ancestor "$remote_oid" "$local_oid" 2>/dev/null; then
|
|
72
|
-
echo ""
|
|
73
|
-
echo -e "${YELLOW}β οΈ ADVISORY: Force-push to main branch detected${NC}"
|
|
74
|
-
echo ""
|
|
75
|
-
echo "Recommended approach:"
|
|
76
|
-
echo " - Use GitHub PR with proper code review"
|
|
77
|
-
echo " - Ensure changes are merged via fast-forward"
|
|
78
|
-
echo ""
|
|
79
|
-
echo -e "${GREEN}β Push will proceed (flexibility mode enabled)${NC}"
|
|
80
|
-
echo ""
|
|
81
|
-
fi
|
|
82
|
-
fi
|
|
83
|
-
fi
|
|
84
|
-
fi
|
|
85
|
-
done
|
|
86
|
-
|
|
87
|
-
# All checks passed (or advisory warnings shown)
|
|
88
|
-
exit 0
|