feat: complete code cleanup and create feature parity plan

Major Architecture Improvements:
- Separate JavaScript library (lib/) with proper build system
- Go CLI with embedded library using go:embed
- Hot reload development with Air integration
- Library + CLI build pipeline with npm run build

Code Cleanup:
- Remove obsolete assets (insertr-cli/assets/editor/)
- Clean up package.json metadata and dependencies
- Update .gitignore for new architecture
- Remove unused 'marked' dependency

New Documentation:
- Add comprehensive TODO.md with feature gap analysis
- Document critical gaps between prototype and current library
- Create phased implementation plan for feature parity
- Update DEVELOPMENT.md with hot reload workflow
- Add LIBRARY.md documenting new architecture

Hot Reload System:
- Air watches both Go CLI and JavaScript library
- Library changes trigger: rebuild → copy → CLI rebuild → serve
- Seamless development experience across full stack

Next Steps:
- Current library is basic proof-of-concept (prompt() editing)
- Archived prototype has production-ready features
- Phase 1 focuses on professional forms and authentication
- Phase 2 adds validation and content persistence
This commit is contained in:
2025-09-03 19:11:54 +02:00
parent f82d8bb287
commit ca3df47451
27 changed files with 1747 additions and 164 deletions

View File

@@ -0,0 +1,57 @@
/**
* ApiClient - Handle communication with content API
*/
export class ApiClient {
constructor(options = {}) {
this.baseUrl = options.apiEndpoint || '/api/content';
this.siteId = options.siteId || 'default';
}
async getContent(contentId) {
try {
const response = await fetch(`${this.baseUrl}/sites/${this.siteId}/content/${contentId}`);
return response.ok ? await response.json() : null;
} catch (error) {
console.warn('Failed to fetch content:', contentId, error);
return null;
}
}
async updateContent(contentId, content) {
try {
const response = await fetch(`${this.baseUrl}/sites/${this.siteId}/content/${contentId}`, {
method: 'PUT',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ value: content })
});
return response.ok;
} catch (error) {
console.error('Failed to update content:', contentId, error);
return false;
}
}
async createContent(contentId, content, type) {
try {
const response = await fetch(`${this.baseUrl}/sites/${this.siteId}/content`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
id: contentId,
value: content,
type: type
})
});
return response.ok;
} catch (error) {
console.error('Failed to create content:', contentId, error);
return false;
}
}
}