Skip to content

feat: enhanced JSON Schema, LSP server, and canonical snippets for IDE support#208

Merged
intel352 merged 2 commits intomainfrom
worktree-agent-a55a4625
Feb 27, 2026
Merged

feat: enhanced JSON Schema, LSP server, and canonical snippets for IDE support#208
intel352 merged 2 commits intomainfrom
worktree-agent-a55a4625

Conversation

@intel352
Copy link
Contributor

Summary

Three major additions for IDE integration:

Enhanced JSON Schema Generator

  • Per-module-type config validation using if/then conditionals keyed on type field
  • Pipeline step schemas with step type enum and per-step config keys
  • Trigger type schemas, imports, requires, platform sections
  • GenerateApplicationSchema() for multi-workflow app configs
  • Schema is ~271KB / 7500+ lines with comprehensive type validation

LSP Server (lsp/ + cmd/workflow-lsp-server/)

  • Completions: module/step/trigger types, context-aware config keys, dependsOn module names, template functions inside {{ }}
  • Diagnostics: unknown types, missing dependencies, unknown config keys, unclosed templates (with line/column positions via yaml.Node)
  • Hover: module descriptions + config field tables, step/trigger type docs, template function signatures
  • Document tracking: thread-safe store with YAML node tree and cursor position context detection
  • Binary added to GoReleaser for cross-platform release builds

Canonical Snippets (schema/snippets*.go + wfctl snippets)

  • 32 snippet definitions covering modules, steps, triggers, workflows, and structural blocks
  • ExportSnippetsVSCode() — VSCode .code-snippets JSON format
  • ExportSnippetsJetBrains() — JetBrains live template XML format
  • wfctl snippets --format vscode|jetbrains|json subcommand

Test plan

  • Schema tests: valid JSON, if/then for http.server, pipelines/requires/imports sections, application schema
  • LSP tests: completions, diagnostics, hover, registry, document store, context detection
  • Snippet tests: count, field validation, VSCode JSON validity, JetBrains XML validity
  • golangci-lint clean

🤖 Generated with Claude Code

…E support

- schema: enrich GenerateWorkflowSchema() with if/then per-module-type config
  validation using ConfigFieldDef metadata from ModuleSchemaRegistry; adds
  pipelines, imports, requires, platform sections; adds AllOf/If/Then/OneOf
  fields to Schema struct with json.RawMessage additionalProperties; adds
  configFieldDefToSchema() helper, KnownStepTypes(), GenerateApplicationSchema()
- schema/snippets: add 30+ canonical snippets (10 module, 1 pipeline scaffold,
  12 step, 3 trigger, 3 workflow, 3 structural) with \${N:placeholder} syntax
- schema/snippets_export: ExportSnippetsVSCode() and ExportSnippetsJetBrains()
  for IDE integration
- cmd/wfctl/snippets: add 'wfctl snippets --format vscode|jetbrains|json' subcommand
- lsp: new package implementing Language Server Protocol server with stdio
  transport using github.com/tliron/glsp; registry.go (type metadata),
  document.go (DocumentStore + ContextAt cursor analysis), completion.go
  (module/step/trigger/config/template completions), diagnostics.go (unknown
  type/field/dependsOn validation, unclosed template detection), hover.go
  (markdown hover for modules/triggers/template functions), server.go (glsp
  handler wiring with publishDiagnostics)
- cmd/workflow-lsp-server: new binary entrypoint with -version flag
- release.yml: build workflow-lsp-server cross-platform binaries in release job

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 27, 2026 15:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds IDE support capabilities to the workflow project by introducing (1) a richer JSON Schema generator for config validation, (2) a new Language Server Protocol (LSP) server for YAML authoring assistance, and (3) canonical snippet exports (VSCode + JetBrains) surfaced via wfctl.

Changes:

  • Enhanced JSON Schema generation with conditional per-module validation and additional top-level sections (pipelines/imports/requires/platform) plus an application-level schema.
  • Added a new workflow-lsp-server binary and lsp/ package implementing completions, diagnostics, and hover for workflow YAML.
  • Added canonical snippet definitions and exporters (VSCode JSON + JetBrains XML) plus a wfctl snippets subcommand.

Reviewed changes

Copilot reviewed 17 out of 18 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
schema/schema.go Expands schema model + generates enhanced workflow/application schemas with new sections and conditional validation.
schema/schema_enhanced_test.go Adds tests validating generated schema shape and selected conditionals.
schema/snippets.go Introduces canonical snippet definitions for common modules/steps/triggers/workflows/structure.
schema/snippets_export.go Adds snippet export functions for VSCode JSON and JetBrains live templates XML.
schema/snippets_test.go Adds tests for snippet completeness and export validity.
lsp/server.go Implements LSP server wiring and stdio transport with diagnostics publishing.
lsp/registry.go Builds an LSP registry from schema-known module/step/trigger/workflow types.
lsp/document.go Adds a thread-safe document store and basic cursor-context detection.
lsp/diagnostics.go Adds YAML-based diagnostics for unknown types, unknown config keys, dependsOn validation, and template closure.
lsp/completion.go Adds context-aware completions for keys, types, dependsOn names, and template functions.
lsp/hover.go Adds hover content for module types, module config keys, trigger types, and template functions.
lsp/lsp_test.go Adds unit tests for registry population, document store behavior, diagnostics, completions, hover, and context detection.
cmd/workflow-lsp-server/main.go Adds the LSP server entrypoint binary with build-time version injection.
cmd/wfctl/snippets.go Adds wfctl snippets command to export snippets in multiple formats.
cmd/wfctl/main.go Registers the new snippets subcommand in wfctl.
.github/workflows/release.yml Adds cross-platform release builds for workflow-lsp-server.
go.mod / go.sum Adds github.com/tliron/glsp and related indirect dependencies.

- snippets_export.go: use &#10; as JetBrains XML attribute newline separator
- completion.go: remove incorrect comment about stdlib strings import cycle
- completion.go: check ctx.DependsOn before FieldName for dependsOn completions
- schema.go: set additionalProperties:false on per-module config sub-schema
- schema.go: derive KnownStepTypes() from KnownModuleTypes() step. prefix filter
- schema.go: add Required:["type"] to moduleIfThen If schema
- schema.go: replace literal "*" pipelines property with AdditionalProperties
- schema.go: add per-step if/then config conditionals with TODO for registry
- schema.go: set additionalProperties:false on triggers schema

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@intel352 intel352 merged commit 507ff2a into main Feb 27, 2026
14 checks passed
@intel352 intel352 deleted the worktree-agent-a55a4625 branch February 27, 2026 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants