Commit
·
657aec9
1
Parent(s):
7c72565
commit
Browse files
app.py
CHANGED
|
@@ -39,7 +39,7 @@ def load_commands():
|
|
| 39 |
return []
|
| 40 |
|
| 41 |
# Recursively find all .md files in commands directory
|
| 42 |
-
for cmd_file in
|
| 43 |
# Get the top-level category (first subdirectory under commands/)
|
| 44 |
parts = cmd_file.relative_to(commands_dir).parts
|
| 45 |
category = parts[0] if parts else 'misc'
|
|
@@ -50,6 +50,9 @@ def load_commands():
|
|
| 50 |
'category': category
|
| 51 |
})
|
| 52 |
|
|
|
|
|
|
|
|
|
|
| 53 |
return commands
|
| 54 |
|
| 55 |
def load_command_content(path):
|
|
@@ -91,8 +94,8 @@ def create_command_card(command):
|
|
| 91 |
description = ""
|
| 92 |
lines = content.split('\n')
|
| 93 |
if lines:
|
| 94 |
-
#
|
| 95 |
-
for line in lines[:
|
| 96 |
if line.strip() and not line.startswith('#'):
|
| 97 |
description = line.strip()
|
| 98 |
break
|
|
|
|
| 39 |
return []
|
| 40 |
|
| 41 |
# Recursively find all .md files in commands directory
|
| 42 |
+
for cmd_file in commands_dir.rglob("*.md"):
|
| 43 |
# Get the top-level category (first subdirectory under commands/)
|
| 44 |
parts = cmd_file.relative_to(commands_dir).parts
|
| 45 |
category = parts[0] if parts else 'misc'
|
|
|
|
| 50 |
'category': category
|
| 51 |
})
|
| 52 |
|
| 53 |
+
# Sort commands alphabetically by name
|
| 54 |
+
commands.sort(key=lambda x: x['name'].lower())
|
| 55 |
+
|
| 56 |
return commands
|
| 57 |
|
| 58 |
def load_command_content(path):
|
|
|
|
| 94 |
description = ""
|
| 95 |
lines = content.split('\n')
|
| 96 |
if lines:
|
| 97 |
+
# Skip the first line and find the first non-empty line as description
|
| 98 |
+
for line in lines[1:6]: # Start from second line, check up to 6 lines
|
| 99 |
if line.strip() and not line.startswith('#'):
|
| 100 |
description = line.strip()
|
| 101 |
break
|