Skip to content

Remove file extensions from script names in scripts_list API endpoint#12

Merged
andchir merged 3 commits intoandchir:mainfrom
konard:issue-11-15a68f56f876
Dec 24, 2025
Merged

Remove file extensions from script names in scripts_list API endpoint#12
andchir merged 3 commits intoandchir:mainfrom
konard:issue-11-15a68f56f876

Conversation

@konard
Copy link
Copy Markdown
Contributor

@konard konard commented Dec 24, 2025

Summary

This pull request implements the requested feature from issue #11 to return script names without file extensions in the scripts_list API endpoint.

Changes Made

  • api/app.py: Modified the scripts_list() function to use os.path.splitext() to remove file extensions from script names before adding them to the response
  • examples/test_flask_api.py: Updated existing test to check for script names without extensions and added a new test case (test_scripts_list_names_without_extension) to verify no extensions are present
  • examples/verify_output.py: Added verification script for manual testing

Implementation Details

The fix is implemented in api/app.py at line 38-40:

# Remove file extension from the name
name_without_ext = os.path.splitext(filename)[0]
scripts.append({
    'name': name_without_ext,
    'size': os.path.getsize(filepath),
    'path': filepath
})

Testing

All tests pass successfully:

  • test_health_endpoint - Health check works correctly
  • test_index_endpoint - Root endpoint returns API info
  • test_scripts_list_endpoint - Scripts list endpoint returns correct structure
  • test_scripts_list_contains_expected_scripts - Expected scripts are present (without extensions)
  • test_scripts_list_names_without_extension - Verifies no extensions in script names

Example Output

Before: "name": "install-scripts-api-flask.sh"
After: "name": "install-scripts-api-flask"

Fixes

Fixes #11


🤖 Generated with Claude Code

konard and others added 2 commits December 24, 2025 23:36
Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: andchir#11
- Modified api/app.py to use os.path.splitext() to remove file extensions from script names
- Updated test_flask_api.py to verify script names are returned without extensions
- Added new test case to ensure no extensions are present in script names
- All tests passing

Fixes andchir#11

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] api - названия скриптов на роуте scripts_list должны быть без расширения Remove file extensions from script names in scripts_list API endpoint Dec 24, 2025
@konard konard marked this pull request as ready for review December 24, 2025 22:38
@konard
Copy link
Copy Markdown
Contributor Author

konard commented Dec 24, 2025

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $0.516333 USD
  • Calculated by Anthropic: $0.374993 USD
  • Difference: $-0.141341 (-27.37%)
    📎 Log file uploaded as GitHub Gist (162KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

@andchir andchir merged commit 1af8466 into andchir:main Dec 24, 2025
konard added a commit to konard/andchir-install_scripts that referenced this pull request Dec 25, 2025
- SSL сертификаты: проверка существования перед созданием (требование andchir#12)
- .env файлы: сохранение существующей конфигурации при повторном запуске
- Django createsuperuser: проверка существования пользователя admin

Изменения соответствуют требованиям из requirements_for_scripts_ru.md:
- Скрипты теперь полностью поддерживают идемпотентность
- При повторном запуске не перезаписываются важные данные

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

api - названия скриптов на роуте scripts_list должны быть без расширения

2 participants