Skip to content

Instantly share code, notes, and snippets.

@smith
Last active February 24, 2023 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smith/1f3b350a2afc7db5c380928fc459eeef to your computer and use it in GitHub Desktop.
Save smith/1f3b350a2afc7db5c380928fc459eeef to your computer and use it in GitHub Desktop.
JSON Schema for https://spellcaster.sh
{
"type": "object",
"required": ["name", "description", "identity", "trigraphs"],
"description": "JSON schema for https://spellcaster.sh",
"properties": {
"name": {
"type": "string",
"description": "represents an intent, desired state, or outcome."
},
"description": {
"type": "string",
"description": "The description of the spell"
},
"identity": {
"type": "string",
"description": "The identity of the spell author"
},
"trigraphs": {
"type": "array",
"description": "A list of paired commands",
"items": {
"type": "object",
"description": "'trigraphs' are composed of three parts. A label '#', an assertion '?', and an action '!'",
"required": ["#", "?", "!"],
"properties": {
"#": {
"type": "string",
"name": "label",
"description": "The label '#' is a natural language sentence that describes this specific item, eg: 'the file X should exist at the path Y'."
},
"?": {
"type": "string",
"name": "assertion",
"description": "The assertion '?' is a one line command to test whether the statement in the label is true or not. If the assertion fails then another one line command…"
},
"!": {
"type": "string",
"name": "action",
"description": "'!' is an action that should be run."
}
},
"defaultSnippets": [
{
"label": "New trigraph",
"description": "Add a new trigraph",
"body": { "#": "$1", "?": "$2", "!": "$3" }
}
]
}
}
}
}
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org>
@smith
Copy link
Author

smith commented Feb 24, 2023

Add

"$schema": "https://gist.githubusercontent.com/smith/1f3b350a2afc7db5c380928fc459eeef/raw/4dee182cffc078fec3bf9802ef866d2afa19acbc/schema.json",

(or whatever the URL of the "Raw" link above is) to a Spellcaster spell to let VS Code or your favorite editor know about this JSON schema for spells. You may have to open and close your VS Code window for things to start working.

Use ctrl-space to bring up available options. Descriptions of items should be shown on hover.

See Editing JSON with Visual Studio Code for more about how this works in VS Code.

image

CleanShot 2023-02-24 at 12 37 24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment