Skip to content

Commit 867fd25

Browse files
committed
add list plugin schema to cli
1 parent e57ac2e commit 867fd25

6 files changed

Lines changed: 77 additions & 6 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "degoog-cli",
3-
"version": "0.4.0",
3+
"version": "0.5.0",
44
"description": "CLI toolset for degoog",
55
"type": "module",
66
"scripts": {

src/generators/plugin-bang.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
import { scaffoldDir, authorJsonTpl, readmeTpl } from "../utils/files.ts"
22
import type { GeneratorCtx } from "../types/index.ts"
33

4-
const indexTpl = (name: string) => `export default {
4+
const indexTpl = (name: string) => `// If this file also exports other hooks (slot, interceptor, tab, etc.) and
5+
// you want a single settings card for all of them, add a top-level plugin identity:
6+
//
7+
// export const plugin = {
8+
// id: "${name}",
9+
// name: "${name}",
10+
// description: "...",
11+
// settingsSchema: [ /* shared fields */ ],
12+
// };
13+
//
14+
// All hooks in this file will share that id and appear as one card in settings.
15+
16+
export default {
517
name: "${name}",
618
description: "${name} bang command",
719
trigger: "${name}",
@@ -19,6 +31,17 @@ const indexTpl = (name: string) => `export default {
1931
2032
// settingsSchema: [
2133
// { key: "apiKey", label: "API Key", type: "password", required: true },
34+
// // A "list" field lets users manage a repeatable list of structured rows.
35+
// // The value arrives in configure() as a JSON array string; JSON.parse it.
36+
// // {
37+
// // key: "bangs", label: "Custom bangs", type: "list", addLabel: "+ Add bang",
38+
// // itemSchema: [
39+
// // { key: "shortcut", label: "Shortcut", type: "text" },
40+
// // // URL templates can use {{{s}}} or %s where the query goes.
41+
// // { key: "url", label: "URL template", type: "text" },
42+
// // { key: "openBase", label: "Open base path", type: "toggle" },
43+
// // ],
44+
// // },
2245
// ],
2346
//
2447
// configure(settings) {},

src/generators/plugin-intercept.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
import { scaffoldDir, authorJsonTpl, readmeTpl } from "../utils/files.ts"
22
import type { GeneratorCtx } from "../types/index.ts"
33

4-
const indexTpl = (name: string) => `export const interceptor = {
4+
const indexTpl = (name: string) => `// If this file also exports a slot or command and you want a single settings
5+
// card for all of them, add a top-level plugin identity export:
6+
//
7+
// export const plugin = {
8+
// id: "${name}",
9+
// name: "${name}",
10+
// description: "...",
11+
// settingsSchema: [ /* shared fields */ ],
12+
// };
13+
//
14+
// All hooks in this file will share that id and appear as one card in settings.
15+
16+
export const interceptor = {
517
name: "${name}",
618
description: "Modifies queries before search",
719

src/generators/plugin-mid.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
import { scaffoldDir, authorJsonTpl, readmeTpl } from "../utils/files.ts"
22
import type { GeneratorCtx } from "../types/index.ts"
33

4-
const indexTpl = (name: string) => `export const middleware = {
4+
const indexTpl = (name: string) => `// If this file also exports other hooks (slot, interceptor, command, etc.) and
5+
// you want a single settings card for all of them, add a top-level plugin identity:
6+
//
7+
// export const plugin = {
8+
// id: "${name}",
9+
// name: "${name}",
10+
// description: "...",
11+
// settingsSchema: [ /* shared fields */ ],
12+
// };
13+
//
14+
// All hooks in this file will share that id and appear as one card in settings.
15+
16+
export const middleware = {
517
id: "${name}",
618
name: "${name}",
719

src/generators/plugin-slot.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
import { scaffoldDir, authorJsonTpl, readmeTpl } from "../utils/files.ts"
22
import type { GeneratorCtx } from "../types/index.ts"
33

4-
const indexTpl = (name: string) => `// positions: above-results | below-results | above-sidebar | below-sidebar | knowledge-panel | at-a-glance
4+
const indexTpl = (name: string) => `// If this file also exports other hooks (interceptor, command, tab, etc.) and
5+
// you want a single settings card for all of them, add a top-level plugin identity:
6+
//
7+
// export const plugin = {
8+
// id: "${name}",
9+
// name: "${name}",
10+
// description: "...",
11+
// settingsSchema: [ /* shared fields */ ],
12+
// };
13+
//
14+
// All hooks in this file will share that id and appear as one card in settings.
15+
16+
// positions: above-results | below-results | above-sidebar | below-sidebar | knowledge-panel | at-a-glance
517
export const slot = {
618
id: "${name}",
719
name: "${name}",

src/generators/plugin-tab.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
import { scaffoldDir, authorJsonTpl, readmeTpl } from "../utils/files.ts"
22
import type { GeneratorCtx } from "../types/index.ts"
33

4-
const indexTpl = (name: string) => `export const tab = {
4+
const indexTpl = (name: string) => `// If this file also exports other hooks (slot, interceptor, command, etc.) and
5+
// you want a single settings card for all of them, add a top-level plugin identity:
6+
//
7+
// export const plugin = {
8+
// id: "${name}",
9+
// name: "${name}",
10+
// description: "...",
11+
// settingsSchema: [ /* shared fields */ ],
12+
// };
13+
//
14+
// All hooks in this file will share that id and appear as one card in settings.
15+
16+
export const tab = {
517
id: "${name}",
618
name: "${name}",
719
// icon: "🔍",

0 commit comments

Comments
 (0)