Hacker News new | ask | show | jobs
by larve 927 days ago
I'll post my own crappy one called oak which uses templates to render the result of tree-sitter queries.

https://github.com/go-go-golems/oak

I initially hope the queries would be more powerful, but they are really not. You can write queries and a resulting template in a yaml file. The program will scan a list of repositories for all these YAML files, and expose them as command line verbs.

Here is one to find go definitions:

https://github.com/go-go-golems/oak/blob/main/cmd/oak/querie...

This can then be run as:

         oak go definitions /home/manuel/code/wesen/corporate-headquarters/geppetto/pkg/cmds/cmd.go          
        type GeppettoCommandDescription struct {
                Name      string                            `yaml:"name"`
                Short     string                            `yaml:"short"`
                Long      string                            `yaml:"long,omitempty"`
                Flags     []*parameters.ParameterDefinition `yaml:"flags,omitempty"`
                Arguments []*parameters.ParameterDefinition `yaml:"arguments,omitempty"`
                Layers    []layers.ParameterLayer           `yaml:"layers,omitempty"`
 
                Prompt       string                      `yaml:"prompt,omitempty"`
                Messages     []*geppetto_context.Message `yaml:"messages,omitempty"`
                SystemPrompt string                      `yaml:"system-prompt,omitempty"`
        }
        type GeppettoCommand struct {
                *glazedcmds.CommandDescription
                StepSettings *settings.StepSettings
                Prompt       string
                Messages     []*geppetto_context.Message
                SystemPrompt string
        }
While I can use it for good effect for LLM prompting as is, I really would like to add a unification algorithm (like the one in Peter Norvig's Prolog compiler) to get better queries, and connect it to LSP as well.