@vsceasy/cli 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/LICENSE +21 -0
  3. package/README.md +474 -0
  4. package/dist/bin/cli.d.ts +1 -0
  5. package/dist/bin/cli.js +9044 -0
  6. package/dist/cli.d.ts +3 -0
  7. package/dist/commands/command/add.d.ts +3 -0
  8. package/dist/commands/components/add.d.ts +3 -0
  9. package/dist/commands/create.d.ts +3 -0
  10. package/dist/commands/crud/add.d.ts +3 -0
  11. package/dist/commands/db/init.d.ts +3 -0
  12. package/dist/commands/doctor.d.ts +3 -0
  13. package/dist/commands/groups.d.ts +16 -0
  14. package/dist/commands/helper/add.d.ts +3 -0
  15. package/dist/commands/job/add.d.ts +3 -0
  16. package/dist/commands/menu/add.d.ts +3 -0
  17. package/dist/commands/menu/edit.d.ts +3 -0
  18. package/dist/commands/model/add.d.ts +3 -0
  19. package/dist/commands/panel/add.d.ts +3 -0
  20. package/dist/commands/publish/init.d.ts +3 -0
  21. package/dist/commands/rpc/add.d.ts +3 -0
  22. package/dist/commands/statusBar/add.d.ts +3 -0
  23. package/dist/commands/subpanel/add.d.ts +3 -0
  24. package/dist/commands/test/setup.d.ts +3 -0
  25. package/dist/commands/treeView/add.d.ts +3 -0
  26. package/dist/commands/upgrade.d.ts +3 -0
  27. package/dist/commands/wizard.d.ts +3 -0
  28. package/dist/data/codicons.d.ts +9 -0
  29. package/dist/index.d.ts +1 -0
  30. package/dist/index.js +3169 -0
  31. package/dist/lib/command/add.d.ts +31 -0
  32. package/dist/lib/components/add.d.ts +20 -0
  33. package/dist/lib/config.d.ts +10 -0
  34. package/dist/lib/crud/add.d.ts +19 -0
  35. package/dist/lib/crud/crudConfig.d.ts +37 -0
  36. package/dist/lib/crud/parseModel.d.ts +33 -0
  37. package/dist/lib/db/init.d.ts +16 -0
  38. package/dist/lib/db/wire.d.ts +10 -0
  39. package/dist/lib/doctor.d.ts +30 -0
  40. package/dist/lib/findProject.d.ts +10 -0
  41. package/dist/lib/helper/add.d.ts +14 -0
  42. package/dist/lib/iconPicker.d.ts +7 -0
  43. package/dist/lib/index.d.ts +46 -0
  44. package/dist/lib/interactive.d.ts +30 -0
  45. package/dist/lib/job/add.d.ts +24 -0
  46. package/dist/lib/menu/add.d.ts +13 -0
  47. package/dist/lib/menu/edit.d.ts +39 -0
  48. package/dist/lib/menuTree.d.ts +33 -0
  49. package/dist/lib/model/add.d.ts +27 -0
  50. package/dist/lib/model/parseFields.d.ts +14 -0
  51. package/dist/lib/panel/add.d.ts +29 -0
  52. package/dist/lib/publish/init.d.ts +12 -0
  53. package/dist/lib/rpc/add.d.ts +22 -0
  54. package/dist/lib/scaffold.d.ts +13 -0
  55. package/dist/lib/statusBar/add.d.ts +33 -0
  56. package/dist/lib/subpanel/add.d.ts +20 -0
  57. package/dist/lib/testSetup/index.d.ts +10 -0
  58. package/dist/lib/treeView/add.d.ts +13 -0
  59. package/dist/lib/upgrade.d.ts +22 -0
  60. package/dist/lib/validate.d.ts +14 -0
  61. package/dist/lib/wizard/run.d.ts +13 -0
  62. package/package.json +67 -0
  63. package/templates/_generators/command/command.ts.tpl +8 -0
  64. package/templates/_generators/components/Button.tsx.tpl +12 -0
  65. package/templates/_generators/components/Card.tsx.tpl +22 -0
  66. package/templates/_generators/components/Field.tsx.tpl +20 -0
  67. package/templates/_generators/components/Input.tsx.tpl +10 -0
  68. package/templates/_generators/components/List.tsx.tpl +29 -0
  69. package/templates/_generators/components/components.css.tpl +66 -0
  70. package/templates/_generators/components/index.ts.tpl +10 -0
  71. package/templates/_generators/crud/formApp.tsx.tpl +83 -0
  72. package/templates/_generators/crud/formNav.ts.tpl +19 -0
  73. package/templates/_generators/crud/formPanel.ts.tpl +32 -0
  74. package/templates/_generators/crud/listApp.tsx.tpl +84 -0
  75. package/templates/_generators/crud/listPanel.ts.tpl +30 -0
  76. package/templates/_generators/crud/main.tsx.tpl +6 -0
  77. package/templates/_generators/crud/service.ts.tpl +27 -0
  78. package/templates/_generators/helper/cache.ts.tpl +117 -0
  79. package/templates/_generators/helper/config.ts.tpl +36 -0
  80. package/templates/_generators/helper/db.ts.tpl +322 -0
  81. package/templates/_generators/helper/notifications.ts.tpl +45 -0
  82. package/templates/_generators/helper/secrets.ts.tpl +36 -0
  83. package/templates/_generators/helper/state.ts.tpl +44 -0
  84. package/templates/_generators/job/job.ts.tpl +10 -0
  85. package/templates/_generators/menu/menu.ts.tpl +21 -0
  86. package/templates/_generators/model/model.ts.tpl +17 -0
  87. package/templates/_generators/panel/App.tsx.tpl +10 -0
  88. package/templates/_generators/panel/main.tsx.tpl +6 -0
  89. package/templates/_generators/panel/panel.ts.tpl +5 -0
  90. package/templates/_generators/panel/templates/dashboard/App.tsx.tpl +41 -0
  91. package/templates/_generators/panel/templates/form/App.tsx.tpl +44 -0
  92. package/templates/_generators/panel/templates/list/App.tsx.tpl +40 -0
  93. package/templates/_generators/publish/CHANGELOG.md.tpl +8 -0
  94. package/templates/_generators/publish/README.md.tpl +23 -0
  95. package/templates/_generators/statusBar/statusBar.ts.tpl +7 -0
  96. package/templates/_generators/subpanel/App.tsx.tpl +10 -0
  97. package/templates/_generators/subpanel/main.tsx.tpl +6 -0
  98. package/templates/_generators/subpanel/subpanel.ts.tpl +6 -0
  99. package/templates/_generators/test/_helpers.ts.tpl +120 -0
  100. package/templates/_generators/test/sample.test.ts.tpl +38 -0
  101. package/templates/_generators/test/vitest.config.ts.tpl +23 -0
  102. package/templates/_generators/test/vscode.stub.ts.tpl +109 -0
  103. package/templates/_generators/treeView/treeView.ts.tpl +16 -0
  104. package/templates/react/.vscode/launch.json +34 -0
  105. package/templates/react/.vscode/tasks.json +32 -0
  106. package/templates/react/.vscodeignore +8 -0
  107. package/templates/react/README.md +50 -0
  108. package/templates/react/package.json +54 -0
  109. package/templates/react/scripts/gen.ts +395 -0
  110. package/templates/react/src/commands/hello.ts +6 -0
  111. package/templates/react/src/extension/extension.ts +5 -0
  112. package/templates/react/src/panels/dashboard.ts +21 -0
  113. package/templates/react/src/shared/api.ts +7 -0
  114. package/templates/react/src/shared/vsceasy/bootstrap.ts +657 -0
  115. package/templates/react/src/shared/vsceasy/client.ts +8 -0
  116. package/templates/react/src/shared/vsceasy/codiconNames.ts +196 -0
  117. package/templates/react/src/shared/vsceasy/define.ts +269 -0
  118. package/templates/react/src/shared/vsceasy/index.ts +13 -0
  119. package/templates/react/src/shared/vsceasy/rpc.ts +214 -0
  120. package/templates/react/src/webview/panels/dashboard/App.tsx +31 -0
  121. package/templates/react/src/webview/panels/dashboard/main.tsx +6 -0
  122. package/templates/react/src/webview/styles.css +33 -0
  123. package/templates/react/tsconfig.json +17 -0
  124. package/templates/react/vite.config.ts +42 -0
