feat: 添加g3fo-commit-jira skill

This commit is contained in:
2026-03-16 18:11:34 +08:00
parent 2768d58aa3
commit dc2d6697af
13 changed files with 960 additions and 24 deletions
+15 -15
View File
@@ -207,15 +207,15 @@ def init_skill(skill_name, path):
# Check if directory already exists
if skill_dir.exists():
print(f"❌ Error: Skill directory already exists: {skill_dir}")
print(f"Error: Skill directory already exists: {skill_dir}")
return None
# Create skill directory
try:
skill_dir.mkdir(parents=True, exist_ok=False)
print(f"✅ Created skill directory: {skill_dir}")
print(f"Created skill directory: {skill_dir}")
except Exception as e:
print(f"❌ Error creating directory: {e}")
print(f"Error creating directory: {e}")
return None
# Create SKILL.md from template
@@ -227,10 +227,10 @@ def init_skill(skill_name, path):
skill_md_path = skill_dir / 'SKILL.md'
try:
skill_md_path.write_text(skill_content)
print("✅ Created SKILL.md")
skill_md_path.write_text(skill_content, encoding='utf-8')
print("Created SKILL.md")
except Exception as e:
print(f"❌ Error creating SKILL.md: {e}")
print(f"Error creating SKILL.md: {e}")
return None
# Create resource directories with example files
@@ -239,29 +239,29 @@ def init_skill(skill_name, path):
scripts_dir = skill_dir / 'scripts'
scripts_dir.mkdir(exist_ok=True)
example_script = scripts_dir / 'example.py'
example_script.write_text(EXAMPLE_SCRIPT.format(skill_name=skill_name))
example_script.write_text(EXAMPLE_SCRIPT.format(skill_name=skill_name), encoding='utf-8')
example_script.chmod(0o755)
print("✅ Created scripts/example.py")
print("Created scripts/example.py")
# Create references/ directory with example reference doc
references_dir = skill_dir / 'references'
references_dir.mkdir(exist_ok=True)
example_reference = references_dir / 'api_reference.md'
example_reference.write_text(EXAMPLE_REFERENCE.format(skill_title=skill_title))
print("✅ Created references/api_reference.md")
example_reference.write_text(EXAMPLE_REFERENCE.format(skill_title=skill_title), encoding='utf-8')
print("Created references/api_reference.md")
# Create assets/ directory with example asset placeholder
assets_dir = skill_dir / 'assets'
assets_dir.mkdir(exist_ok=True)
example_asset = assets_dir / 'example_asset.txt'
example_asset.write_text(EXAMPLE_ASSET)
print("✅ Created assets/example_asset.txt")
example_asset.write_text(EXAMPLE_ASSET, encoding='utf-8')
print("Created assets/example_asset.txt")
except Exception as e:
print(f"❌ Error creating resource directories: {e}")
print(f"Error creating resource directories: {e}")
return None
# Print next steps
print(f"\n✅ Skill '{skill_name}' initialized successfully at {skill_dir}")
print(f"\nSkill '{skill_name}' initialized successfully at {skill_dir}")
print("\nNext steps:")
print("1. Edit SKILL.md to complete the TODO items and update the description")
print("2. Customize or delete the example files in scripts/, references/, and assets/")
@@ -287,7 +287,7 @@ def main():
skill_name = sys.argv[1]
path = sys.argv[3]
print(f"🚀 Initializing skill: {skill_name}")
print(f"Initializing skill: {skill_name}")
print(f" Location: {path}")
print()
@@ -45,13 +45,13 @@ def package_skill(skill_path, output_dir=None):
return None
# Run validation before packaging
print("🔍 Validating skill...")
print("Validating skill...")
valid, message = validate_skill(skill_path)
if not valid:
print(f"❌ Validation failed: {message}")
print(f"Validation failed: {message}")
print(" Please fix the validation errors before packaging.")
return None
print(f"✅ {message}\n")
print(f"{message}\n")
# Determine output location
skill_name = skill_path.name
@@ -74,11 +74,11 @@ def package_skill(skill_path, output_dir=None):
zipf.write(file_path, arcname)
print(f" Added: {arcname}")
print(f"\n✅ Successfully packaged skill to: {skill_filename}")
print(f"\nSuccessfully packaged skill to: {skill_filename}")
return skill_filename
except Exception as e:
print(f"❌ Error creating .skill file: {e}")
print(f"Error creating .skill file: {e}")
return None
@@ -93,7 +93,7 @@ def main():
skill_path = sys.argv[1]
output_dir = sys.argv[2] if len(sys.argv) > 2 else None
print(f"📦 Packaging skill: {skill_path}")
print(f"Packaging skill: {skill_path}")
if output_dir:
print(f" Output directory: {output_dir}")
print()
@@ -19,7 +19,7 @@ def validate_skill(skill_path):
return False, "SKILL.md not found"
# Read and validate frontmatter
content = skill_md.read_text()
content = skill_md.read_text(encoding='utf-8')
if not content.startswith('---'):
return False, "No YAML frontmatter found"