@vicinae/api 0.21.0 → 0.21.1

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.
package/dist/api/alert.js CHANGED
@@ -39,7 +39,8 @@ const styleMap = {
39
39
  */
40
40
  const confirmAlert = async (options) => {
41
41
  return new Promise((resolve) => {
42
- (0, client_1.getClient)().UI.confirmAlert({
42
+ (0, client_1.getClient)()
43
+ .UI.confirmAlert({
43
44
  title: options.title,
44
45
  description: options.message ?? "Are you sure?",
45
46
  //icon: options.icon && serializeProtoImage(options.icon),
@@ -52,7 +53,8 @@ const confirmAlert = async (options) => {
52
53
  title: options.dismissAction?.title ?? "Cancel",
53
54
  style: styleMap[options.dismissAction?.style ?? Alert.ActionStyle.Cancel],
54
55
  },
55
- }).then((confirmed) => {
56
+ })
57
+ .then((confirmed) => {
56
58
  if (confirmed) {
57
59
  options.primaryAction?.onAction?.();
58
60
  }
@@ -49,6 +49,12 @@ export declare namespace Action {
49
49
  app?: Application;
50
50
  };
51
51
  }
52
+ namespace OpenWith {
53
+ type Props = BaseActionProps & {
54
+ path: string;
55
+ onOpen?: (path: string) => void;
56
+ };
57
+ }
52
58
  namespace Trash {
53
59
  type PathArg = PathLike | PathLike[];
54
60
  export type Props = BaseActionProps & {
@@ -122,7 +128,7 @@ export declare const Action: React.FC<ActionProps> & {
122
128
  Paste: React.FC<Action.Paste.Props>;
123
129
  SubmitForm: React.FC<Action.SubmitForm.Props>;
124
130
  OpenInBrowser: React.FC<Action.OpenInBrowser.Props>;
125
- OpenWith: () => null;
131
+ OpenWith: React.FC<Action.OpenWith.Props>;
126
132
  Trash: React.FC<Action.Trash.Props>;
127
133
  ShowInFinder: React.FC<Action.ShowInFinderProps.Props>;
128
134
  RunInTerminal: React.FC<Action.RunInTerminal.Props>;
@@ -10,6 +10,8 @@ const image_1 = require("../image");
10
10
  const utils_1 = require("../utils");
11
11
  const icon_1 = require("../icon");
12
12
  const controls_1 = require("../controls");
13
+ const action_pannel_1 = require("./action-pannel");
14
+ const toast_1 = require("../toast");
13
15
  const ActionRoot = ({ icon, ...props }) => {
14
16
  const serializedIcon = icon ? (0, image_1.serializeProtoImage)(icon) : icon;
15
17
  const stableIdRef = (0, react_1.useRef)(undefined);
@@ -37,43 +39,25 @@ const Open = ({ target, app, ...props }) => {
37
39
  (0, utils_1.open)(target, app);
38
40
  } }));
39
41
  };
40
- // TODO: export when action panel is less buggy
41
- const OpenWith = () => null;
42
- /*
43
- const OpenWith: React.FC<Action.OpenWith.Props> = ({
44
- path,
45
- title = "Open with...",
46
- shortcut,
47
- icon,
48
- ...props
49
- }) => {
50
- const [apps, setApps] = useState<Application[]>([]);
51
-
42
+ const OpenWith = ({ path, title = "Open with...", shortcut, icon, ...props }) => {
43
+ const [apps, setApps] = (0, react_1.useState)([]);
52
44
  const fetchApps = () => {
53
- getApplications(path).then(setApps);
45
+ (0, utils_1.getApplications)(path).then(setApps);
54
46
  };
55
-
56
- return (
57
- <ActionPanel.Submenu
58
- title={title}
59
- icon={icon}
60
- shortcut={shortcut}
61
- onOpen={() => {
62
- fetchApps();
63
- }}
64
- >
65
- {apps.map((app) => (
66
- <Action
67
- key={app.id}
68
- title={`Open in ${app.name}`}
69
- icon={app.icon}
70
- onAction={() => props.onOpen?.(path)}
71
- />
72
- ))}
73
- </ActionPanel.Submenu>
74
- );
47
+ return ((0, jsx_runtime_1.jsx)(action_pannel_1.ActionPanel.Submenu, { title: title, icon: icon, shortcut: shortcut, onOpen: () => {
48
+ fetchApps();
49
+ }, children: apps.map((app) => ((0, jsx_runtime_1.jsx)(exports.Action, { title: `Open in ${app.name}`, icon: app.icon, onAction: () => {
50
+ (0, controls_1.closeMainWindow)();
51
+ (0, utils_1.open)(path, app)
52
+ .then(() => {
53
+ props.onOpen?.(path);
54
+ })
55
+ .catch(async (error) => {
56
+ (0, toast_1.showToast)({ title: `Failed to open app` });
57
+ console.error("Failed to open app", error);
58
+ });
59
+ } }, app.id))) }));
75
60
  };
76
- */
77
61
  const Trash = ({ title, paths, ...props }) => {
78
62
  const actionTitle = title ?? `Delete item${Array.isArray(paths) ? "s" : ""}`;
79
63
  return ((0, jsx_runtime_1.jsx)(ActionRoot, { title: actionTitle, ...props, onAction: async () => {
@@ -33,12 +33,12 @@ const FormRoot = ({ enableDrafts = false, actions, children, isLoading = false,
33
33
  const TextField = ({ ref, value, onChange, ...props }) => {
34
34
  (0, use_imperative_form_handle_1.useImperativeFormHandle)(ref);
35
35
  const [countedValue, wrappedOnChange] = (0, use_event_counted_1.useEventCounted)(value, onChange);
36
- return (0, jsx_runtime_1.jsx)("text-field", { ...wrapFormItemProps(props), value: countedValue, onChange: wrappedOnChange });
36
+ return ((0, jsx_runtime_1.jsx)("text-field", { ...wrapFormItemProps(props), value: countedValue, onChange: wrappedOnChange }));
37
37
  };
38
38
  const PasswordField = ({ ref, value, onChange, ...props }) => {
39
39
  (0, use_imperative_form_handle_1.useImperativeFormHandle)(ref);
40
40
  const [countedValue, wrappedOnChange] = (0, use_event_counted_1.useEventCounted)(value, onChange);
41
- return (0, jsx_runtime_1.jsx)("password-field", { ...props, value: countedValue, onChange: wrappedOnChange });
41
+ return ((0, jsx_runtime_1.jsx)("password-field", { ...props, value: countedValue, onChange: wrappedOnChange }));
42
42
  };
43
43
  var DatePickerType;
44
44
  (function (DatePickerType) {
@@ -94,7 +94,7 @@ const TagPicker = Object.assign(TagPickerRoot, {
94
94
  const TextArea = ({ ref, value, onChange, ...props }) => {
95
95
  (0, use_imperative_form_handle_1.useImperativeFormHandle)(ref);
96
96
  const [countedValue, wrappedOnChange] = (0, use_event_counted_1.useEventCounted)(value, onChange);
97
- return (0, jsx_runtime_1.jsx)("text-area-field", { ...wrapFormItemProps(props), value: countedValue, onChange: wrappedOnChange });
97
+ return ((0, jsx_runtime_1.jsx)("text-area-field", { ...wrapFormItemProps(props), value: countedValue, onChange: wrappedOnChange }));
98
98
  };
99
99
  const FilePicker = ({ ref, ...props }) => {
100
100
  (0, use_imperative_form_handle_1.useImperativeFormHandle)(ref);
@@ -15,7 +15,9 @@ const MetadataLabel = (props) => {
15
15
  let serializedText;
16
16
  if (props.text && typeof props.text === "object") {
17
17
  serializedText = {
18
- color: props.text.color ? (0, color_1.serializeColorLike)(props.text.color) : undefined,
18
+ color: props.text.color
19
+ ? (0, color_1.serializeColorLike)(props.text.color)
20
+ : undefined,
19
21
  value: props.text.value,
20
22
  };
21
23
  }
@@ -23,7 +25,7 @@ const MetadataLabel = (props) => {
23
25
  serializedText = props.text;
24
26
  }
25
27
  const { text, ...restProps } = props;
26
- return (0, jsx_runtime_1.jsx)("metadata-label", { ...restProps, icon: serializedIcon, text: serializedText });
28
+ return ((0, jsx_runtime_1.jsx)("metadata-label", { ...restProps, icon: serializedIcon, text: serializedText }));
27
29
  };
28
30
  const MetadataSeparator = () => {
29
31
  return (0, jsx_runtime_1.jsx)("metadata-separator", {});
@@ -31,10 +31,9 @@ export declare namespace FileSearch {
31
31
  * @returns Promise resolving to array of matching files
32
32
  *
33
33
  * @remarks
34
- * Uses prefix matching on filename tokens. For example:
35
- * - File: "invoice-new-motherboard.pdf"
36
- * - Matches: "inv", "new", "mother", "pdf"
37
- * - No match: "board", "oice" (not prefixes)
34
+ * Uses fuzzy filename matching backed by Vicinae's file index. For example:
35
+ * - File: "example folder"
36
+ * - Matches: "fol exa", "exa fol", "ex fold"
38
37
  *
39
38
  * @example
40
39
  * ```typescript
@@ -34,10 +34,9 @@ var FileSearch;
34
34
  * @returns Promise resolving to array of matching files
35
35
  *
36
36
  * @remarks
37
- * Uses prefix matching on filename tokens. For example:
38
- * - File: "invoice-new-motherboard.pdf"
39
- * - Matches: "inv", "new", "mother", "pdf"
40
- * - No match: "board", "oice" (not prefixes)
37
+ * Uses fuzzy filename matching backed by Vicinae's file index. For example:
38
+ * - File: "example folder"
39
+ * - Matches: "fol exa", "exa fol", "ex fold"
41
40
  *
42
41
  * @example
43
42
  * ```typescript
@@ -15,10 +15,10 @@ export declare class RpcTransport {
15
15
  private requestMap;
16
16
  private handlers;
17
17
  }
18
- export type ImageMask = 'None' | 'Circle' | 'RoundedRectangle';
19
- export type ToastStyle = 'Success' | 'Info' | 'Warning' | 'Error' | 'Dynamic';
20
- export type PopToRootType = 'Default' | 'Immediate' | 'Suspended';
21
- export type ConfirmAlertActionStyle = 'Default' | 'Destructive' | 'Cancel';
18
+ export type ImageMask = "None" | "Circle" | "RoundedRectangle";
19
+ export type ToastStyle = "Success" | "Info" | "Warning" | "Error" | "Dynamic";
20
+ export type PopToRootType = "Default" | "Immediate" | "Suspended";
21
+ export type ConfirmAlertActionStyle = "Default" | "Destructive" | "Cancel";
22
22
  export type Application = {
23
23
  id: string;
24
24
  name: string;
@@ -30,7 +30,7 @@ class RpcTransport {
30
30
  const promise = new Promise((resolve, reject) => {
31
31
  this.requestMap.set(id, { resolve: (msg) => resolve(msg), reject });
32
32
  });
33
- this.sendMessage({ jsonrpc: '2.0', id, method, params });
33
+ this.sendMessage({ jsonrpc: "2.0", id, method, params });
34
34
  return promise;
35
35
  }
36
36
  subscribe(method, cb) {
@@ -52,11 +52,10 @@ class RpcTransport {
52
52
  this.transport.send(JSON.stringify(msg));
53
53
  }
54
54
  id = 1;
55
- requestMap = new Map;
56
- handlers = new Map;
55
+ requestMap = new Map();
56
+ handlers = new Map();
57
57
  }
58
58
  exports.RpcTransport = RpcTransport;
59
- ;
60
59
  class ApplicationService {
61
60
  transport;
62
61
  constructor(transport) {
@@ -72,7 +71,10 @@ class ApplicationService {
72
71
  return this.transport.request("Application/getDefault", { target });
73
72
  }
74
73
  showInFileBrowser(target, select) {
75
- return this.transport.request("Application/showInFileBrowser", { target, select });
74
+ return this.transport.request("Application/showInFileBrowser", {
75
+ target,
76
+ select,
77
+ });
76
78
  }
77
79
  runInTerminal(opts) {
78
80
  return this.transport.request("Application/runInTerminal", { opts });
@@ -87,7 +89,12 @@ class UIService {
87
89
  return this.transport.request("UI/render", { json });
88
90
  }
89
91
  showToast(id, title, message, style) {
90
- return this.transport.request("UI/showToast", { id, title, message, style });
92
+ return this.transport.request("UI/showToast", {
93
+ id,
94
+ title,
95
+ message,
96
+ style,
97
+ });
91
98
  }
92
99
  updateToast(id, title) {
93
100
  return this.transport.request("UI/updateToast", { id, title });
@@ -96,10 +103,17 @@ class UIService {
96
103
  return this.transport.request("UI/hideToast", { id });
97
104
  }
98
105
  showHud(text, clear_root, popToRoot) {
99
- return this.transport.request("UI/showHud", { text, clear_root, popToRoot });
106
+ return this.transport.request("UI/showHud", {
107
+ text,
108
+ clear_root,
109
+ popToRoot,
110
+ });
100
111
  }
101
112
  closeMainWindow(clearRoot, popToRoot) {
102
- return this.transport.request("UI/closeMainWindow", { clearRoot, popToRoot });
113
+ return this.transport.request("UI/closeMainWindow", {
114
+ clearRoot,
115
+ popToRoot,
116
+ });
103
117
  }
104
118
  popToRoot(clearSearchBar) {
105
119
  return this.transport.request("UI/popToRoot", { clearSearchBar });
@@ -141,7 +155,9 @@ class WindowManagementService {
141
155
  return this.transport.request("WindowManagement/getActiveWorkspace", {});
142
156
  }
143
157
  getWindows(workspaceId) {
144
- return this.transport.request("WindowManagement/getWindows", { workspaceId });
158
+ return this.transport.request("WindowManagement/getWindows", {
159
+ workspaceId,
160
+ });
145
161
  }
146
162
  getScreens() {
147
163
  return this.transport.request("WindowManagement/getScreens", {});
@@ -150,7 +166,10 @@ class WindowManagementService {
150
166
  return this.transport.request("WindowManagement/getWorkspaces", {});
151
167
  }
152
168
  setWindowBounds(winId, bounds) {
153
- return this.transport.request("WindowManagement/setWindowBounds", { winId, bounds });
169
+ return this.transport.request("WindowManagement/setWindowBounds", {
170
+ winId,
171
+ bounds,
172
+ });
154
173
  }
155
174
  }
156
175
  class ClipboardService {
@@ -257,7 +276,9 @@ class Client {
257
276
  this.OAuth = new OAuthService(this.transport);
258
277
  this.EventCore = new EventCoreService(this.transport);
259
278
  }
260
- route(msg) { this.transport.dispatchMessage(msg); }
279
+ route(msg) {
280
+ this.transport.dispatchMessage(msg);
281
+ }
261
282
  Application;
262
283
  UI;
263
284
  WindowManagement;
@@ -51,7 +51,9 @@ const transformWindow = (proto) => {
51
51
  var WindowManagement;
52
52
  (function (WindowManagement) {
53
53
  async function getWindows(workspaceId) {
54
- return (0, client_1.getClient)().WindowManagement.getWindows(workspaceId).then((wins) => wins.map(transformWindow));
54
+ return (0, client_1.getClient)()
55
+ .WindowManagement.getWindows(workspaceId)
56
+ .then((wins) => wins.map(transformWindow));
55
57
  }
56
58
  WindowManagement.getWindows = getWindows;
57
59
  /**
@@ -76,7 +78,9 @@ var WindowManagement;
76
78
  * Return the list of screens (physical and virtual) currently attached to the computer.
77
79
  */
78
80
  async function getScreens() {
79
- return (0, client_1.getClient)().WindowManagement.getScreens().then((screens) => screens.map((sc) => ({
81
+ return (0, client_1.getClient)()
82
+ .WindowManagement.getScreens()
83
+ .then((screens) => screens.map((sc) => ({
80
84
  name: sc.name,
81
85
  make: sc.make,
82
86
  model: sc.model,
@@ -89,15 +93,21 @@ var WindowManagement;
89
93
  }
90
94
  WindowManagement.getScreens = getScreens;
91
95
  async function getActiveWorkspace() {
92
- return (0, client_1.getClient)().WindowManagement.getActiveWorkspace().then(transformWorkspace);
96
+ return (0, client_1.getClient)()
97
+ .WindowManagement.getActiveWorkspace()
98
+ .then(transformWorkspace);
93
99
  }
94
100
  WindowManagement.getActiveWorkspace = getActiveWorkspace;
95
101
  async function getWorkspaces() {
96
- return (0, client_1.getClient)().WindowManagement.getWorkspaces().then((workspaces) => workspaces.map(transformWorkspace));
102
+ return (0, client_1.getClient)()
103
+ .WindowManagement.getWorkspaces()
104
+ .then((workspaces) => workspaces.map(transformWorkspace));
97
105
  }
98
106
  WindowManagement.getWorkspaces = getWorkspaces;
99
107
  async function getWindowsOnActiveWorkspace() {
100
- return (0, client_1.getClient)().WindowManagement.getActiveWorkspace().then((ws) => getWindows(ws.id));
108
+ return (0, client_1.getClient)()
109
+ .WindowManagement.getActiveWorkspace()
110
+ .then((ws) => getWindows(ws.id));
101
111
  }
102
112
  WindowManagement.getWindowsOnActiveWorkspace = getWindowsOnActiveWorkspace;
103
113
  async function getActiveWindow() {
package/dist/bin.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/bin.js ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const cli_js_1 = require("./cli.js");
5
+ (0, cli_js_1.main)();
package/dist/cli.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ interface FlagDef {
2
+ short?: string;
3
+ description: string;
4
+ default?: string;
5
+ }
6
+ export interface CommandDef {
7
+ description: string;
8
+ flags: Record<string, FlagDef>;
9
+ run: (flags: Record<string, string | undefined>) => Promise<void>;
10
+ }
11
+ export declare function main(): Promise<void>;
12
+ export {};
package/dist/cli.js ADDED
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.main = main;
7
+ const index_js_1 = __importDefault(require("./commands/build/index.js"));
8
+ const index_js_2 = __importDefault(require("./commands/develop/index.js"));
9
+ const index_js_3 = __importDefault(require("./commands/lint/index.js"));
10
+ function parseFlags(argv, defs) {
11
+ const result = {};
12
+ for (const [name, def] of Object.entries(defs)) {
13
+ if (def.default !== undefined)
14
+ result[name] = def.default;
15
+ }
16
+ const shortToLong = new Map();
17
+ for (const [name, def] of Object.entries(defs)) {
18
+ if (def.short)
19
+ shortToLong.set(def.short, name);
20
+ }
21
+ for (let i = 0; i < argv.length; i++) {
22
+ const arg = argv[i];
23
+ if (arg.startsWith("--")) {
24
+ const eqIdx = arg.indexOf("=");
25
+ if (eqIdx !== -1) {
26
+ result[arg.slice(2, eqIdx)] = arg.slice(eqIdx + 1);
27
+ }
28
+ else {
29
+ result[arg.slice(2)] = argv[++i];
30
+ }
31
+ }
32
+ else if (arg.startsWith("-") && arg.length === 2) {
33
+ const long = shortToLong.get(arg[1]);
34
+ if (long)
35
+ result[long] = argv[++i];
36
+ }
37
+ }
38
+ return result;
39
+ }
40
+ function printHelp(commands) {
41
+ console.log("vici - Vicinae extension development CLI\n");
42
+ console.log("USAGE");
43
+ console.log(" $ vici <command> [flags]\n");
44
+ console.log("COMMANDS");
45
+ for (const [name, cmd] of Object.entries(commands)) {
46
+ console.log(` ${name.padEnd(12)} ${cmd.description}`);
47
+ }
48
+ console.log(`\nRun "vici <command> --help" for more information about a command.`);
49
+ }
50
+ function printCommandHelp(name, cmd) {
51
+ console.log(`vici ${name} - ${cmd.description}\n`);
52
+ console.log("USAGE");
53
+ console.log(` $ vici ${name} [flags]\n`);
54
+ const flagEntries = Object.entries(cmd.flags);
55
+ if (flagEntries.length === 0)
56
+ return;
57
+ console.log("FLAGS");
58
+ for (const [flagName, def] of flagEntries) {
59
+ const short = def.short ? `-${def.short}, ` : " ";
60
+ const defaultHint = def.default !== undefined
61
+ ? ` (default: ${def.default === process.cwd() ? "cwd" : def.default})`
62
+ : "";
63
+ console.log(` ${short}--${flagName.padEnd(10)} ${def.description}${defaultHint}`);
64
+ }
65
+ }
66
+ async function main() {
67
+ const commands = { build: index_js_1.default, develop: index_js_2.default, lint: index_js_3.default };
68
+ const [commandName, ...rest] = process.argv.slice(2);
69
+ if (!commandName || commandName === "--help" || commandName === "-h") {
70
+ printHelp(commands);
71
+ return;
72
+ }
73
+ const cmd = commands[commandName];
74
+ if (!cmd) {
75
+ console.error(`Unknown command: ${commandName}\n`);
76
+ printHelp(commands);
77
+ process.exit(1);
78
+ }
79
+ if (rest.includes("--help") || rest.includes("-h")) {
80
+ printCommandHelp(commandName, cmd);
81
+ return;
82
+ }
83
+ const flags = parseFlags(rest, cmd.flags);
84
+ await cmd.run(flags);
85
+ }
@@ -1,11 +1,3 @@
1
- import { Command } from "@oclif/core";
2
- export default class Build extends Command {
3
- static args: {};
4
- static description: string;
5
- static examples: string[];
6
- static flags: {
7
- out: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
- src: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
9
- };
10
- run(): Promise<void>;
11
- }
1
+ import type { CommandDef } from "../../cli.js";
2
+ declare const build: CommandDef;
3
+ export default build;
@@ -36,39 +36,28 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- const core_1 = require("@oclif/core");
40
39
  const esbuild = __importStar(require("esbuild"));
41
40
  const node_child_process_1 = require("node:child_process");
42
41
  const node_fs_1 = require("node:fs");
43
42
  const node_path_1 = require("node:path");
43
+ const manifest_js_1 = __importDefault(require("../../schemas/manifest.js"));
44
+ const extension_types_js_1 = require("../../utils/extension-types.js");
44
45
  const logger_js_1 = require("../../utils/logger.js");
45
46
  const utils_js_1 = require("../../utils/utils.js");
46
- const extension_types_js_1 = require("../../utils/extension-types.js");
47
- const manifest_js_1 = __importDefault(require("../../schemas/manifest.js"));
48
- class Build extends core_1.Command {
49
- static args = {};
50
- static description = "Start an extension development session";
51
- static examples = [
52
- `<%= config.bin %> <%= command.id %> --target /path/to/extension`,
53
- ];
54
- static flags = {
55
- out: core_1.Flags.string({
56
- aliases: ["output"],
57
- char: "o",
47
+ const build = {
48
+ description: "Build an extension for distribution",
49
+ flags: {
50
+ out: {
51
+ short: "o",
58
52
  description: "Path to output the compiled extension bundle to. Defaults to Vicinae extension directory.",
59
- required: false,
60
- }),
61
- src: core_1.Flags.string({
62
- aliases: ["src"],
63
- char: "s",
64
- default: process.cwd(),
65
- defaultHelp: "The current working directory",
53
+ },
54
+ src: {
55
+ short: "s",
66
56
  description: "Path to the extension source directory",
67
- required: false,
68
- }),
69
- };
70
- async run() {
71
- const { flags } = await this.parse(Build);
57
+ default: process.cwd(),
58
+ },
59
+ },
60
+ async run(flags) {
72
61
  const logger = new logger_js_1.Logger();
73
62
  const src = flags.src ?? process.cwd();
74
63
  const pkgPath = (0, node_path_1.join)(src, "package.json");
@@ -84,7 +73,7 @@ class Build extends core_1.Command {
84
73
  }
85
74
  const manifest = e.data;
86
75
  const outDir = flags.out ?? (0, node_path_1.join)((0, utils_js_1.extensionDataDir)(), manifest.name);
87
- const build = async (outDir) => {
76
+ const doBuild = async (outDir) => {
88
77
  const entryPoints = manifest.commands.map((cmd) => (0, node_path_1.join)("src", `${cmd.name}.tsx`));
89
78
  logger.logInfo(`entrypoints [${entryPoints.join(", ")}]`);
90
79
  const promises = manifest.commands.map((cmd) => {
@@ -95,7 +84,6 @@ class Build extends core_1.Command {
95
84
  if (cmd.mode === "view" && !(0, node_fs_1.existsSync)(tsxSource)) {
96
85
  throw new Error(`Unable to find view command ${cmd.name} at ${tsxSource}`);
97
86
  }
98
- // we allow .ts or .tsx for no-view
99
87
  if (cmd.mode === "no-view") {
100
88
  if (!(0, node_fs_1.existsSync)(tsxSource)) {
101
89
  source = tsSource;
@@ -138,8 +126,8 @@ class Build extends core_1.Command {
138
126
  process.exit(1);
139
127
  }
140
128
  (0, node_fs_1.mkdirSync)(outDir, { recursive: true });
141
- await build(outDir);
129
+ await doBuild(outDir);
142
130
  logger.logReady(`built extension successfully - output at ${outDir}`);
143
- }
144
- }
145
- exports.default = Build;
131
+ },
132
+ };
133
+ exports.default = build;
@@ -1,10 +1,3 @@
1
- import { Command } from "@oclif/core";
2
- export default class Develop extends Command {
3
- static args: {};
4
- static description: string;
5
- static examples: string[];
6
- static flags: {
7
- target: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
8
- };
9
- run(): Promise<void>;
10
- }
1
+ import type { CommandDef } from "../../cli.js";
2
+ declare const develop: CommandDef;
3
+ export default develop;
@@ -36,39 +36,31 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- const core_1 = require("@oclif/core");
40
39
  const chokidar = __importStar(require("chokidar"));
41
40
  const esbuild = __importStar(require("esbuild"));
42
41
  const node_child_process_1 = require("node:child_process");
43
42
  const fs = __importStar(require("node:fs"));
44
43
  const fsp = __importStar(require("node:fs/promises"));
45
44
  const path = __importStar(require("node:path"));
45
+ const manifest_js_1 = __importDefault(require("../../schemas/manifest.js"));
46
+ const extension_types_js_1 = require("../../utils/extension-types.js");
46
47
  const logger_js_1 = require("../../utils/logger.js");
48
+ const tail_js_1 = require("../../utils/tail.js");
47
49
  const utils_js_1 = require("../../utils/utils.js");
48
- const extension_types_js_1 = require("../../utils/extension-types.js");
49
50
  const vicinae_js_1 = require("../../utils/vicinae.js");
50
- const manifest_js_1 = __importDefault(require("../../schemas/manifest.js"));
51
- const tail_js_1 = require("../../utils/tail.js");
52
- class Develop extends core_1.Command {
53
- static args = {};
54
- static description = "Start an extension development session";
55
- static examples = [
56
- `<%= config.bin %> <%= command.id %> --target /path/to/extension`,
57
- ];
58
- static flags = {
59
- target: core_1.Flags.string({
60
- aliases: ["input"],
61
- char: "i",
62
- default: process.cwd(),
63
- defaultHelp: "The current working directory",
51
+ const develop = {
52
+ description: "Start an extension development session",
53
+ flags: {
54
+ target: {
55
+ short: "i",
64
56
  description: "Path to the extension directory",
65
- required: false,
66
- }),
67
- };
68
- async run() {
69
- const { flags } = await this.parse(Develop);
57
+ default: process.cwd(),
58
+ },
59
+ },
60
+ async run(flags) {
70
61
  const logger = new logger_js_1.Logger();
71
- const pkgPath = path.join(flags.target, "package.json");
62
+ const target = flags.target ?? process.cwd();
63
+ const pkgPath = path.join(target, "package.json");
72
64
  const parseManifest = () => {
73
65
  if (!fs.existsSync(pkgPath)) {
74
66
  logger.logError(`No package.json found at ${pkgPath}. Does this location point to a valid extension repository?`);
@@ -85,7 +77,7 @@ class Develop extends core_1.Command {
85
77
  let manifest = parseManifest();
86
78
  const vicinae = new vicinae_js_1.VicinaeClient();
87
79
  logger.logInfo("Generating extension types...");
88
- (0, extension_types_js_1.updateExtensionTypes)(manifest, flags.target);
80
+ (0, extension_types_js_1.updateExtensionTypes)(manifest, target);
89
81
  const typeCheck = async () => {
90
82
  const spawned = (0, node_child_process_1.spawn)("npx", ["tsc", "--noEmit"]);
91
83
  let stderr = Buffer.from("");
@@ -97,16 +89,6 @@ class Develop extends core_1.Command {
97
89
  });
98
90
  };
99
91
  const build = async (outDir) => {
100
- /*
101
- logger.logInfo("Started type checking in background thread");
102
- typeCheck().then(({ error, ok }) => {
103
- if (!ok) {
104
- logger.logInfo(`Type checking error: ${error}`);
105
- }
106
-
107
- logger.logInfo("Done type checking");
108
- });
109
- */
110
92
  const entryPoints = manifest.commands
111
93
  .map((cmd) => path.join("src", `${cmd.name}.tsx`))
112
94
  .filter(fs.existsSync);
@@ -119,7 +101,6 @@ class Develop extends core_1.Command {
119
101
  if (cmd.mode === "view" && !fs.existsSync(tsxSource)) {
120
102
  throw new Error(`could not find entrypoint src/${cmd.name}.tsx for command ${cmd.name}.`);
121
103
  }
122
- // we allow .ts or .tsx for no-view
123
104
  if (cmd.mode === "no-view") {
124
105
  if (!fs.existsSync(tsxSource)) {
125
106
  source = tsSource;
@@ -173,7 +154,7 @@ class Develop extends core_1.Command {
173
154
  }
174
155
  }
175
156
  };
176
- process.chdir(flags.target);
157
+ process.chdir(target);
177
158
  const dataDir = (0, utils_js_1.extensionDataDir)();
178
159
  const id = `${manifest.name}`;
179
160
  const extensionDir = path.join(dataDir, id);
@@ -209,15 +190,15 @@ class Develop extends core_1.Command {
209
190
  awaitWriteFinish: { pollInterval: 100, stabilityThreshold: 100 },
210
191
  ignoreInitial: true,
211
192
  })
212
- .on("all", async (_, path) => {
213
- if (path.endsWith("package.json")) {
193
+ .on("all", async (_, filePath) => {
194
+ if (filePath.endsWith("package.json")) {
214
195
  manifest = parseManifest();
215
196
  logger.logInfo("Generating extension types...");
216
- (0, extension_types_js_1.updateExtensionTypes)(manifest, flags.target);
197
+ (0, extension_types_js_1.updateExtensionTypes)(manifest, target);
217
198
  }
218
- logger.logEvent(`changed file ${path}`);
199
+ logger.logEvent(`changed file ${filePath}`);
219
200
  await safeBuild(extensionDir);
220
201
  });
221
- }
222
- }
223
- exports.default = Develop;
202
+ },
203
+ };
204
+ exports.default = develop;
@@ -1,10 +1,3 @@
1
- import { Command } from "@oclif/core";
2
- export default class Lint extends Command {
3
- static args: {};
4
- static description: string;
5
- static examples: string[];
6
- static flags: {
7
- src: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
8
- };
9
- run(): Promise<void>;
10
- }
1
+ import type { CommandDef } from "../../cli.js";
2
+ declare const lint: CommandDef;
3
+ export default lint;
@@ -3,30 +3,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const core_1 = require("@oclif/core");
7
6
  const node_fs_1 = require("node:fs");
8
7
  const node_path_1 = require("node:path");
9
- const logger_js_1 = require("../../utils/logger.js");
10
8
  const manifest_js_1 = __importDefault(require("../../schemas/manifest.js"));
11
- class Lint extends core_1.Command {
12
- static args = {};
13
- static description = "Validate the extension manifest (package.json)";
14
- static examples = [
15
- `<%= config.bin %> <%= command.id %>`,
16
- `<%= config.bin %> <%= command.id %> --src /path/to/extension`,
17
- ];
18
- static flags = {
19
- src: core_1.Flags.string({
20
- aliases: ["src"],
21
- char: "s",
22
- default: process.cwd(),
23
- defaultHelp: "The current working directory",
9
+ const logger_js_1 = require("../../utils/logger.js");
10
+ const lint = {
11
+ description: "Validate the extension manifest (package.json)",
12
+ flags: {
13
+ src: {
14
+ short: "s",
24
15
  description: "Path to the extension source directory",
25
- required: false,
26
- }),
27
- };
28
- async run() {
29
- const { flags } = await this.parse(Lint);
16
+ default: process.cwd(),
17
+ },
18
+ },
19
+ async run(flags) {
30
20
  const logger = new logger_js_1.Logger();
31
21
  const src = flags.src ?? process.cwd();
32
22
  const pkgPath = (0, node_path_1.join)(src, "package.json");
@@ -41,6 +31,6 @@ class Lint extends core_1.Command {
41
31
  process.exit(1);
42
32
  }
43
33
  logger.logReady(`Manifest is valid`);
44
- }
45
- }
46
- exports.default = Lint;
34
+ },
35
+ };
36
+ exports.default = lint;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vicinae/api",
3
- "version": "0.21.0",
3
+ "version": "0.21.1",
4
4
  "description": "TypeScript SDK to build Vicinae extensions",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -10,7 +10,7 @@
10
10
  "format": "biome format --write"
11
11
  },
12
12
  "bin": {
13
- "vici": "./bin/run.js"
13
+ "vici": "./dist/bin.js"
14
14
  },
15
15
  "files": [
16
16
  "dist",
@@ -27,15 +27,9 @@
27
27
  },
28
28
  "main": "dist/index.js",
29
29
  "dependencies": {
30
- "@jgoz/esbuild-plugin-typecheck": "^4.0.3",
31
- "@oclif/core": "^4",
32
- "@oclif/plugin-help": "^6",
33
- "@oclif/plugin-plugins": "^5",
34
- "@types/node": ">=18",
35
- "@types/react": "19.0.10",
36
30
  "chokidar": "^4.0.3",
37
31
  "esbuild": "^0.25.2",
38
- "react": "19.0.0",
32
+ "react": "^19.0.0",
39
33
  "zod": "^4.0.17"
40
34
  },
41
35
  "peerDependencies": {
@@ -44,28 +38,12 @@
44
38
  },
45
39
  "devDependencies": {
46
40
  "@biomejs/biome": "2.3.2",
47
- "@oclif/test": "^4",
48
- "@types/chai": "^4",
49
- "@types/mocha": "^10",
50
- "chai": "^4",
51
- "mocha": "^11.7.5",
52
- "oclif": "^4",
53
- "shx": "^0.3.3",
54
- "ts-node": "^10",
55
- "typedoc": "^0.28.13",
56
- "typedoc-github-theme": "^0.3.1",
57
- "typedoc-plugin-markdown": "^4.8.1",
58
- "typescript": "^5"
59
- },
60
- "oclif": {
61
- "bin": "vici",
62
- "dirname": "vici",
63
- "commands": "./dist/commands",
64
- "plugins": [
65
- "@oclif/plugin-help"
66
- ],
67
- "topicSeparator": " ",
68
- "topics": {}
41
+ "@types/node": "24.3.0",
42
+ "@types/react": "19.0.10",
43
+ "typedoc": "0.28.13",
44
+ "typedoc-github-theme": "0.3.1",
45
+ "typedoc-plugin-markdown": "4.8.1",
46
+ "typescript": "5.9.2"
69
47
  },
70
48
  "repository": "vicinaehq/vicinae"
71
49
  }
package/types/jsx.d.ts CHANGED
@@ -48,11 +48,11 @@ declare module "react" {
48
48
  id?: string;
49
49
  subtitle?: string;
50
50
  icon?:
51
- | SerializedImageLike
52
- | {
53
- value?: SerializedImageLike | null;
54
- tooltip: string;
55
- };
51
+ | SerializedImageLike
52
+ | {
53
+ value?: SerializedImageLike | null;
54
+ tooltip: string;
55
+ };
56
56
  keywords?: string[];
57
57
  accessories?: List.Item.SerializedAccessory[];
58
58
  children?: React.ReactNode;
package/bin/run.js DELETED
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const { execute } = require("@oclif/core");
4
-
5
- const main = async () => {
6
- await execute({ dir: __filename });
7
- };
8
-
9
- main();