Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: Bug report
about: Report something that is broken or behaving unexpectedly
title: "[Bug] "
labels: bug
assignees: ""
---

## Summary

Describe the problem clearly.

## Steps To Reproduce

1. Go to
2. Click
3. Observe

## Expected Behavior

Describe what you expected to happen.

## Actual Behavior

Describe what actually happened.

## Environment

- OS:
- Browser:
- Python version:

## Notes

Add screenshots, sample files, or extra context if helpful.
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: true
contact_links:
- name: Contribution Guide
url: https://github.com/oywino/python_xml_editor/blob/main/CONTRIBUTING.md
about: Read the project workflow and contribution notes before opening large changes.
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Feature request
about: Suggest an improvement or new capability
title: "[Feature] "
labels: enhancement
assignees: ""
---

## Summary

Describe the feature or improvement.

## Problem

What problem would this solve for users or maintainers?

## Proposed Change

Describe the preferred behavior or workflow.

## Alternatives Considered

List any alternatives you already considered.

## Notes

Add screenshots, examples, or links if helpful.
11 changes: 11 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Summary

- describe the change

## Testing

- describe how you tested it

## UI Notes

- add screenshots or short notes if the interface changed
37 changes: 37 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: CI

on:
push:
branches:
- main
- chore/**
- feature/**
- fix/**
pull_request:

jobs:
validate:
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Compile Python launcher
run: python -m py_compile app.py

- name: Verify required app files exist
run: |
test -f app.js
test -f index.html
test -f style.css

- name: Verify browser entrypoint references assets
run: |
grep -q 'style.css' index.html
grep -q 'app.js' index.html
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
__pycache__/
*.py[cod]
*.log
.DS_Store
Thumbs.db
.codex-gh/
49 changes: 49 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Contributing

## Workflow

1. Branch from `main`.
2. Keep changes focused and easy to review.
3. Test locally before opening a pull request.
4. Describe user-facing behavior changes clearly in the PR.

Suggested branch prefixes:

- `feature/` for new functionality
- `fix/` for bug fixes
- `chore/` for maintenance and repo setup

## Pull Request Checklist

- explain what changed
- explain why it changed
- note how it was tested
- include screenshots for UI changes when useful
- mention any parsing or export behavior changes explicitly

## Local Run

```bash
python app.py
```

If needed on Windows:

```bash
py app.py
```

## Project Expectations

- prefer simple, readable changes over heavy abstractions
- keep the static app easy to run without extra dependencies
- document changes that affect file formats, parsing, or export behavior

## Issues

Use the GitHub issue templates for:

- bug reports
- feature requests

For larger changes, open an issue first so the implementation plan is easy to discuss.
88 changes: 86 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,86 @@
# python_xml_editor
This app is essentially a browser-based XML prompt editor with a very small Python launcher in front of it.
# Python XML Editor

`python_xml_editor` is a local browser-based XML prompt editor with a tiny Python launcher.

It is designed for editing prompt documents that contain:

- a free-form preamble, such as a Markdown heading or note
- an XML body that can be edited visually instead of by hand

The app runs entirely locally. Python serves the static files, and the browser handles parsing, editing, preview, and export.

## Features

- open `.md`, `.txt`, and `.xml` files
- edit a prompt preamble separately from the XML structure
- rename tags and edit attributes inline
- add root, child, and sibling elements
- reorder nodes with buttons or drag-and-drop
- edit text nodes directly
- preview raw XML output
- export either AI-ready XML text or full editor format

## Project Structure

- `app.py`: local launcher that serves the app and opens the browser
- `index.html`: single HTML mount point
- `app.js`: main application logic, parsing, tree editing, rendering, and export
- `style.css`: application styling
- `CONTRIBUTING.md`: contribution workflow and expectations
- `docs/ARCHITECTURE.md`: architecture and state model notes

## Requirements

- Python 3.10 or newer is recommended
- no third-party Python dependencies are required

## Run Locally

From the repository root:

```bash
python app.py
```

If your machine uses the Windows launcher instead of `python`, you can also use:

```bash
py app.py
```

The launcher will:

1. find a free local port
2. serve the repository directory over HTTP
3. open `index.html` in your default browser

Stop the server with `Ctrl+C`.

## Development Workflow

1. branch from `main`
2. make and test your changes locally
3. open a pull request with a clear summary
4. include screenshots for UI changes when useful

This repository includes:

- a pull request template in `.github/pull_request_template.md`
- issue templates for bugs and feature requests
- a basic GitHub Actions workflow for pull requests and pushes

## Architecture

The application has two parts:

1. a Python wrapper in `app.py` that starts a local HTTP server
2. a plain JavaScript single-page app in `app.js` that parses mixed preamble + XML text into a tree, renders it visually, and serializes it back out for export

The editor keeps all state in memory in the browser session and does not currently save automatically.

More detail is available in `docs/ARCHITECTURE.md`.

## Notes

- the XML parsing logic is custom and currently optimized for simple prompt-style XML
- the app is intentionally lightweight and has no front-end framework or backend service
Loading
Loading