feat: source attribution para funciones externas

Sistema de extracción de funciones desde repos externos. Agrega campos
source_repo, source_license y source_file en functions y types (migración 006).
Incluye manifest sources/sources.yaml, regla sources.md, parser con campos
de atribución, y template actualizado con los nuevos campos.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-30 14:23:53 +02:00
parent e349a06ad4
commit ef86aae8fb
6 changed files with 100 additions and 2 deletions
@@ -0,0 +1,8 @@
-- Source attribution for functions extracted from external repositories.
ALTER TABLE functions ADD COLUMN source_repo TEXT NOT NULL DEFAULT '';
ALTER TABLE functions ADD COLUMN source_license TEXT NOT NULL DEFAULT '';
ALTER TABLE functions ADD COLUMN source_file TEXT NOT NULL DEFAULT '';
ALTER TABLE types ADD COLUMN source_repo TEXT NOT NULL DEFAULT '';
ALTER TABLE types ADD COLUMN source_license TEXT NOT NULL DEFAULT '';
ALTER TABLE types ADD COLUMN source_file TEXT NOT NULL DEFAULT '';
+16 -2
View File
@@ -32,6 +32,11 @@ type rawFunction struct {
TestFilePath string `yaml:"test_file_path"`
FilePath string `yaml:"file_path"`
// Source attribution
SourceRepo string `yaml:"source_repo"`
SourceLicense string `yaml:"source_license"`
SourceFile string `yaml:"source_file"`
// Component fields
Props []PropDef `yaml:"props"`
Emits []string `yaml:"emits"`
@@ -50,8 +55,11 @@ type rawType struct {
Definition string `yaml:"definition"`
Description string `yaml:"description"`
Tags []string `yaml:"tags"`
UsesTypes []string `yaml:"uses_types"`
FilePath string `yaml:"file_path"`
UsesTypes []string `yaml:"uses_types"`
FilePath string `yaml:"file_path"`
SourceRepo string `yaml:"source_repo"`
SourceLicense string `yaml:"source_license"`
SourceFile string `yaml:"source_file"`
}
// rawApp mirrors the YAML frontmatter of an app .md file.
@@ -146,6 +154,9 @@ func ParseFunctionMD(path string, root string) (*Function, error) {
HasState: raw.HasState,
Framework: raw.Framework,
Variant: raw.Variant,
SourceRepo: raw.SourceRepo,
SourceLicense: raw.SourceLicense,
SourceFile: raw.SourceFile,
}
if root != "" && raw.FilePath != "" {
@@ -196,6 +207,9 @@ func ParseTypeMD(path string, root string) (*Type, error) {
Description: raw.Description,
Tags: raw.Tags,
UsesTypes: raw.UsesTypes,
SourceRepo: raw.SourceRepo,
SourceLicense: raw.SourceLicense,
SourceFile: raw.SourceFile,
Examples: sections.example,
Notes: sections.notes,
Documentation: sections.documentation,