Skip to content

Commit 5316102

Browse files
committed
feat: add structured entity/edge metadata and restructure CLI
- Add EntityInfo and EdgeInfo structs to plugins.Info for declaring entity types, URN patterns, and edge relationships in code - Populate all 31 extractors with structured entity/edge declarations and standardized tags (platform: gcp/aws/saas/oss, domain: database/ streaming/bi/orchestration/collaboration/scm/storage) - Restructure CLI commands: - `plugins list` replaces `list extractors/sinks/processors` with unified view and --type, --entity-type, --edge-type, --tag filters - `plugins info <name>` replaces `info extractor/sink/processor` with auto-detection across all registries - `recipe init` replaces `new recipe` - `recipe gen` replaces `gen` - `entities` and `edges` are top-level data model queries - Improve README titles and plugin descriptions for consistency
1 parent 7249353 commit 5316102

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+843
-498
lines changed

cmd/entities.go

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
package cmd
2+
3+
import (
4+
"fmt"
5+
"os"
6+
"sort"
7+
"strings"
8+
9+
"github.com/MakeNowJust/heredoc"
10+
"github.com/raystack/meteor/registry"
11+
"github.com/raystack/salt/cli/printer"
12+
"github.com/spf13/cobra"
13+
)
14+
15+
// EntitiesCmd creates a command to list entity types across all extractors.
16+
func EntitiesCmd() *cobra.Command {
17+
return &cobra.Command{
18+
Use: "entities",
19+
Short: "List entity types across all extractors",
20+
Long: heredoc.Doc(`
21+
List all entity types produced by extractors.
22+
23+
Shows each entity type and which extractors produce it.
24+
`),
25+
Example: heredoc.Doc(`
26+
$ meteor entities
27+
`),
28+
Annotations: map[string]string{
29+
"group": "core",
30+
},
31+
Run: func(cmd *cobra.Command, args []string) {
32+
extractors := registry.Extractors.List()
33+
34+
entityMap := make(map[string][]string)
35+
for name, info := range extractors {
36+
for _, e := range info.Entities {
37+
entityMap[e.Type] = append(entityMap[e.Type], name)
38+
}
39+
}
40+
41+
types := make([]string, 0, len(entityMap))
42+
for t := range entityMap {
43+
types = append(types, t)
44+
}
45+
sort.Strings(types)
46+
47+
fmt.Printf("\n%s %d entity types\n\n", printer.Greenf("Showing"), len(types))
48+
49+
report := [][]string{}
50+
for _, t := range types {
51+
names := entityMap[t]
52+
sort.Strings(names)
53+
report = append(report, []string{
54+
printer.Cyanf("%s", t),
55+
strings.Join(names, ", "),
56+
})
57+
}
58+
printer.Table(os.Stdout, report)
59+
},
60+
}
61+
}
62+
63+
// EdgesCmd creates a command to list edge types across all extractors.
64+
func EdgesCmd() *cobra.Command {
65+
return &cobra.Command{
66+
Use: "edges",
67+
Short: "List edge types across all extractors",
68+
Long: heredoc.Doc(`
69+
List all edge types produced by extractors.
70+
71+
Shows each edge type, the relationship direction, and which extractors produce it.
72+
`),
73+
Example: heredoc.Doc(`
74+
$ meteor edges
75+
`),
76+
Annotations: map[string]string{
77+
"group": "core",
78+
},
79+
Run: func(cmd *cobra.Command, args []string) {
80+
extractors := registry.Extractors.List()
81+
82+
type edgeEntry struct {
83+
from string
84+
to string
85+
extractors []string
86+
}
87+
88+
edgeMap := make(map[string]*edgeEntry)
89+
for name, info := range extractors {
90+
for _, e := range info.Edges {
91+
if _, ok := edgeMap[e.Type]; !ok {
92+
edgeMap[e.Type] = &edgeEntry{from: e.From, to: e.To}
93+
}
94+
edgeMap[e.Type].extractors = append(edgeMap[e.Type].extractors, name)
95+
}
96+
}
97+
98+
types := make([]string, 0, len(edgeMap))
99+
for t := range edgeMap {
100+
types = append(types, t)
101+
}
102+
sort.Strings(types)
103+
104+
fmt.Printf("\n%s %d edge types\n\n", printer.Greenf("Showing"), len(types))
105+
106+
report := [][]string{}
107+
for _, t := range types {
108+
e := edgeMap[t]
109+
sort.Strings(e.extractors)
110+
report = append(report, []string{
111+
printer.Yellowf("%s", t),
112+
printer.Greyf("%s -> %s", e.from, e.to),
113+
strings.Join(e.extractors, ", "),
114+
})
115+
}
116+
printer.Table(os.Stdout, report)
117+
},
118+
}
119+
}

cmd/gen.go

Lines changed: 0 additions & 60 deletions
This file was deleted.

cmd/info.go

Lines changed: 0 additions & 175 deletions
This file was deleted.

0 commit comments

Comments
 (0)