@@ -0,0 +1,31 @@
1
+ export interface AddCommandOptions {
2
+ /** Command id — camelCase. Becomes file basename and command suffix. */
3
+ name: string;
4
+ /** Command palette title. Defaults to PascalCase(name). */
5
+ title?: string;
6
+ /** Optional category prefix. */
7
+ category?: string;
8
+ /** Insert into this menu (file basename in src/menus/). */
9
+ menuEntry?: string;
10
+ /** Parent group label inside the menu. undefined = root. */
11
+ group?: string;
12
+ /** Codicon name shown next to menu entry. */
13
+ icon?: string;
14
+ /** Keyboard shortcut (e.g. 'ctrl+shift+h'). Written into the command file. */
15
+ keybinding?: string;
16
+ /** VS Code `when` clause controlling palette enablement (e.g. 'editorTextFocus'). */
17
+ when?: string;
18
+ /** Project root. */
19
+ projectRoot: string;
20
+ /** Bundled templates root. */
21
+ templatesRoot: string;
22
+ /** Run `bun run gen` after writing. Default true. */
23
+ runGen?: boolean;
24
+ }
25
+ export interface AddCommandResult {
26
+ created: string[];
27
+ modified: string[];
28
+ menuUpdated: boolean;
29
+ genRan: boolean;
30
+ }
31
+ export declare function addCommand(opts: AddCommandOptions): AddCommandResult;
@@ -0,0 +1,20 @@
1
+ export interface AddComponentsOptions {
2
+ projectRoot: string;
3
+ templatesRoot: string;
4
+ /** Overwrite existing component files. Default false (idempotent). */
5
+ force?: boolean;
6
+ }
7
+ export interface AddComponentsResult {
8
+ created: string[];
9
+ skipped: string[];
10
+ /** Absolute path to the components dir. */
11
+ dir: string;
12
+ }
13
+ /**
14
+ * Scaffold a small library of theme-aware React components (Button, Input,
15
+ * Field, Card, List) into src/webview/components/, styled with VS Code tokens.
16
+ * Panel `--template` UIs import from here. Idempotent unless `force`.
17
+ */
18
+ export declare function addComponents(opts: AddComponentsOptions): AddComponentsResult;
19
+ /** True when the components library has already been generated. */
20
+ export declare function componentsExist(projectRoot: string): boolean;
@@ -0,0 +1,10 @@
1
+ export interface VsceasyConfig {
2
+ publisher?: string;
3
+ commandPrefix?: string;
4
+ ui?: 'react';
5
+ defaultIcon?: string;
6
+ defaultCategory?: string;
7
+ }
8
+ export declare function configPath(projectRoot: string): string | null;
9
+ export declare function readConfig(projectRoot: string): VsceasyConfig;
10
+ export declare function writeConfig(projectRoot: string, cfg: VsceasyConfig): string;
@@ -0,0 +1,19 @@
1
+ export interface AddCrudOptions {
2
+ /** Model file basename without extension (e.g. `User`). Matches `src/models/<X>.ts`. */
3
+ model: string;
4
+ projectRoot: string;
5
+ templatesRoot: string;
6
+ /** `'existing:<menuId>'`, `'new:<menuId>'`, or `'none'`. Default `'none'`. */
7
+ menu?: string;
8
+ runGen?: boolean;
9
+ }
10
+ export interface AddCrudResult {
11
+ created: string[];
12
+ modified: string[];
13
+ menu?: {
14
+ id: string;
15
+ created: boolean;
16
+ };
17
+ genRan: boolean;
18
+ }
19
+ export declare function addCrud(opts: AddCrudOptions): AddCrudResult;
@@ -0,0 +1,37 @@
1
+ import type { InputKind } from './parseModel';
2
+ /**
3
+ * Optional override file at `src/models/<Name>.crud.ts`:
4
+ *
5
+ * export default {
6
+ * title: 'Users',
7
+ * icon: 'person',
8
+ * hidden: ['createdAt'],
9
+ * order: ['name', 'email'],
10
+ * fields: {
11
+ * email: { label: 'Email', input: 'text', placeholder: 'name@x.io' },
12
+ * role: { input: 'select', options: ['admin', 'user'] },
13
+ * },
14
+ * };
15
+ */
16
+ export interface CrudFieldOverride {
17
+ label?: string;
18
+ placeholder?: string;
19
+ input?: InputKind;
20
+ options?: string[];
21
+ /** Hide this field from list table. Default: visible. */
22
+ hideInList?: boolean;
23
+ /** Hide this field from form. Default: visible (unless in `hidden`). */
24
+ hideInForm?: boolean;
25
+ }
26
+ export interface CrudConfig {
27
+ /** Plural display label (e.g. "Users"). Default: model plural id. */
28
+ title?: string;
29
+ /** Codicon for menu entry. Default: 'symbol-misc'. */
30
+ icon?: string;
31
+ /** Field names hidden from BOTH list and form. */
32
+ hidden?: string[];
33
+ /** Explicit field display order (form + list). Unlisted fields appended in source order. */
34
+ order?: string[];
35
+ fields?: Record<string, CrudFieldOverride>;
36
+ }
37
+ export declare function readCrudConfig(projectRoot: string, modelName: string): CrudConfig;
@@ -0,0 +1,33 @@
1
+ export interface ParsedField {
2
+ name: string;
3
+ /** Raw TS type as written in the interface (e.g. `string`, `number`, `'a' | 'b'`, `Date`). */
4
+ type: string;
5
+ optional: boolean;
6
+ }
7
+ export interface ParsedModel {
8
+ /** PascalCase interface name. */
9
+ name: string;
10
+ /** camelCase id (file basename of the model file). */
11
+ id: string;
12
+ /** Plural identifier (e.g. `Users`). */
13
+ plural: string;
14
+ /** Collection name passed to defineEntity (e.g. `'users'`). */
15
+ collection: string;
16
+ /** Field declared as primaryKey in defineEntity call. */
17
+ primaryKey: string;
18
+ /** Field names listed in indexes (may be empty). */
19
+ indexes: string[];
20
+ /** Ordered field list from the interface body. */
21
+ fields: ParsedField[];
22
+ /** Absolute path the model was read from. */
23
+ path: string;
24
+ }
25
+ export declare function parseModelFile(file: string): ParsedModel;
26
+ /** Classify a TS field type into a UI input kind for the form generator. */
27
+ export type InputKind = 'text' | 'number' | 'boolean' | 'date' | 'select' | 'textarea';
28
+ export interface InputSpec {
29
+ kind: InputKind;
30
+ /** For `select`: literal values (`'a' | 'b'` → `['a','b']`). */
31
+ options?: string[];
32
+ }
33
+ export declare function inferInputSpec(type: string): InputSpec;
@@ -0,0 +1,16 @@
1
+ export type DbProvider = 'storage' | 'global';
2
+ export interface InitDbOptions {
3
+ projectRoot: string;
4
+ templatesRoot: string;
5
+ provider?: DbProvider;
6
+ /** Overwrite existing helpers/db.ts. Default false (idempotent). */
7
+ force?: boolean;
8
+ }
9
+ export interface InitDbResult {
10
+ created: string[];
11
+ skipped: string[];
12
+ path: string;
13
+ provider: DbProvider;
14
+ }
15
+ export declare function initDb(opts: InitDbOptions): InitDbResult;
16
+ export declare function dbExists(projectRoot: string): boolean;
@@ -0,0 +1,10 @@
1
+ export interface WireResult {
2
+ status: 'wired' | 'already-wired' | 'unrecognized' | 'no-entry';
3
+ path: string;
4
+ message?: string;
5
+ }
6
+ /**
7
+ * Patch `src/extension/extension.ts` to import `initDb` and add it as an
8
+ * `onActivate` hook on the `bootstrap(registry)` call. Idempotent.
9
+ */
10
+ export declare function wireInitDb(projectRoot: string, importPath?: string): WireResult;
@@ -0,0 +1,30 @@
1
+ export type CheckLevel = 'ok' | 'warn' | 'error';
2
+ export interface CheckResult {
3
+ id: string;
4
+ level: CheckLevel;
5
+ message: string;
6
+ /** Optional details printed indented under the line. */
7
+ details?: string[];
8
+ /** Safe auto-fix. Returns a one-line description of what was done. */
9
+ fix?: () => string;
10
+ }
11
+ export interface FixApplied {
12
+ id: string;
13
+ message: string;
14
+ }
15
+ export interface DoctorReport {
16
+ projectRoot: string;
17
+ displayName: string;
18
+ results: CheckResult[];
19
+ counts: {
20
+ ok: number;
21
+ warn: number;
22
+ error: number;
23
+ };
24
+ }
25
+ export interface DoctorOptions {
26
+ projectRoot: string;
27
+ }
28
+ export declare function runDoctor(opts: DoctorOptions): DoctorReport;
29
+ /** Apply every fix on the report and return what was done. */
30
+ export declare function applyFixes(report: DoctorReport): FixApplied[];
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Walks up from `start` looking for a package.json whose `scripts.gen` matches
3
+ * the vsceasy-generated value. Returns the directory containing it.
4
+ */
5
+ export declare function findProjectRoot(start?: string): string;
6
+ /**
7
+ * Resolves the bundled templates/ directory. Works whether the CLI runs from
8
+ * the source tree (src/) or the compiled dist/.
9
+ */
10
+ export declare function findTemplatesRoot(fromFile?: string): string;
@@ -0,0 +1,14 @@
1
+ export type HelperKind = 'secrets' | 'config' | 'state' | 'notifications' | 'cache';
2
+ export declare const HELPER_KINDS: HelperKind[];
3
+ export interface AddHelperOptions {
4
+ kind: HelperKind;
5
+ projectRoot: string;
6
+ templatesRoot: string;
7
+ /** Overwrite existing helper file. Default false. */
8
+ force?: boolean;
9
+ }
10
+ export interface AddHelperResult {
11
+ created: string[];
12
+ skipped: string[];
13
+ }
14
+ export declare function addHelper(opts: AddHelperOptions): AddHelperResult;
@@ -0,0 +1,7 @@
1
+ export interface IconPickerOptions {
2
+ /** Called once before each step. Use to redraw header/preview. */
3
+ onBeforeStep?: (label: string) => void;
4
+ /** Allow returning '' (no icon). Default true. */
5
+ allowNone?: boolean;
6
+ }
7
+ export declare function pickIcon(opts?: IconPickerOptions): Promise<string>;
@@ -0,0 +1,46 @@
1
+ export { scaffold, substitute } from './scaffold';
2
+ export type { ScaffoldOptions } from './scaffold';
3
+ export { addPanel } from './panel/add';
4
+ export type { AddPanelOptions, AddPanelResult } from './panel/add';
5
+ export { addMenu } from './menu/add';
6
+ export type { AddMenuOptions, AddMenuResult } from './menu/add';
7
+ export { addCommand } from './command/add';
8
+ export type { AddCommandOptions, AddCommandResult } from './command/add';
9
+ export { addRpcMethod } from './rpc/add';
10
+ export type { AddRpcMethodOptions, AddRpcMethodResult } from './rpc/add';
11
+ export { addStatusBar } from './statusBar/add';
12
+ export type { AddStatusBarOptions, AddStatusBarResult } from './statusBar/add';
13
+ export { addSubpanel } from './subpanel/add';
14
+ export type { AddSubpanelOptions, AddSubpanelResult } from './subpanel/add';
15
+ export { editMenu, listMenus, listPanels, listCommands, listGroups } from './menu/edit';
16
+ export type { EditMenuOptions, EditMenuResult, NewMenuItem, MenuItemKind } from './menu/edit';
17
+ export { runDoctor, applyFixes } from './doctor';
18
+ export type { CheckResult, DoctorReport, CheckLevel } from './doctor';
19
+ export { upgrade } from './upgrade';
20
+ export type { UpgradeOptions, UpgradeResult, FileChange } from './upgrade';
21
+ export { findProjectRoot, findTemplatesRoot } from './findProject';
22
+ export { readConfig, writeConfig, configPath } from './config';
23
+ export type { VsceasyConfig } from './config';
24
+ export { addTreeView } from './treeView/add';
25
+ export type { AddTreeViewOptions, AddTreeViewResult } from './treeView/add';
26
+ export { setupTests } from './testSetup';
27
+ export type { TestSetupOptions, TestSetupResult } from './testSetup';
28
+ export { assertId, assertNoOverwrite, assertSiblingExists } from './validate';
29
+ export { publishInit } from './publish/init';
30
+ export type { PublishInitOptions, PublishInitResult } from './publish/init';
31
+ export { addHelper, HELPER_KINDS } from './helper/add';
32
+ export type { AddHelperOptions, AddHelperResult, HelperKind } from './helper/add';
33
+ export { addJob } from './job/add';
34
+ export type { AddJobOptions, AddJobResult, JobTrigger } from './job/add';
35
+ export { initDb, dbExists } from './db/init';
36
+ export type { InitDbOptions, InitDbResult, DbProvider } from './db/init';
37
+ export { wireInitDb } from './db/wire';
38
+ export type { WireResult } from './db/wire';
39
+ export { addCrud } from './crud/add';
40
+ export type { AddCrudOptions, AddCrudResult } from './crud/add';
41
+ export { parseModelFile, inferInputSpec } from './crud/parseModel';
42
+ export type { ParsedField, ParsedModel, InputKind, InputSpec } from './crud/parseModel';
43
+ export { readCrudConfig } from './crud/crudConfig';
44
+ export type { CrudConfig, CrudFieldOverride } from './crud/crudConfig';
45
+ export { addModel } from './model/add';
46
+ export type { AddModelOptions, AddModelResult, ModelField } from './model/add';
@@ -0,0 +1,30 @@
1
+ export declare const style: {
2
+ DIM: string;
3
+ BOLD: string;
4
+ CYAN: string;
5
+ GREEN: string;
6
+ YELLOW: string;
7
+ INV: string;
8
+ RST: string;
9
+ };
10
+ export declare function askText(question: string, defaultValue?: string): Promise<string>;
11
+ export interface ListOption<T = unknown> {
12
+ label: string;
13
+ value: T;
14
+ hint?: string;
15
+ /** Optional indicator/glyph shown before label. */
16
+ badge?: string;
17
+ /** Disable selection. */
18
+ disabled?: boolean;
19
+ }
20
+ export interface SelectOptions {
21
+ /** Show search-filter input. Default: auto (>8 items). */
22
+ filter?: boolean;
23
+ /** Max rows visible before scroll. Default: 10. */
24
+ pageSize?: number;
25
+ /** Pre-render block (header above the list). */
26
+ header?: string;
27
+ }
28
+ export declare function select<T>(question: string, options: ListOption<T>[], opts?: SelectOptions): Promise<T>;
29
+ /** Confirm yes/no with arrow keys. */
30
+ export declare function confirm(question: string, defaultYes?: boolean): Promise<boolean>;
@@ -0,0 +1,24 @@
1
+ export type JobTrigger = {
2
+ every: string;
3
+ } | {
4
+ dailyAt: string;
5
+ } | {
6
+ on: 'startup' | 'saveDocument' | 'openDocument' | 'changeActiveEditor' | 'changeConfig';
7
+ } | {
8
+ onFile: string;
9
+ };
10
+ export interface AddJobOptions {
11
+ name: string;
12
+ title?: string;
13
+ trigger: JobTrigger;
14
+ /** Skip run if last successful execution was less than this many ms ago. */
15
+ minIntervalMs?: number;
16
+ projectRoot: string;
17
+ templatesRoot: string;
18
+ runGen?: boolean;
19
+ }
20
+ export interface AddJobResult {
21
+ created: string[];
22
+ genRan: boolean;
23
+ }
24
+ export declare function addJob(opts: AddJobOptions): AddJobResult;
@@ -0,0 +1,13 @@
1
+ export interface AddMenuOptions {
2
+ name: string;
3
+ title?: string;
4
+ icon?: string;
5
+ projectRoot: string;
6
+ templatesRoot: string;
7
+ runGen?: boolean;
8
+ }
9
+ export interface AddMenuResult {
10
+ created: string[];
11
+ genRan: boolean;
12
+ }
13
+ export declare function addMenu(opts: AddMenuOptions): AddMenuResult;
@@ -0,0 +1,39 @@
1
+ export type MenuItemKind = 'panel' | 'command' | 'url' | 'group';
2
+ export interface NewMenuItem {
3
+ label: string;
4
+ kind: MenuItemKind;
5
+ /** target id for panel/command, URL string for url, undefined for group */
6
+ target?: string;
7
+ icon?: string;
8
+ description?: string;
9
+ /** Parent group label. undefined = root items array */
10
+ parentLabel?: string;
11
+ }
12
+ export interface EditMenuOptions {
13
+ projectRoot: string;
14
+ /** Menu name (file basename without .ts). */
15
+ menuName: string;
16
+ item: NewMenuItem;
17
+ /** Run `bun run gen` after writing. Default true. */
18
+ runGen?: boolean;
19
+ }
20
+ export interface EditMenuResult {
21
+ file: string;
22
+ inserted: string;
23
+ genRan: boolean;
24
+ }
25
+ /** List menu files in src/menus/. */
26
+ export declare function listMenus(projectRoot: string): string[];
27
+ /** List panels in src/panels/. */
28
+ export declare function listPanels(projectRoot: string): string[];
29
+ /** List commands in src/commands/. */
30
+ export declare function listCommands(projectRoot: string): string[];
31
+ /** Extract top-level group labels from a menu file source. */
32
+ export declare function listGroups(src: string): string[];
33
+ export declare function editMenu(opts: EditMenuOptions): EditMenuResult;
34
+ interface InsertResult {
35
+ source: string;
36
+ inserted: string;
37
+ }
38
+ export declare function insertItem(src: string, item: NewMenuItem): InsertResult;
39
+ export {};
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Lightweight parser for menu source -> tree of items.
3
+ * Reads label, icon, kind/target, and nested children from a single .ts menu file.
4
+ *
5
+ * Heuristic, not a full TS parser: matches the shape emitted by
6
+ * defineMenu({ items: [...] }) in the framework templates.
7
+ */
8
+ export type MenuNodeKind = 'panel' | 'command' | 'url' | 'group' | 'item';
9
+ export interface MenuNode {
10
+ label: string;
11
+ kind: MenuNodeKind;
12
+ target?: string;
13
+ icon?: string;
14
+ children?: MenuNode[];
15
+ }
16
+ export interface MenuTree {
17
+ title?: string;
18
+ icon?: string;
19
+ items: MenuNode[];
20
+ }
21
+ export declare function parseMenu(src: string): MenuTree;
22
+ export interface RenderOptions {
23
+ /** Highlight insertion point: parent group label, or 'root' for top-level. */
24
+ insertUnder?: string | 'root';
25
+ /** Optional "ghost" item shown at the insertion point (preview). */
26
+ ghost?: {
27
+ label: string;
28
+ kind: MenuNodeKind;
29
+ target?: string;
30
+ icon?: string;
31
+ };
32
+ }
33
+ export declare function renderMenuTree(tree: MenuTree, opts?: RenderOptions): string;
@@ -0,0 +1,27 @@
1
+ export interface ModelField {
2
+ name: string;
3
+ /** Raw TS type. e.g. `string`, `number`, `string | null`, `Date`, `'a' | 'b'`. */
4
+ type: string;
5
+ /** Add `?` to the field name (becomes optional). */
6
+ optional?: boolean;
7
+ /** Mark as primary key. Exactly one field must be PK. Default: first field named `id`. */
8
+ primaryKey?: boolean;
9
+ /** Add to entity `indexes` (speeds up findOne by this field). */
10
+ indexed?: boolean;
11
+ }
12
+ export interface AddModelOptions {
13
+ name: string;
14
+ fields: ModelField[];
15
+ /** Plural identifier used as repository handle. Default: `${Name}s`. */
16
+ plural?: string;
17
+ /** Collection name persisted on disk. Default: `${plural.toLowerCase()}`. */
18
+ collection?: string;
19
+ projectRoot: string;
20
+ templatesRoot: string;
21
+ }
22
+ export interface AddModelResult {
23
+ created: string[];
24
+ primaryKey: string;
25
+ indexes: string[];
26
+ }
27
+ export declare function addModel(opts: AddModelOptions): AddModelResult;
@@ -0,0 +1,14 @@
1
+ import type { ModelField } from './add';
2
+ /**
3
+ * Parse a compact model field spec into `ModelField[]`.
4
+ *
5
+ * Spec: comma-separated field lines, each `name[?]:type[!][@]`.
6
+ * `?` after name → optional
7
+ * `!` after type → primaryKey
8
+ * `@` after type → indexed
9
+ *
10
+ * Example: `id:string!,name:string,email?:string@,score:number`
11
+ */
12
+ export declare function parseFieldsSpec(spec: string): ModelField[];
13
+ /** Parse a single `name[?]:type[!][@]` line. Throws on malformed input. */
14
+ export declare function parseFieldLine(raw: string): ModelField;
@@ -0,0 +1,29 @@
1
+ export type PanelTemplate = 'blank' | 'form' | 'list' | 'dashboard';
2
+ export declare const PANEL_TEMPLATES: PanelTemplate[];
3
+ export interface AddPanelOptions {
4
+ /** Panel id — camelCase recommended. */
5
+ name: string;
6
+ /** Tab title shown in VS Code. Defaults to PascalCase of name. */
7
+ title?: string;
8
+ /** Generate a typed RPC API interface in src/shared/api.ts. Default true. */
9
+ withApi?: boolean;
10
+ /**
11
+ * Starter UI. `blank` = empty App.tsx. `form`/`list`/`dashboard` generate a
12
+ * working UI built from src/webview/components (auto-generated if missing) and
13
+ * wire matching RPC methods. Non-blank templates force `withApi` on. Default `blank`.
14
+ */
15
+ template?: PanelTemplate;
16
+ /** Project root (output of findProjectRoot). */
17
+ projectRoot: string;
18
+ /** Bundled templates root (output of findTemplatesRoot). */
19
+ templatesRoot: string;
20
+ /** Run `bun run gen` after writing files. Default true. */
21
+ runGen?: boolean;
22
+ }
23
+ export interface AddPanelResult {
24
+ created: string[];
25
+ modified: string[];
26
+ skipped: string[];
27
+ genRan: boolean;
28
+ }
29
+ export declare function addPanel(opts: AddPanelOptions): AddPanelResult;
@@ -0,0 +1,12 @@
1
+ export interface PublishInitOptions {
2
+ projectRoot: string;
3
+ templatesRoot: string;
4
+ runDryPack?: boolean;
5
+ }
6
+ export interface PublishInitResult {
7
+ created: string[];
8
+ pkgUpdated: boolean;
9
+ warnings: string[];
10
+ dryPackOk: boolean | null;
11
+ }
12
+ export declare function publishInit(opts: PublishInitOptions): PublishInitResult;
@@ -0,0 +1,22 @@
1
+ export interface AddRpcMethodOptions {
2
+ /** Panel id (basename in src/panels/). */
3
+ panel: string;
4
+ /** Method name (camelCase). */
5
+ method: string;
6
+ /** Raw TS parameter list (e.g. "pattern: string, limit?: number"). Empty for none. */
7
+ paramSig?: string;
8
+ /** Return type (e.g. "string[]"). Defaults to "void". Wrapped in Promise<>. */
9
+ returns?: string;
10
+ projectRoot: string;
11
+ /** Run `bun run gen` after writing. Default false (no contributes change). */
12
+ runGen?: boolean;
13
+ }
14
+ export interface AddRpcMethodResult {
15
+ apiFile: string;
16
+ panelFile: string;
17
+ interfaceCreated: boolean;
18
+ rpcBlockCreated: boolean;
19
+ webviewSnippet: string;
20
+ genRan: boolean;
21
+ }
22
+ export declare function addRpcMethod(opts: AddRpcMethodOptions): AddRpcMethodResult;
@@ -0,0 +1,13 @@
1
+ export type ScaffoldPreset = 'minimal' | 'full';
2
+ export interface ScaffoldOptions {
3
+ name: string;
4
+ displayName: string;
5
+ description: string;
6
+ publisher: string;
7
+ ui: 'react';
8
+ targetDir: string;
9
+ templatesRoot: string;
10
+ preset?: ScaffoldPreset;
11
+ }
12
+ export declare function scaffold(opts: ScaffoldOptions): Promise<void>;
13
+ export declare function substitute(input: string, vars: Record<string, string>): string;
@@ -0,0 +1,33 @@
1
+ export interface AddStatusBarOptions {
2
+ name: string;
3
+ text: string;
4
+ alignment?: 'left' | 'right';
5
+ priority?: number;
6
+ tooltip?: string;
7
+ tooltipMarkdown?: string;
8
+ icon?: string;
9
+ /** Existing command id (basename in src/commands/) OR full vscode command id. */
10
+ command?: string;
11
+ /** Panel id (basename in src/panels/). Takes precedence over command when set. */
12
+ panel?: string;
13
+ /** QuickPick menu items shown on click. Overrides command/panel when set. */
14
+ menu?: Array<{
15
+ label: string;
16
+ description?: string;
17
+ detail?: string;
18
+ command?: string;
19
+ panel?: string;
20
+ url?: string;
21
+ }>;
22
+ /** When set, bootstraps a new command via addCommand lib and binds it. */
23
+ newCommandTitle?: string;
24
+ projectRoot: string;
25
+ templatesRoot: string;
26
+ runGen?: boolean;
27
+ }
28
+ export interface AddStatusBarResult {
29
+ created: string[];
30
+ commandCreated?: string;
31
+ genRan: boolean;
32
+ }
33
+ export declare function addStatusBar(opts: AddStatusBarOptions): AddStatusBarResult;
@@ -0,0 +1,20 @@
1
+ export interface AddSubpanelOptions {
2
+ /** Subpanel id — camelCase. Becomes file basename + view id suffix. */
3
+ name: string;
4
+ /** Section header shown in the sidebar. Defaults to PascalCase of name. */
5
+ title?: string;
6
+ /** Menu (activity bar container) this view lives in — basename in src/menus/. */
7
+ menu: string;
8
+ /** Generate a typed RPC API interface. Default true. */
9
+ withApi?: boolean;
10
+ projectRoot: string;
11
+ templatesRoot: string;
12
+ runGen?: boolean;
13
+ }
14
+ export interface AddSubpanelResult {
15
+ created: string[];
16
+ modified: string[];
17
+ skipped: string[];
18
+ genRan: boolean;
19
+ }
20
+ export declare function addSubpanel(opts: AddSubpanelOptions): AddSubpanelResult;
@@ -0,0 +1,10 @@
1
+ export interface TestSetupOptions {
2
+ projectRoot: string;
3
+ templatesRoot: string;
4
+ force?: boolean;
5
+ }
6
+ export interface TestSetupResult {
7
+ created: string[];
8
+ pkgUpdated: boolean;
9
+ }
10
+ export declare function setupTests(opts: TestSetupOptions): TestSetupResult;
@@ -0,0 +1,13 @@
1
+ export interface AddTreeViewOptions {
2
+ name: string;
3
+ title?: string;
4
+ menu: string;
5
+ projectRoot: string;
6
+ templatesRoot: string;
7
+ runGen?: boolean;
8
+ }
9
+ export interface AddTreeViewResult {
10
+ created: string[];
11
+ genRan: boolean;
12
+ }
13
+ export declare function addTreeView(opts: AddTreeViewOptions): AddTreeViewResult;