Adding support for spec generation#129
Merged
directionless merged 15 commits intoosquery:masterfrom Feb 10, 2026
Merged
Conversation
This is a WIP to generate table spec files. It pulls out some stuff from `table.go` to `column.go` To generate specs, we need to expand the options bitmask into the set of booleans. Instead of doing that via the bitmask (as in osquery#77), this explores storing these as booleans and generating the bitmask as needed.
There was a problem hiding this comment.
Pull request overview
This PR adds support for generating osquery table specifications from plugin definitions. It refactors column-related code into a separate file and introduces the functional options pattern for configuring both tables and columns with metadata like descriptions, notes, examples, and platform information.
Changes:
- Extracted column definitions and related code from
table.gointo a newcolumn.gofile - Added functional options pattern (TableOpt and ColumnOpt) to configure tables and columns with optional metadata
- Implemented spec generation via a new
Spec()method that outputs JSON-formatted table specifications - Added automatic platform detection based on
runtime.GOOSwith support for darwin, linux, and windows
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| plugin/table/table.go | Added TableOpt functional options, platform detection logic, fixed typo in operator comment, added OperatorIn constant, and updated Routes() to use column Options() bitmask |
| plugin/table/column.go | New file containing ColumnDefinition struct, column type constants, column helper functions, ColumnOpt functional options, and Options() bitmask method |
| plugin/table/column_test.go | New file with basic test for Options() bitmask calculation |
| plugin/table/spec.go | New file implementing Spec() method to generate JSON table specifications |
| plugin/table/spec_test.go | New file with basic test for spec generation and custom JSON equality helper |
| examples/table/main.go | Updated to demonstrate spec generation with --spec flag and usage of new functional options |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
RebeccaMahany
approved these changes
Feb 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
I keep wanting to generate table specs from plugins. And so, I've revisited some work I started 6+ years ago.
Description
table.gointocolumn.goCaveats:
Closes: #77
Closes: #78