# Tags & taxonomy – plan

Tags and taxonomy are implemented **primarily in new files** to keep the app maintainable and consistent with the snippets pattern.

## Scope

- **Snippets:** Already have tags (no change in this feature).
- **Projects, frameworks, guides:** Add optional `tags` (array of strings). DB columns added in `066_add_tags_to_projects_frameworks_guides.sql`.

## New files

| File | Purpose |
|------|--------|
| `js/app-tags.js` | Data layer: `getTags(type, id)`, `setTags(type, id, tags)`, `getUniqueTagsForType(type)`. Uses existing `getStored*` / `setStored*` from app-data. |
| `js/app-tags-ui.js` | (Later) UI: tag input/autocomplete, filter dropdowns by tag. |
| `docs/TAGS_TAXONOMY_PLAN.md` | This plan. |

## Persistence

- **In-memory / localStorage:** app-tags.js reads and writes entity `.tags` via existing getStored*/setStored*.
- **Supabase:** projectToRow, frameworkToRow, guideToRow and rowToProject, rowToFramework, rowToGuide in app-data.js include `tags`. Load uses select('*') so tags are returned. Upload-local uses the same *ToRow helpers so tags are sent.

## Phases

1. **Branch + data layer (this branch)**  
   Migration 066, `js/app-tags.js`, script tag in index.html. No UI yet. ✅

2. **Persistence in app-data**  
   Add `tags` to projectToRow/rowToProject, frameworkToRow/rowToFramework, guideToRow/rowToGuide so tags sync to Supabase. ✅

3. **UI**  
   `js/app-tags-ui.js`: tag field in project/framework/guide forms, filter-by-tag where useful (e.g. framework picker, guide dropdown).

4. **Optional: shared taxonomy**  
   If we need a controlled list (e.g. suggested tags per type), add a small vocabulary or taxonomy table and wire autocomplete to it.

## Entity types

- `Blueprint.tags.ENTITY_TYPES.project` → projects
- `Blueprint.tags.ENTITY_TYPES.framework` → frameworks  
- `Blueprint.tags.ENTITY_TYPES.guide` → guides

Snippets stay on Blueprint.snippets (getUniqueSnippetTags, etc.).
