diff --git a/extensions/bitwarden.sh b/extensions/bitwarden.sh index ec64db2b..b840fbf1 100755 --- a/extensions/bitwarden.sh +++ b/extensions/bitwarden.sh @@ -7,7 +7,7 @@ if [ $# -eq 0 ]; then preferences: [ { name: "session", - description: "Bitwarden Session", + title: "Bitwarden Session", type: "string" } ], diff --git a/extensions/brew.sh b/extensions/brew.sh index 8b36aed5..a197b380 100755 --- a/extensions/brew.sh +++ b/extensions/brew.sh @@ -16,7 +16,7 @@ if [ $# -eq 0 ]; then params: [ { name: "package", - description: "Package Name", + title: "Package Name", type: "string" } ] diff --git a/extensions/deno-deploy.ts b/extensions/deno-deploy.ts index c98902ba..50e07a60 100755 --- a/extensions/deno-deploy.ts +++ b/extensions/deno-deploy.ts @@ -9,7 +9,7 @@ const manifest = { preferences: [ { name: "token", - description: "Access Token", + title: "Access Token", type: "string", }, ], @@ -29,14 +29,14 @@ const manifest = { title: "List Deployments", hidden: true, mode: "filter", - params: [{ name: "project", description: "Project", type: "string" }], + params: [{ name: "project", title: "Project", type: "string" }], }, { name: "playground", title: "View Playground", hidden: true, mode: "detail", - params: [{ name: "project", description: "Project", type: "string" }], + params: [{ name: "project", title: "Project", type: "string" }], }, ], } as const satisfies sunbeam.Manifest; diff --git a/extensions/devdocs.sh b/extensions/devdocs.sh index 54de2299..22a9a390 100755 --- a/extensions/devdocs.sh +++ b/extensions/devdocs.sh @@ -18,7 +18,7 @@ if [ $# -eq 0 ]; then title: "List Entries from Docset", mode: "filter", params: [ - { name: "slug", description: "Slug", type: "string" } + { name: "slug", title: "Slug", type: "string" } ] } ] diff --git a/extensions/files.py b/extensions/files.py index f514730e..20b5cd21 100755 --- a/extensions/files.py +++ b/extensions/files.py @@ -10,7 +10,7 @@ "preferences": [ { "name": "show-hidden", - "description": "Show Hidden Files", + "title": "Show Hidden Files", "type": "boolean", "optional": True, } @@ -23,7 +23,7 @@ "params": [ { "name": "dir", - "description": "Directory", + "title": "Directory", "type": "string", "optional": True, }, diff --git a/extensions/gists.ts b/extensions/gists.ts index eef186ed..b665f14c 100755 --- a/extensions/gists.ts +++ b/extensions/gists.ts @@ -10,7 +10,7 @@ const manifest = { preferences: [ { name: "token", - description: "GitHub Personal Access Token", + title: "GitHub Personal Access Token", type: "string", }, ], @@ -27,18 +27,18 @@ const manifest = { params: [ { name: "filename", - description: "Gist Filename", + title: "Gist Filename", type: "string", }, { name: "description", - description: "Gist Description", + title: "Gist Description", optional: true, type: "string", }, { name: "public", - description: "Public", + title: "Public", type: "boolean", }, ], @@ -48,7 +48,7 @@ const manifest = { title: "Browse Gist Files", hidden: true, mode: "filter", - params: [{ name: "id", description: "Gist ID", type: "string" }], + params: [{ name: "id", title: "Gist ID", type: "string" }], }, { name: "view", @@ -56,8 +56,8 @@ const manifest = { hidden: true, mode: "detail", params: [ - { name: "id", description: "Gist ID", type: "string" }, - { name: "filename", description: "Filename", type: "string" }, + { name: "id", title: "Gist ID", type: "string" }, + { name: "filename", title: "Filename", type: "string" }, ], }, { @@ -66,8 +66,8 @@ const manifest = { hidden: true, mode: "tty", params: [ - { name: "id", description: "Gist ID", type: "string" }, - { name: "filename", description: "Filename", type: "string" }, + { name: "id", title: "Gist ID", type: "string" }, + { name: "filename", title: "Filename", type: "string" }, ], }, { @@ -75,7 +75,7 @@ const manifest = { hidden: true, title: "Delete Gist", mode: "silent", - params: [{ name: "id", description: "Gist ID", type: "string" }], + params: [{ name: "id", title: "Gist ID", type: "string" }], }, ], } as const satisfies sunbeam.Manifest; diff --git a/extensions/github.ts b/extensions/github.ts index 47e76eed..cd0c481d 100755 --- a/extensions/github.ts +++ b/extensions/github.ts @@ -9,7 +9,7 @@ const manifest = { preferences: [ { name: "token", - description: "Personal Access Token", + title: "Personal Access Token", type: "string", }, ], @@ -27,7 +27,7 @@ const manifest = { params: [ { name: "repo", - description: "Repository Name", + title: "Repository Name", type: "string", }, ], @@ -40,7 +40,7 @@ const manifest = { params: [ { name: "repo", - description: "Repository Name", + title: "Repository Name", type: "string", }, ], @@ -53,7 +53,7 @@ const manifest = { params: [ { name: "repo", - description: "Repository Name", + title: "Repository Name", type: "string", }, ], diff --git a/extensions/hackernews.ts b/extensions/hackernews.ts index 40523b95..b15073bd 100755 --- a/extensions/hackernews.ts +++ b/extensions/hackernews.ts @@ -12,7 +12,7 @@ const manifest = { name: "browse", title: "Show a feed", mode: "filter", - params: [{ name: "topic", description: "Topic", type: "string" }], + params: [{ name: "topic", title: "Topic", type: "string" }], }, ], } as const satisfies sunbeam.Manifest; diff --git a/extensions/nixpkgs.ts b/extensions/nixpkgs.ts index 01422952..df903798 100755 --- a/extensions/nixpkgs.ts +++ b/extensions/nixpkgs.ts @@ -4,6 +4,7 @@ import * as sunbeam from "https://deno.land/x/sunbeam/mod.ts"; const manifest = { title: "Nixpkgs Search", + description: "Search Nixpkgs packages", commands: [ { name: "search", diff --git a/extensions/npm.ts b/extensions/npm.ts index 2d69a391..a500077c 100755 --- a/extensions/npm.ts +++ b/extensions/npm.ts @@ -3,6 +3,7 @@ import * as sunbeam from "https://deno.land/x/sunbeam/mod.ts"; const manifest: sunbeam.Manifest = { title: "NPM Search", + description: "Search NPM packages", commands: [ { name: "search", diff --git a/extensions/raindrop.ts b/extensions/raindrop.ts index aa9027b1..2fa09a41 100755 --- a/extensions/raindrop.ts +++ b/extensions/raindrop.ts @@ -7,7 +7,7 @@ const manifest = { preferences: [ { name: "token", - description: "Raindrop API Token", + title: "Raindrop API Token", type: "string", }, ], diff --git a/extensions/rss.ts b/extensions/rss.ts index 12bec959..3b9712ed 100755 --- a/extensions/rss.ts +++ b/extensions/rss.ts @@ -15,7 +15,7 @@ const manifest = { params: [ { name: "url", - description: "URL", + title: "URL", type: "string", }, ], diff --git a/extensions/tailscale.ts b/extensions/tailscale.ts index c3f2e1f3..8161a4d7 100755 --- a/extensions/tailscale.ts +++ b/extensions/tailscale.ts @@ -17,7 +17,7 @@ const manifest = { params: [ { name: "ip", - description: "Device IP", + title: "Device IP", type: "string", }, ], diff --git a/extensions/tldr.sh b/extensions/tldr.sh index 9fc933f9..57142718 100755 --- a/extensions/tldr.sh +++ b/extensions/tldr.sh @@ -13,7 +13,7 @@ if [ $# -eq 0 ]; then # each command can be called through the cli commands: [ { name: "list", mode: "filter", title: "Search Pages" }, - { name: "view", mode: "detail", hidden: true, title: "View page", params: [{ name: "page", type: "string", description: "page to show" }] }, + { name: "view", mode: "detail", hidden: true, title: "View page", params: [{ name: "page", type: "string", title: "Page to show" }] }, { name: "update", mode: "silent", title: "Update cache" } ] }' diff --git a/extensions/valtown.ts b/extensions/valtown.ts index 0947810a..4ebb79a9 100755 --- a/extensions/valtown.ts +++ b/extensions/valtown.ts @@ -8,7 +8,7 @@ const manifest = { preferences: [ { name: "token", - description: "Access Token", + title: "Access Token", type: "string", }, ], @@ -19,7 +19,7 @@ const manifest = { mode: "filter", params: [{ name: "user", - description: "User", + title: "User", optional: true, type: "string", }], @@ -34,14 +34,14 @@ const manifest = { name: "edit", hidden: true, mode: "tty", - params: [{ name: "id", description: "Val ID", type: "string" }], + params: [{ name: "id", title: "Val ID", type: "string" }], }, { title: "View Readme", name: "readme", hidden: true, mode: "detail", - params: [{ name: "id", description: "Val ID", type: "string" }], + params: [{ name: "id", title: "Val ID", type: "string" }], }, ], } as const satisfies sunbeam.Manifest; diff --git a/internal/cli/custom.go b/internal/cli/custom.go index 1c6d8ecd..21535b65 100644 --- a/internal/cli/custom.go +++ b/internal/cli/custom.go @@ -163,11 +163,11 @@ func NewSubCmdCustom(alias string, extension extensions.Extension, extensionConf for _, input := range command.Params { switch input.Type { case sunbeam.InputString: - cmd.Flags().String(input.Name, "", input.Description) + cmd.Flags().String(input.Name, "", input.Title) case sunbeam.InputBoolean: - cmd.Flags().Bool(input.Name, false, input.Description) + cmd.Flags().Bool(input.Name, false, input.Title) case sunbeam.InputNumber: - cmd.Flags().Int(input.Name, 0, input.Description) + cmd.Flags().Int(input.Name, 0, input.Title) } if !input.Optional { diff --git a/internal/schemas/manifest.schema.json b/internal/schemas/manifest.schema.json index 42a42724..1ecbc32e 100644 --- a/internal/schemas/manifest.schema.json +++ b/internal/schemas/manifest.schema.json @@ -65,27 +65,21 @@ "type": "object", "required": [ "name", - "description", + "title", "type" ], "properties": { "name": { "type": "string" }, - "description": { + "title": { "type": "string" }, "type": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "boolean" - }, - { - "type": "number" - } + "enum": [ + "string", + "boolean", + "number" ] }, "optional": { diff --git a/internal/tui/input.go b/internal/tui/input.go index 789aea30..316052a0 100644 --- a/internal/tui/input.go +++ b/internal/tui/input.go @@ -56,7 +56,7 @@ func NewTextField(input sunbeam.Input, secure bool) *TextField { name: input.Name, title: input.Name, Model: ti, - placeholder: input.Description, + placeholder: input.Title, } } @@ -140,11 +140,11 @@ func NewTextArea(input sunbeam.Input) Input { } } - ta.Placeholder = input.Description + ta.Placeholder = input.Title ta.SetHeight(5) return &TextArea{ - title: input.Description, + title: input.Title, name: input.Name, Model: ta, } @@ -205,7 +205,7 @@ type Checkbox struct { func NewCheckbox(param sunbeam.Input) *Checkbox { checkbox := Checkbox{ name: param.Name, - title: param.Description, + title: param.Title, } if param.Default != nil { @@ -214,7 +214,7 @@ func NewCheckbox(param sunbeam.Input) *Checkbox { } } - checkbox.label = param.Description + checkbox.label = param.Title return &checkbox } diff --git a/pkg/sunbeam/manifest.go b/pkg/sunbeam/manifest.go index 2178f40e..19634089 100644 --- a/pkg/sunbeam/manifest.go +++ b/pkg/sunbeam/manifest.go @@ -46,9 +46,9 @@ const ( ) type Input struct { - Type InputType `json:"type"` - Name string `json:"name"` - Description string `json:"description"` - Optional bool `json:"optional,omitempty"` - Default any `json:"default,omitempty"` + Type InputType `json:"type"` + Name string `json:"name"` + Title string `json:"title"` + Optional bool `json:"optional,omitempty"` + Default any `json:"default,omitempty"` } diff --git a/pkg/typescript/src/manifest.ts b/pkg/typescript/src/manifest.ts index 29ee38e3..85db86f8 100644 --- a/pkg/typescript/src/manifest.ts +++ b/pkg/typescript/src/manifest.ts @@ -1,22 +1,21 @@ export type Manifest = { title: string; - description?: string; + description: string; preferences?: readonly Input[]; commands: readonly Command[]; }; export type Command = { name: string; - title: string; hidden?: boolean; - description?: string; + title: string; params?: readonly Input[]; mode: "filter" | "search" | "detail" | "tty" | "silent"; }; export type Input = { name: string; - description?: string; + title: string; type: "string" | "number" | "boolean"; optional?: boolean; }; diff --git a/scripts/build-catalog.ts b/scripts/build-catalog.ts index 16fcc979..397488f2 100755 --- a/scripts/build-catalog.ts +++ b/scripts/build-catalog.ts @@ -10,7 +10,7 @@ rows.push( "outline: 2", "---", "", - "# Extension Catalog" + "# Extension Catalog", ); const extensionDir = path.join(dirname, "..", "extensions"); @@ -33,7 +33,7 @@ for (const entry of entries) { "", `## [${manifest.title}](https://github.com/pomdtr/sunbeam/tree/main/extensions/${entry.name})`, "", - `${manifest.description}` + `${manifest.description}`, ); if (manifest.preferences?.length) { @@ -56,11 +56,11 @@ for (const entry of entries) { "", "```", `sunbeam extension install https://raw.githubusercontent.com/pomdtr/sunbeam/main/extensions/${entry.name}`, - "```" + "```", ); } Deno.writeTextFileSync( path.join(dirname, "..", "www", "website", "catalog", "index.md"), - rows.join("\n") + rows.join("\n"), ); diff --git a/scripts/build-config.ts b/scripts/build-config.ts deleted file mode 100755 index ef38b555..00000000 --- a/scripts/build-config.ts +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env -S deno run -A -import { Config, ExtensionConfig } from "../pkg/deno/config.ts"; -import * as path from "https://deno.land/std@0.209.0/path/mod.ts"; - -const dirname = new URL(".", import.meta.url).pathname; - -const extensions: Record = {}; -const entries = Deno.readDirSync(path.join(dirname, "..", "extensions")); -for (const entry of entries) { - const extension = path.extname(entry.name); - const stem = path.basename(entry.name, extension); - - extensions[stem] = { - origin: `./extensions/${entry.name}`, - }; -} - -const config: Config = { - $schema: "./internal/schemas/config.schema.json", - oneliners: [ - { - title: "Refresh Config", - command: "./scripts/build-config.ts", - }, - ], - extensions, -}; - -Deno.writeTextFileSync( - path.join(dirname, "..", "sunbeam.json"), - JSON.stringify(config, null, 2) + "\n" -); diff --git a/www/website/catalog/index.md b/www/website/catalog/index.md index 961c8744..1e0855f9 100644 --- a/www/website/catalog/index.md +++ b/www/website/catalog/index.md @@ -11,7 +11,7 @@ Browse files and folders ### Preferences -- `show-hidden`: undefined +- `show-hidden`: Show Hidden Files ### Commands @@ -29,7 +29,7 @@ Manage your gists ### Preferences -- `token`: undefined +- `token`: GitHub Personal Access Token ### Commands @@ -52,7 +52,7 @@ Search GitHub repositories ### Preferences -- `token`: undefined +- `token`: Personal Access Token ### Commands @@ -84,7 +84,7 @@ sunbeam extension install https://raw.githubusercontent.com/pomdtr/sunbeam/main/ ## [Nixpkgs Search](https://github.com/pomdtr/sunbeam/tree/main/extensions/nixpkgs.ts) -undefined +Search Nixpkgs packages ### Commands @@ -117,7 +117,7 @@ Search your Bitwarden passwords ### Preferences -- `session`: undefined +- `session`: Bitwarden Session ### Commands @@ -131,7 +131,7 @@ sunbeam extension install https://raw.githubusercontent.com/pomdtr/sunbeam/main/ ## [NPM Search](https://github.com/pomdtr/sunbeam/tree/main/extensions/npm.ts) -undefined +Search NPM packages ### Commands @@ -163,7 +163,7 @@ Search and view Val Town vals ### Preferences -- `token`: undefined +- `token`: Access Token ### Commands @@ -200,7 +200,7 @@ Manage your Deno Deploy projects ### Preferences -- `token`: undefined +- `token`: Access Token ### Commands @@ -258,42 +258,13 @@ Search DevDocs.io sunbeam extension install https://raw.githubusercontent.com/pomdtr/sunbeam/main/extensions/devdocs.sh ``` -## [Home Manager](https://github.com/pomdtr/sunbeam/tree/main/extensions/home-manager.ts) - -undefined - -### Commands - -- `search`: Search Configuration Options - -### Install - -``` -sunbeam extension install https://raw.githubusercontent.com/pomdtr/sunbeam/main/extensions/home-manager.ts -``` - -## [Store](https://github.com/pomdtr/sunbeam/tree/main/extensions/store.ts) - -Download and install extensions - -### Commands - -- `search`: Search -- `install`: Install - -### Install - -``` -sunbeam extension install https://raw.githubusercontent.com/pomdtr/sunbeam/main/extensions/store.ts -``` - ## [Raindrop](https://github.com/pomdtr/sunbeam/tree/main/extensions/raindrop.ts) Manage your raindrop bookmarks ### Preferences -- `token`: undefined +- `token`: Raindrop API Token ### Commands diff --git a/www/website/docs/developer-guide/examples/devdocs.md b/www/website/docs/developer-guide/examples/devdocs.md index 5f1a25e9..963af769 100644 --- a/www/website/docs/developer-guide/examples/devdocs.md +++ b/www/website/docs/developer-guide/examples/devdocs.md @@ -153,7 +153,7 @@ if [ $# -eq 0 ]; then { name: "docset", type: "string", - description: "Docset Slug" + title: "Docset Slug" } ] } diff --git a/www/website/docs/reference/schemas/manifest.md b/www/website/docs/reference/schemas/manifest.md index f2ace5ed..f05a41e7 100644 --- a/www/website/docs/reference/schemas/manifest.md +++ b/www/website/docs/reference/schemas/manifest.md @@ -39,7 +39,7 @@ It contains the title, description and the list of commands provided by the exte { "name": "slug", "type": "string", // can be "string", "number", "boolean" - "description": "Docset Slug", + "title": "Docset Slug", } ] }