vertex-notes 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 (60) hide show
  1. package/bin/run.js +4 -0
  2. package/dist/chunk-4QLCD6TZ.js +479 -0
  3. package/dist/chunk-4QLCD6TZ.js.map +1 -0
  4. package/dist/chunk-DDFOKGIX.js +50 -0
  5. package/dist/chunk-DDFOKGIX.js.map +1 -0
  6. package/dist/chunk-FWK2J3FR.js +163 -0
  7. package/dist/chunk-FWK2J3FR.js.map +1 -0
  8. package/dist/chunk-PBF5EE4Y.js +42 -0
  9. package/dist/chunk-PBF5EE4Y.js.map +1 -0
  10. package/dist/commands/capture.js +44 -0
  11. package/dist/commands/capture.js.map +1 -0
  12. package/dist/commands/daily.js +53 -0
  13. package/dist/commands/daily.js.map +1 -0
  14. package/dist/commands/delete.js +38 -0
  15. package/dist/commands/delete.js.map +1 -0
  16. package/dist/commands/edit.js +88 -0
  17. package/dist/commands/edit.js.map +1 -0
  18. package/dist/commands/export.js +46 -0
  19. package/dist/commands/export.js.map +1 -0
  20. package/dist/commands/hello.js +16 -0
  21. package/dist/commands/hello.js.map +1 -0
  22. package/dist/commands/help.js +108 -0
  23. package/dist/commands/help.js.map +1 -0
  24. package/dist/commands/interactive.js +211 -0
  25. package/dist/commands/interactive.js.map +1 -0
  26. package/dist/commands/login.js +162 -0
  27. package/dist/commands/login.js.map +1 -0
  28. package/dist/commands/logout.js +17 -0
  29. package/dist/commands/logout.js.map +1 -0
  30. package/dist/commands/new.js +28 -0
  31. package/dist/commands/new.js.map +1 -0
  32. package/dist/commands/notes.js +45 -0
  33. package/dist/commands/notes.js.map +1 -0
  34. package/dist/commands/restore.js +35 -0
  35. package/dist/commands/restore.js.map +1 -0
  36. package/dist/commands/search.js +38 -0
  37. package/dist/commands/search.js.map +1 -0
  38. package/dist/commands/status.js +39 -0
  39. package/dist/commands/status.js.map +1 -0
  40. package/dist/commands/tags.js +32 -0
  41. package/dist/commands/tags.js.map +1 -0
  42. package/dist/commands/today.js +33 -0
  43. package/dist/commands/today.js.map +1 -0
  44. package/dist/commands/trash/empty.js +24 -0
  45. package/dist/commands/trash/empty.js.map +1 -0
  46. package/dist/commands/trash/index.js +37 -0
  47. package/dist/commands/trash/index.js.map +1 -0
  48. package/dist/commands/view.js +35 -0
  49. package/dist/commands/view.js.map +1 -0
  50. package/dist/commands/whoami.js +22 -0
  51. package/dist/commands/whoami.js.map +1 -0
  52. package/dist/index.js +6 -0
  53. package/dist/index.js.map +1 -0
  54. package/dist/lib/client.js +11 -0
  55. package/dist/lib/client.js.map +1 -0
  56. package/dist/lib/config.js +13 -0
  57. package/dist/lib/config.js.map +1 -0
  58. package/dist/lib/md-to-tiptap.js +7 -0
  59. package/dist/lib/md-to-tiptap.js.map +1 -0
  60. package/package.json +42 -0
@@ -0,0 +1,50 @@
1
+ import {
2
+ loadConfig,
3
+ saveConfig
4
+ } from "./chunk-PBF5EE4Y.js";
5
+ import {
6
+ createSupabaseClient
7
+ } from "./chunk-4QLCD6TZ.js";
8
+
9
+ // src/lib/client.ts
10
+ var cachedClient = null;
11
+ async function getClient() {
12
+ if (cachedClient) return cachedClient;
13
+ const config = loadConfig();
14
+ if (!config.accessToken || !config.refreshToken) {
15
+ throw new Error("Not logged in. Run: vertex login");
16
+ }
17
+ const client = createSupabaseClient(config.supabaseUrl, config.supabaseAnonKey);
18
+ const { data, error } = await client.auth.setSession({
19
+ access_token: config.accessToken,
20
+ refresh_token: config.refreshToken
21
+ });
22
+ if (error) {
23
+ throw new Error(`Session expired. Run: vertex login
24
+ ${error.message}`);
25
+ }
26
+ if (data.session) {
27
+ saveConfig({
28
+ accessToken: data.session.access_token,
29
+ refreshToken: data.session.refresh_token,
30
+ userId: data.session.user.id,
31
+ email: data.session.user.email
32
+ });
33
+ }
34
+ cachedClient = client;
35
+ return client;
36
+ }
37
+ async function getUserId() {
38
+ const config = loadConfig();
39
+ if (config.userId) return config.userId;
40
+ const client = await getClient();
41
+ const { data } = await client.auth.getUser();
42
+ if (!data.user) throw new Error("Not logged in. Run: vertex login");
43
+ return data.user.id;
44
+ }
45
+
46
+ export {
47
+ getClient,
48
+ getUserId
49
+ };
50
+ //# sourceMappingURL=chunk-DDFOKGIX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/client.ts"],"sourcesContent":["import { createSupabaseClient, type SupabaseClient } from \"@vertex/core\";\nimport { loadConfig, saveConfig } from \"./config.js\";\n\nlet cachedClient: SupabaseClient | null = null;\n\nexport async function getClient(): Promise<SupabaseClient> {\n if (cachedClient) return cachedClient;\n\n const config = loadConfig();\n if (!config.accessToken || !config.refreshToken) {\n throw new Error(\"Not logged in. Run: vertex login\");\n }\n\n const client = createSupabaseClient(config.supabaseUrl, config.supabaseAnonKey);\n\n const { data, error } = await client.auth.setSession({\n access_token: config.accessToken,\n refresh_token: config.refreshToken,\n });\n\n if (error) {\n throw new Error(`Session expired. Run: vertex login\\n${error.message}`);\n }\n\n if (data.session) {\n saveConfig({\n accessToken: data.session.access_token,\n refreshToken: data.session.refresh_token,\n userId: data.session.user.id,\n email: data.session.user.email,\n });\n }\n\n cachedClient = client;\n return client;\n}\n\nexport async function getUserId(): Promise<string> {\n const config = loadConfig();\n if (config.userId) return config.userId;\n const client = await getClient();\n const { data } = await client.auth.getUser();\n if (!data.user) throw new Error(\"Not logged in. Run: vertex login\");\n return data.user.id;\n}\n"],"mappings":";;;;;;;;;AAGA,IAAI,eAAsC;AAE1C,eAAsB,YAAqC;AACzD,MAAI,aAAc,QAAO;AAEzB,QAAM,SAAS,WAAW;AAC1B,MAAI,CAAC,OAAO,eAAe,CAAC,OAAO,cAAc;AAC/C,UAAM,IAAI,MAAM,kCAAkC;AAAA,EACpD;AAEA,QAAM,SAAS,qBAAqB,OAAO,aAAa,OAAO,eAAe;AAE9E,QAAM,EAAE,MAAM,MAAM,IAAI,MAAM,OAAO,KAAK,WAAW;AAAA,IACnD,cAAc,OAAO;AAAA,IACrB,eAAe,OAAO;AAAA,EACxB,CAAC;AAED,MAAI,OAAO;AACT,UAAM,IAAI,MAAM;AAAA,EAAuC,MAAM,OAAO,EAAE;AAAA,EACxE;AAEA,MAAI,KAAK,SAAS;AAChB,eAAW;AAAA,MACT,aAAa,KAAK,QAAQ;AAAA,MAC1B,cAAc,KAAK,QAAQ;AAAA,MAC3B,QAAQ,KAAK,QAAQ,KAAK;AAAA,MAC1B,OAAO,KAAK,QAAQ,KAAK;AAAA,IAC3B,CAAC;AAAA,EACH;AAEA,iBAAe;AACf,SAAO;AACT;AAEA,eAAsB,YAA6B;AACjD,QAAM,SAAS,WAAW;AAC1B,MAAI,OAAO,OAAQ,QAAO,OAAO;AACjC,QAAM,SAAS,MAAM,UAAU;AAC/B,QAAM,EAAE,KAAK,IAAI,MAAM,OAAO,KAAK,QAAQ;AAC3C,MAAI,CAAC,KAAK,KAAM,OAAM,IAAI,MAAM,kCAAkC;AAClE,SAAO,KAAK,KAAK;AACnB;","names":[]}
@@ -0,0 +1,163 @@
1
+ // src/lib/md-to-tiptap.ts
2
+ function markdownToTiptap(md) {
3
+ const lines = md.split("\n");
4
+ const nodes = [];
5
+ let i = 0;
6
+ while (i < lines.length) {
7
+ const line = lines[i];
8
+ if (line.match(/^#{1,4}\s/)) {
9
+ const match = line.match(/^(#{1,4})\s(.*)$/);
10
+ if (match) {
11
+ nodes.push({
12
+ type: "heading",
13
+ attrs: { level: match[1].length },
14
+ content: parseInline(match[2])
15
+ });
16
+ }
17
+ i++;
18
+ continue;
19
+ }
20
+ if (line.match(/^```/)) {
21
+ const langMatch = line.match(/^```(\w*)$/);
22
+ const language = langMatch?.[1] || "plaintext";
23
+ const codeLines = [];
24
+ i++;
25
+ while (i < lines.length && !lines[i].match(/^```$/)) {
26
+ codeLines.push(lines[i]);
27
+ i++;
28
+ }
29
+ i++;
30
+ nodes.push({
31
+ type: "codeBlock",
32
+ attrs: { language },
33
+ content: [{ type: "text", text: codeLines.join("\n") }]
34
+ });
35
+ continue;
36
+ }
37
+ if (line.match(/^\$\$/)) {
38
+ const mathLines = [];
39
+ i++;
40
+ while (i < lines.length && !lines[i].match(/^\$\$$/)) {
41
+ mathLines.push(lines[i]);
42
+ i++;
43
+ }
44
+ i++;
45
+ nodes.push({
46
+ type: "mathBlock",
47
+ content: [{ type: "text", text: mathLines.join("\n") }]
48
+ });
49
+ continue;
50
+ }
51
+ if (line.match(/^>\s/)) {
52
+ const quoteLines = [];
53
+ while (i < lines.length && lines[i].match(/^>\s?/)) {
54
+ quoteLines.push(lines[i].replace(/^>\s?/, ""));
55
+ i++;
56
+ }
57
+ nodes.push({
58
+ type: "blockquote",
59
+ content: [{ type: "paragraph", content: parseInline(quoteLines.join("\n")) }]
60
+ });
61
+ continue;
62
+ }
63
+ if (line.match(/^---$/)) {
64
+ nodes.push({ type: "horizontalRule" });
65
+ i++;
66
+ continue;
67
+ }
68
+ if (line.match(/^[-*]\s\[[ x]\]\s/)) {
69
+ const taskItems = [];
70
+ while (i < lines.length && lines[i].match(/^[-*]\s\[[ x]\]\s/)) {
71
+ const m = lines[i].match(/^[-*]\s\[([ x])\]\s(.*)$/);
72
+ if (m) {
73
+ taskItems.push({
74
+ type: "taskItem",
75
+ attrs: { checked: m[1] === "x" },
76
+ content: [{ type: "paragraph", content: parseInline(m[2]) }]
77
+ });
78
+ }
79
+ i++;
80
+ }
81
+ nodes.push({ type: "taskList", content: taskItems });
82
+ continue;
83
+ }
84
+ if (line.match(/^[-*]\s/)) {
85
+ const items = [];
86
+ while (i < lines.length && lines[i].match(/^[-*]\s/)) {
87
+ const text = lines[i].replace(/^[-*]\s/, "");
88
+ items.push({
89
+ type: "listItem",
90
+ content: [{ type: "paragraph", content: parseInline(text) }]
91
+ });
92
+ i++;
93
+ }
94
+ nodes.push({ type: "bulletList", content: items });
95
+ continue;
96
+ }
97
+ if (line.match(/^\d+\.\s/)) {
98
+ const items = [];
99
+ while (i < lines.length && lines[i].match(/^\d+\.\s/)) {
100
+ const text = lines[i].replace(/^\d+\.\s/, "");
101
+ items.push({
102
+ type: "listItem",
103
+ content: [{ type: "paragraph", content: parseInline(text) }]
104
+ });
105
+ i++;
106
+ }
107
+ nodes.push({ type: "orderedList", content: items });
108
+ continue;
109
+ }
110
+ if (line.trim() === "") {
111
+ i++;
112
+ continue;
113
+ }
114
+ const paraLines = [];
115
+ while (i < lines.length && lines[i].trim() !== "" && !lines[i].match(/^#{1,4}\s/) && !lines[i].match(/^```/) && !lines[i].match(/^---$/) && !lines[i].match(/^[-*]\s/) && !lines[i].match(/^\d+\.\s/) && !lines[i].match(/^>\s/)) {
116
+ paraLines.push(lines[i]);
117
+ i++;
118
+ }
119
+ nodes.push({
120
+ type: "paragraph",
121
+ content: parseInline(paraLines.join("\n"))
122
+ });
123
+ }
124
+ if (nodes.length === 0) {
125
+ nodes.push({ type: "paragraph" });
126
+ }
127
+ return { type: "doc", content: nodes };
128
+ }
129
+ function parseInline(text) {
130
+ if (!text) return [];
131
+ const nodes = [];
132
+ const regex = /(\*\*(.+?)\*\*|\*(.+?)\*|`(.+?)`|~~(.+?)~~|\[\[(.+?)\]\]|#([a-zA-Z][a-zA-Z0-9_-]*))/g;
133
+ let lastIndex = 0;
134
+ let match;
135
+ while ((match = regex.exec(text)) !== null) {
136
+ if (match.index > lastIndex) {
137
+ nodes.push({ type: "text", text: text.slice(lastIndex, match.index) });
138
+ }
139
+ if (match[2]) {
140
+ nodes.push({ type: "text", text: match[2], marks: [{ type: "bold" }] });
141
+ } else if (match[3]) {
142
+ nodes.push({ type: "text", text: match[3], marks: [{ type: "italic" }] });
143
+ } else if (match[4]) {
144
+ nodes.push({ type: "text", text: match[4], marks: [{ type: "code" }] });
145
+ } else if (match[5]) {
146
+ nodes.push({ type: "text", text: match[5], marks: [{ type: "strike" }] });
147
+ } else if (match[6]) {
148
+ nodes.push({ type: "text", text: `[[${match[6]}]]` });
149
+ } else if (match[7]) {
150
+ nodes.push({ type: "text", text: `#${match[7]}` });
151
+ }
152
+ lastIndex = match.index + match[0].length;
153
+ }
154
+ if (lastIndex < text.length) {
155
+ nodes.push({ type: "text", text: text.slice(lastIndex) });
156
+ }
157
+ return nodes.length > 0 ? nodes : [{ type: "text", text: text || " " }];
158
+ }
159
+
160
+ export {
161
+ markdownToTiptap
162
+ };
163
+ //# sourceMappingURL=chunk-FWK2J3FR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/md-to-tiptap.ts"],"sourcesContent":["interface TiptapNode {\n type: string;\n attrs?: Record<string, unknown>;\n content?: TiptapNode[];\n text?: string;\n marks?: Array<{ type: string; attrs?: Record<string, unknown> }>;\n}\n\nexport function markdownToTiptap(md: string): Record<string, unknown> {\n const lines = md.split(\"\\n\");\n const nodes: TiptapNode[] = [];\n let i = 0;\n\n while (i < lines.length) {\n const line = lines[i];\n\n if (line.match(/^#{1,4}\\s/)) {\n const match = line.match(/^(#{1,4})\\s(.*)$/);\n if (match) {\n nodes.push({\n type: \"heading\",\n attrs: { level: match[1].length },\n content: parseInline(match[2]),\n });\n }\n i++;\n continue;\n }\n\n if (line.match(/^```/)) {\n const langMatch = line.match(/^```(\\w*)$/);\n const language = langMatch?.[1] || \"plaintext\";\n const codeLines: string[] = [];\n i++;\n while (i < lines.length && !lines[i].match(/^```$/)) {\n codeLines.push(lines[i]);\n i++;\n }\n i++;\n nodes.push({\n type: \"codeBlock\",\n attrs: { language },\n content: [{ type: \"text\", text: codeLines.join(\"\\n\") }],\n });\n continue;\n }\n\n if (line.match(/^\\$\\$/)) {\n const mathLines: string[] = [];\n i++;\n while (i < lines.length && !lines[i].match(/^\\$\\$$/)) {\n mathLines.push(lines[i]);\n i++;\n }\n i++;\n nodes.push({\n type: \"mathBlock\",\n content: [{ type: \"text\", text: mathLines.join(\"\\n\") }],\n });\n continue;\n }\n\n if (line.match(/^>\\s/)) {\n const quoteLines: string[] = [];\n while (i < lines.length && lines[i].match(/^>\\s?/)) {\n quoteLines.push(lines[i].replace(/^>\\s?/, \"\"));\n i++;\n }\n nodes.push({\n type: \"blockquote\",\n content: [{ type: \"paragraph\", content: parseInline(quoteLines.join(\"\\n\")) }],\n });\n continue;\n }\n\n if (line.match(/^---$/)) {\n nodes.push({ type: \"horizontalRule\" });\n i++;\n continue;\n }\n\n if (line.match(/^[-*]\\s\\[[ x]\\]\\s/)) {\n const taskItems: TiptapNode[] = [];\n while (i < lines.length && lines[i].match(/^[-*]\\s\\[[ x]\\]\\s/)) {\n const m = lines[i].match(/^[-*]\\s\\[([ x])\\]\\s(.*)$/);\n if (m) {\n taskItems.push({\n type: \"taskItem\",\n attrs: { checked: m[1] === \"x\" },\n content: [{ type: \"paragraph\", content: parseInline(m[2]) }],\n });\n }\n i++;\n }\n nodes.push({ type: \"taskList\", content: taskItems });\n continue;\n }\n\n if (line.match(/^[-*]\\s/)) {\n const items: TiptapNode[] = [];\n while (i < lines.length && lines[i].match(/^[-*]\\s/)) {\n const text = lines[i].replace(/^[-*]\\s/, \"\");\n items.push({\n type: \"listItem\",\n content: [{ type: \"paragraph\", content: parseInline(text) }],\n });\n i++;\n }\n nodes.push({ type: \"bulletList\", content: items });\n continue;\n }\n\n if (line.match(/^\\d+\\.\\s/)) {\n const items: TiptapNode[] = [];\n while (i < lines.length && lines[i].match(/^\\d+\\.\\s/)) {\n const text = lines[i].replace(/^\\d+\\.\\s/, \"\");\n items.push({\n type: \"listItem\",\n content: [{ type: \"paragraph\", content: parseInline(text) }],\n });\n i++;\n }\n nodes.push({ type: \"orderedList\", content: items });\n continue;\n }\n\n if (line.trim() === \"\") {\n i++;\n continue;\n }\n\n const paraLines: string[] = [];\n while (i < lines.length && lines[i].trim() !== \"\" && !lines[i].match(/^#{1,4}\\s/) && !lines[i].match(/^```/) && !lines[i].match(/^---$/) && !lines[i].match(/^[-*]\\s/) && !lines[i].match(/^\\d+\\.\\s/) && !lines[i].match(/^>\\s/)) {\n paraLines.push(lines[i]);\n i++;\n }\n nodes.push({\n type: \"paragraph\",\n content: parseInline(paraLines.join(\"\\n\")),\n });\n }\n\n if (nodes.length === 0) {\n nodes.push({ type: \"paragraph\" });\n }\n\n return { type: \"doc\", content: nodes };\n}\n\nfunction parseInline(text: string): TiptapNode[] {\n if (!text) return [];\n\n const nodes: TiptapNode[] = [];\n const regex = /(\\*\\*(.+?)\\*\\*|\\*(.+?)\\*|`(.+?)`|~~(.+?)~~|\\[\\[(.+?)\\]\\]|#([a-zA-Z][a-zA-Z0-9_-]*))/g;\n let lastIndex = 0;\n let match: RegExpExecArray | null;\n\n while ((match = regex.exec(text)) !== null) {\n if (match.index > lastIndex) {\n nodes.push({ type: \"text\", text: text.slice(lastIndex, match.index) });\n }\n\n if (match[2]) {\n nodes.push({ type: \"text\", text: match[2], marks: [{ type: \"bold\" }] });\n } else if (match[3]) {\n nodes.push({ type: \"text\", text: match[3], marks: [{ type: \"italic\" }] });\n } else if (match[4]) {\n nodes.push({ type: \"text\", text: match[4], marks: [{ type: \"code\" }] });\n } else if (match[5]) {\n nodes.push({ type: \"text\", text: match[5], marks: [{ type: \"strike\" }] });\n } else if (match[6]) {\n nodes.push({ type: \"text\", text: `[[${match[6]}]]` });\n } else if (match[7]) {\n nodes.push({ type: \"text\", text: `#${match[7]}` });\n }\n\n lastIndex = match.index + match[0].length;\n }\n\n if (lastIndex < text.length) {\n nodes.push({ type: \"text\", text: text.slice(lastIndex) });\n }\n\n return nodes.length > 0 ? nodes : [{ type: \"text\", text: text || \" \" }];\n}\n"],"mappings":";AAQO,SAAS,iBAAiB,IAAqC;AACpE,QAAM,QAAQ,GAAG,MAAM,IAAI;AAC3B,QAAM,QAAsB,CAAC;AAC7B,MAAI,IAAI;AAER,SAAO,IAAI,MAAM,QAAQ;AACvB,UAAM,OAAO,MAAM,CAAC;AAEpB,QAAI,KAAK,MAAM,WAAW,GAAG;AAC3B,YAAM,QAAQ,KAAK,MAAM,kBAAkB;AAC3C,UAAI,OAAO;AACT,cAAM,KAAK;AAAA,UACT,MAAM;AAAA,UACN,OAAO,EAAE,OAAO,MAAM,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AAC,GAAG;AACZ,YAAM,KAAK,EAAE,MAAM,QAAQ,MAAM,MAAM,CAAC,GAAG,OAAO,CAAC,EAAE,MAAM,OAAO,CAAC,EAAE,CAAC;AAAA,IACxE,WAAW,MAAM,CAAC,GAAG;AACnB,YAAM,KAAK,EAAE,MAAM,QAAQ,MAAM,MAAM,CAAC,GAAG,OAAO,CAAC,EAAE,MAAM,SAAS,CAAC,EAAE,CAAC;AAAA,IAC1E,WAAW,MAAM,CAAC,GAAG;AACnB,YAAM,KAAK,EAAE,MAAM,QAAQ,MAAM,MAAM,CAAC,GAAG,OAAO,CAAC,EAAE,MAAM,OAAO,CAAC,EAAE,CAAC;AAAA,IACxE,WAAW,MAAM,CAAC,GAAG;AACnB,YAAM,KAAK,EAAE,MAAM,QAAQ,MAAM,MAAM,CAAC,GAAG,OAAO,CAAC,EAAE,MAAM,SAAS,CAAC,EAAE,CAAC;AAAA,IAC1E,WAAW,MAAM,CAAC,GAAG;AACnB,YAAM,KAAK,EAAE,MAAM,QAAQ,MAAM,KAAK,MAAM,CAAC,CAAC,KAAK,CAAC;AAAA,IACtD,WAAW,MAAM,CAAC,GAAG;AACnB,YAAM,KAAK,EAAE,MAAM,QAAQ,MAAM,IAAI,MAAM,CAAC,CAAC,GAAG,CAAC;AAAA,IACnD;AAEA,gBAAY,MAAM,QAAQ,MAAM,CAAC,EAAE;AAAA,EACrC;AAEA,MAAI,YAAY,KAAK,QAAQ;AAC3B,UAAM,KAAK,EAAE,MAAM,QAAQ,MAAM,KAAK,MAAM,SAAS,EAAE,CAAC;AAAA,EAC1D;AAEA,SAAO,MAAM,SAAS,IAAI,QAAQ,CAAC,EAAE,MAAM,QAAQ,MAAM,QAAQ,IAAI,CAAC;AACxE;","names":[]}
@@ -0,0 +1,42 @@
1
+ // src/lib/config.ts
2
+ import { readFileSync, writeFileSync, mkdirSync, existsSync } from "fs";
3
+ import { homedir } from "os";
4
+ import { join } from "path";
5
+ var CONFIG_DIR = join(homedir(), ".vertex");
6
+ var CONFIG_FILE = join(CONFIG_DIR, "config.json");
7
+ var DEFAULTS = {
8
+ supabaseUrl: "https://cywzmrkevzpjswplzfkc.supabase.co",
9
+ supabaseAnonKey: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImN5d3ptcmtldnpwanN3cGx6ZmtjIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzUyNTg0MzcsImV4cCI6MjA5MDgzNDQzN30.hKmzSHKuxvzJnhJCjctYCwvWXXdmpCukrNObasHCJG4"
10
+ };
11
+ function loadConfig() {
12
+ if (!existsSync(CONFIG_FILE)) return { ...DEFAULTS };
13
+ try {
14
+ const raw = readFileSync(CONFIG_FILE, "utf-8");
15
+ return { ...DEFAULTS, ...JSON.parse(raw) };
16
+ } catch {
17
+ return { ...DEFAULTS };
18
+ }
19
+ }
20
+ function saveConfig(config) {
21
+ mkdirSync(CONFIG_DIR, { recursive: true });
22
+ const existing = loadConfig();
23
+ const merged = { ...existing, ...config };
24
+ writeFileSync(CONFIG_FILE, JSON.stringify(merged, null, 2), "utf-8");
25
+ }
26
+ function clearConfig() {
27
+ if (existsSync(CONFIG_FILE)) {
28
+ writeFileSync(CONFIG_FILE, JSON.stringify(DEFAULTS, null, 2), "utf-8");
29
+ }
30
+ }
31
+ function isLoggedIn() {
32
+ const config = loadConfig();
33
+ return !!(config.accessToken && config.refreshToken);
34
+ }
35
+
36
+ export {
37
+ loadConfig,
38
+ saveConfig,
39
+ clearConfig,
40
+ isLoggedIn
41
+ };
42
+ //# sourceMappingURL=chunk-PBF5EE4Y.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/config.ts"],"sourcesContent":["import { readFileSync, writeFileSync, mkdirSync, existsSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\n\nconst CONFIG_DIR = join(homedir(), \".vertex\");\nconst CONFIG_FILE = join(CONFIG_DIR, \"config.json\");\n\nexport interface VertexConfig {\n supabaseUrl: string;\n supabaseAnonKey: string;\n accessToken?: string;\n refreshToken?: string;\n userId?: string;\n email?: string;\n}\n\nconst DEFAULTS: Pick<VertexConfig, \"supabaseUrl\" | \"supabaseAnonKey\"> = {\n supabaseUrl: \"https://cywzmrkevzpjswplzfkc.supabase.co\",\n supabaseAnonKey: \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImN5d3ptcmtldnpwanN3cGx6ZmtjIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzUyNTg0MzcsImV4cCI6MjA5MDgzNDQzN30.hKmzSHKuxvzJnhJCjctYCwvWXXdmpCukrNObasHCJG4\",\n};\n\nexport function loadConfig(): VertexConfig {\n if (!existsSync(CONFIG_FILE)) return { ...DEFAULTS };\n try {\n const raw = readFileSync(CONFIG_FILE, \"utf-8\");\n return { ...DEFAULTS, ...JSON.parse(raw) };\n } catch {\n return { ...DEFAULTS };\n }\n}\n\nexport function saveConfig(config: Partial<VertexConfig>): void {\n mkdirSync(CONFIG_DIR, { recursive: true });\n const existing = loadConfig();\n const merged = { ...existing, ...config };\n writeFileSync(CONFIG_FILE, JSON.stringify(merged, null, 2), \"utf-8\");\n}\n\nexport function clearConfig(): void {\n if (existsSync(CONFIG_FILE)) {\n writeFileSync(CONFIG_FILE, JSON.stringify(DEFAULTS, null, 2), \"utf-8\");\n }\n}\n\nexport function isLoggedIn(): boolean {\n const config = loadConfig();\n return !!(config.accessToken && config.refreshToken);\n}\n"],"mappings":";AAAA,SAAS,cAAc,eAAe,WAAW,kBAAkB;AACnE,SAAS,eAAe;AACxB,SAAS,YAAY;AAErB,IAAM,aAAa,KAAK,QAAQ,GAAG,SAAS;AAC5C,IAAM,cAAc,KAAK,YAAY,aAAa;AAWlD,IAAM,WAAkE;AAAA,EACtE,aAAa;AAAA,EACb,iBAAiB;AACnB;AAEO,SAAS,aAA2B;AACzC,MAAI,CAAC,WAAW,WAAW,EAAG,QAAO,EAAE,GAAG,SAAS;AACnD,MAAI;AACF,UAAM,MAAM,aAAa,aAAa,OAAO;AAC7C,WAAO,EAAE,GAAG,UAAU,GAAG,KAAK,MAAM,GAAG,EAAE;AAAA,EAC3C,QAAQ;AACN,WAAO,EAAE,GAAG,SAAS;AAAA,EACvB;AACF;AAEO,SAAS,WAAW,QAAqC;AAC9D,YAAU,YAAY,EAAE,WAAW,KAAK,CAAC;AACzC,QAAM,WAAW,WAAW;AAC5B,QAAM,SAAS,EAAE,GAAG,UAAU,GAAG,OAAO;AACxC,gBAAc,aAAa,KAAK,UAAU,QAAQ,MAAM,CAAC,GAAG,OAAO;AACrE;AAEO,SAAS,cAAoB;AAClC,MAAI,WAAW,WAAW,GAAG;AAC3B,kBAAc,aAAa,KAAK,UAAU,UAAU,MAAM,CAAC,GAAG,OAAO;AAAA,EACvE;AACF;AAEO,SAAS,aAAsB;AACpC,QAAM,SAAS,WAAW;AAC1B,SAAO,CAAC,EAAE,OAAO,eAAe,OAAO;AACzC;","names":[]}
@@ -0,0 +1,44 @@
1
+ import {
2
+ getClient,
3
+ getUserId
4
+ } from "../chunk-DDFOKGIX.js";
5
+ import "../chunk-PBF5EE4Y.js";
6
+ import {
7
+ getBlocksForNote,
8
+ listNotes,
9
+ saveNoteContent
10
+ } from "../chunk-4QLCD6TZ.js";
11
+
12
+ // src/commands/capture.ts
13
+ import { Command, Args } from "@oclif/core";
14
+ var Capture = class _Capture extends Command {
15
+ static description = "Quick capture text to Inbox";
16
+ static args = {
17
+ text: Args.string({ description: "Text to capture", required: true })
18
+ };
19
+ async run() {
20
+ const { args } = await this.parse(_Capture);
21
+ const client = await getClient();
22
+ const userId = await getUserId();
23
+ const notes = await listNotes(client, { user_id: userId });
24
+ const inbox = notes.find((n) => n.note_type === "inbox" && !n.deleted_at);
25
+ if (!inbox) {
26
+ this.error("Inbox note not found");
27
+ }
28
+ const blocks = await getBlocksForNote(client, inbox.id);
29
+ const existingContent = blocks.map((b) => {
30
+ const meta = b.metadata;
31
+ return meta.tiptap ?? { type: "paragraph", content: [{ type: "text", text: b.content }] };
32
+ });
33
+ existingContent.push({
34
+ type: "paragraph",
35
+ content: [{ type: "text", text: args.text }]
36
+ });
37
+ await saveNoteContent(client, inbox.id, userId, { type: "doc", content: existingContent });
38
+ this.log(`Captured to Inbox: "${args.text}"`);
39
+ }
40
+ };
41
+ export {
42
+ Capture as default
43
+ };
44
+ //# sourceMappingURL=capture.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/commands/capture.ts"],"sourcesContent":["import { Command, Args } from \"@oclif/core\";\nimport { listNotes, getBlocksForNote, saveNoteContent } from \"@vertex/core\";\nimport { getClient, getUserId } from \"../lib/client.js\";\n\nexport default class Capture extends Command {\n static override description = \"Quick capture text to Inbox\";\n\n static override args = {\n text: Args.string({ description: \"Text to capture\", required: true }),\n };\n\n async run(): Promise<void> {\n const { args } = await this.parse(Capture);\n const client = await getClient();\n const userId = await getUserId();\n const notes = await listNotes(client, { user_id: userId });\n const inbox = notes.find((n) => n.note_type === \"inbox\" && !n.deleted_at);\n\n if (!inbox) {\n this.error(\"Inbox note not found\");\n }\n\n const blocks = await getBlocksForNote(client, inbox.id);\n const existingContent = blocks.map((b) => {\n const meta = b.metadata as Record<string, unknown>;\n return (meta.tiptap ?? { type: \"paragraph\", content: [{ type: \"text\", text: b.content }] }) as Record<string, unknown>;\n });\n\n existingContent.push({\n type: \"paragraph\",\n content: [{ type: \"text\", text: args.text }],\n });\n\n await saveNoteContent(client, inbox.id, userId, { type: \"doc\", content: existingContent });\n this.log(`Captured to Inbox: \"${args.text}\"`);\n }\n}\n"],"mappings":";;;;;;;;;;;;AAAA,SAAS,SAAS,YAAY;AAI9B,IAAqB,UAArB,MAAqB,iBAAgB,QAAQ;AAAA,EAC3C,OAAgB,cAAc;AAAA,EAE9B,OAAgB,OAAO;AAAA,IACrB,MAAM,KAAK,OAAO,EAAE,aAAa,mBAAmB,UAAU,KAAK,CAAC;AAAA,EACtE;AAAA,EAEA,MAAM,MAAqB;AACzB,UAAM,EAAE,KAAK,IAAI,MAAM,KAAK,MAAM,QAAO;AACzC,UAAM,SAAS,MAAM,UAAU;AAC/B,UAAM,SAAS,MAAM,UAAU;AAC/B,UAAM,QAAQ,MAAM,UAAU,QAAQ,EAAE,SAAS,OAAO,CAAC;AACzD,UAAM,QAAQ,MAAM,KAAK,CAAC,MAAM,EAAE,cAAc,WAAW,CAAC,EAAE,UAAU;AAExE,QAAI,CAAC,OAAO;AACV,WAAK,MAAM,sBAAsB;AAAA,IACnC;AAEA,UAAM,SAAS,MAAM,iBAAiB,QAAQ,MAAM,EAAE;AACtD,UAAM,kBAAkB,OAAO,IAAI,CAAC,MAAM;AACxC,YAAM,OAAO,EAAE;AACf,aAAQ,KAAK,UAAU,EAAE,MAAM,aAAa,SAAS,CAAC,EAAE,MAAM,QAAQ,MAAM,EAAE,QAAQ,CAAC,EAAE;AAAA,IAC3F,CAAC;AAED,oBAAgB,KAAK;AAAA,MACnB,MAAM;AAAA,MACN,SAAS,CAAC,EAAE,MAAM,QAAQ,MAAM,KAAK,KAAK,CAAC;AAAA,IAC7C,CAAC;AAED,UAAM,gBAAgB,QAAQ,MAAM,IAAI,QAAQ,EAAE,MAAM,OAAO,SAAS,gBAAgB,CAAC;AACzF,SAAK,IAAI,uBAAuB,KAAK,IAAI,GAAG;AAAA,EAC9C;AACF;","names":[]}
@@ -0,0 +1,53 @@
1
+ import {
2
+ getClient,
3
+ getUserId
4
+ } from "../chunk-DDFOKGIX.js";
5
+ import "../chunk-PBF5EE4Y.js";
6
+ import {
7
+ exportNoteAsMarkdown,
8
+ getOrCreateDailyNote,
9
+ listNotes
10
+ } from "../chunk-4QLCD6TZ.js";
11
+
12
+ // src/commands/daily.ts
13
+ import { Command, Flags } from "@oclif/core";
14
+ var Daily = class _Daily extends Command {
15
+ static description = "View or create today's daily note";
16
+ static flags = {
17
+ last: Flags.boolean({ description: "Open the most recent daily note (don't create new)", default: false })
18
+ };
19
+ async run() {
20
+ const { flags } = await this.parse(_Daily);
21
+ const client = await getClient();
22
+ const userId = await getUserId();
23
+ let noteId;
24
+ let title;
25
+ if (flags.last) {
26
+ const notes = await listNotes(client, { user_id: userId, note_type: "daily" });
27
+ const dailies = notes.filter((n) => !n.deleted_at).sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime());
28
+ if (dailies.length === 0) {
29
+ this.log("No daily notes yet.");
30
+ return;
31
+ }
32
+ noteId = dailies[0].id;
33
+ title = dailies[0].title;
34
+ } else {
35
+ const today = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
36
+ const note = await getOrCreateDailyNote(client, userId, today);
37
+ noteId = note.id;
38
+ title = note.title;
39
+ }
40
+ const md = await exportNoteAsMarkdown(client, noteId);
41
+ if (md.trim()) {
42
+ this.log(md);
43
+ } else {
44
+ this.log(`# ${title}
45
+
46
+ (empty)`);
47
+ }
48
+ }
49
+ };
50
+ export {
51
+ Daily as default
52
+ };
53
+ //# sourceMappingURL=daily.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/commands/daily.ts"],"sourcesContent":["import { Command, Flags } from \"@oclif/core\";\nimport { getOrCreateDailyNote, listNotes, exportNoteAsMarkdown } from \"@vertex/core\";\nimport { getClient, getUserId } from \"../lib/client.js\";\n\nexport default class Daily extends Command {\n static override description = \"View or create today's daily note\";\n\n static override flags = {\n last: Flags.boolean({ description: \"Open the most recent daily note (don't create new)\", default: false }),\n };\n\n async run(): Promise<void> {\n const { flags } = await this.parse(Daily);\n const client = await getClient();\n const userId = await getUserId();\n\n let noteId: string;\n let title: string;\n\n if (flags.last) {\n const notes = await listNotes(client, { user_id: userId, note_type: \"daily\" as \"daily\" });\n const dailies = notes.filter((n) => !n.deleted_at).sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime());\n if (dailies.length === 0) {\n this.log(\"No daily notes yet.\");\n return;\n }\n noteId = dailies[0].id;\n title = dailies[0].title;\n } else {\n const today = new Date().toISOString().split(\"T\")[0];\n const note = await getOrCreateDailyNote(client, userId, today);\n noteId = note.id;\n title = note.title;\n }\n\n const md = await exportNoteAsMarkdown(client, noteId);\n if (md.trim()) {\n this.log(md);\n } else {\n this.log(`# ${title}\\n\\n(empty)`);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;AAAA,SAAS,SAAS,aAAa;AAI/B,IAAqB,QAArB,MAAqB,eAAc,QAAQ;AAAA,EACzC,OAAgB,cAAc;AAAA,EAE9B,OAAgB,QAAQ;AAAA,IACtB,MAAM,MAAM,QAAQ,EAAE,aAAa,sDAAsD,SAAS,MAAM,CAAC;AAAA,EAC3G;AAAA,EAEA,MAAM,MAAqB;AACzB,UAAM,EAAE,MAAM,IAAI,MAAM,KAAK,MAAM,MAAK;AACxC,UAAM,SAAS,MAAM,UAAU;AAC/B,UAAM,SAAS,MAAM,UAAU;AAE/B,QAAI;AACJ,QAAI;AAEJ,QAAI,MAAM,MAAM;AACd,YAAM,QAAQ,MAAM,UAAU,QAAQ,EAAE,SAAS,QAAQ,WAAW,QAAmB,CAAC;AACxF,YAAM,UAAU,MAAM,OAAO,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,GAAG,MAAM,IAAI,KAAK,EAAE,UAAU,EAAE,QAAQ,IAAI,IAAI,KAAK,EAAE,UAAU,EAAE,QAAQ,CAAC;AACrI,UAAI,QAAQ,WAAW,GAAG;AACxB,aAAK,IAAI,qBAAqB;AAC9B;AAAA,MACF;AACA,eAAS,QAAQ,CAAC,EAAE;AACpB,cAAQ,QAAQ,CAAC,EAAE;AAAA,IACrB,OAAO;AACL,YAAM,SAAQ,oBAAI,KAAK,GAAE,YAAY,EAAE,MAAM,GAAG,EAAE,CAAC;AACnD,YAAM,OAAO,MAAM,qBAAqB,QAAQ,QAAQ,KAAK;AAC7D,eAAS,KAAK;AACd,cAAQ,KAAK;AAAA,IACf;AAEA,UAAM,KAAK,MAAM,qBAAqB,QAAQ,MAAM;AACpD,QAAI,GAAG,KAAK,GAAG;AACb,WAAK,IAAI,EAAE;AAAA,IACb,OAAO;AACL,WAAK,IAAI,KAAK,KAAK;AAAA;AAAA,QAAa;AAAA,IAClC;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1,38 @@
1
+ import {
2
+ getClient,
3
+ getUserId
4
+ } from "../chunk-DDFOKGIX.js";
5
+ import "../chunk-PBF5EE4Y.js";
6
+ import {
7
+ listNotes,
8
+ softDeleteNote
9
+ } from "../chunk-4QLCD6TZ.js";
10
+
11
+ // src/commands/delete.ts
12
+ import { Command, Args } from "@oclif/core";
13
+ var Delete = class _Delete extends Command {
14
+ static description = "Move a note to trash";
15
+ static args = {
16
+ title: Args.string({ description: "Note title (partial match)", required: true })
17
+ };
18
+ async run() {
19
+ const { args } = await this.parse(_Delete);
20
+ const client = await getClient();
21
+ const userId = await getUserId();
22
+ const notes = await listNotes(client, { user_id: userId });
23
+ const query = args.title.toLowerCase();
24
+ const match = notes.find((n) => !n.deleted_at && n.title.toLowerCase().includes(query));
25
+ if (!match) {
26
+ this.error(`No note matching "${args.title}"`);
27
+ }
28
+ if (match.note_type === "inbox") {
29
+ this.error("Cannot delete the Inbox note");
30
+ }
31
+ await softDeleteNote(client, match.id);
32
+ this.log(`Trashed: ${match.title}`);
33
+ }
34
+ };
35
+ export {
36
+ Delete as default
37
+ };
38
+ //# sourceMappingURL=delete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/commands/delete.ts"],"sourcesContent":["import { Command, Args } from \"@oclif/core\";\nimport { listNotes, softDeleteNote } from \"@vertex/core\";\nimport { getClient, getUserId } from \"../lib/client.js\";\n\nexport default class Delete extends Command {\n static override description = \"Move a note to trash\";\n\n static override args = {\n title: Args.string({ description: \"Note title (partial match)\", required: true }),\n };\n\n async run(): Promise<void> {\n const { args } = await this.parse(Delete);\n const client = await getClient();\n const userId = await getUserId();\n const notes = await listNotes(client, { user_id: userId });\n const query = args.title.toLowerCase();\n const match = notes.find((n) => !n.deleted_at && n.title.toLowerCase().includes(query));\n\n if (!match) {\n this.error(`No note matching \"${args.title}\"`);\n }\n\n if (match.note_type === \"inbox\") {\n this.error(\"Cannot delete the Inbox note\");\n }\n\n await softDeleteNote(client, match.id);\n this.log(`Trashed: ${match.title}`);\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA,SAAS,SAAS,YAAY;AAI9B,IAAqB,SAArB,MAAqB,gBAAe,QAAQ;AAAA,EAC1C,OAAgB,cAAc;AAAA,EAE9B,OAAgB,OAAO;AAAA,IACrB,OAAO,KAAK,OAAO,EAAE,aAAa,8BAA8B,UAAU,KAAK,CAAC;AAAA,EAClF;AAAA,EAEA,MAAM,MAAqB;AACzB,UAAM,EAAE,KAAK,IAAI,MAAM,KAAK,MAAM,OAAM;AACxC,UAAM,SAAS,MAAM,UAAU;AAC/B,UAAM,SAAS,MAAM,UAAU;AAC/B,UAAM,QAAQ,MAAM,UAAU,QAAQ,EAAE,SAAS,OAAO,CAAC;AACzD,UAAM,QAAQ,KAAK,MAAM,YAAY;AACrC,UAAM,QAAQ,MAAM,KAAK,CAAC,MAAM,CAAC,EAAE,cAAc,EAAE,MAAM,YAAY,EAAE,SAAS,KAAK,CAAC;AAEtF,QAAI,CAAC,OAAO;AACV,WAAK,MAAM,qBAAqB,KAAK,KAAK,GAAG;AAAA,IAC/C;AAEA,QAAI,MAAM,cAAc,SAAS;AAC/B,WAAK,MAAM,8BAA8B;AAAA,IAC3C;AAEA,UAAM,eAAe,QAAQ,MAAM,EAAE;AACrC,SAAK,IAAI,YAAY,MAAM,KAAK,EAAE;AAAA,EACpC;AACF;","names":[]}
@@ -0,0 +1,88 @@
1
+ import {
2
+ markdownToTiptap
3
+ } from "../chunk-FWK2J3FR.js";
4
+ import {
5
+ getClient,
6
+ getUserId
7
+ } from "../chunk-DDFOKGIX.js";
8
+ import "../chunk-PBF5EE4Y.js";
9
+ import {
10
+ exportNoteAsMarkdown,
11
+ listNotes,
12
+ saveNoteContent
13
+ } from "../chunk-4QLCD6TZ.js";
14
+
15
+ // src/commands/edit.ts
16
+ import { Command, Args } from "@oclif/core";
17
+ import { tmpdir } from "os";
18
+ import { join } from "path";
19
+ import { writeFileSync, readFileSync } from "fs";
20
+ import { execSync } from "child_process";
21
+ import { createInterface } from "readline";
22
+ var SYNTAX_GUIDE = `
23
+ Markdown Syntax Guide
24
+ \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
25
+
26
+ Headings: # H1 ## H2 ### H3
27
+ Formatting: **bold** *italic* \`code\` ~~strike~~
28
+ Links: [[Wiki Link]] #tagname
29
+
30
+ Lists: - bullet 1. numbered
31
+ Tasks: - [x] done - [ ] open
32
+ Other: > blockquote --- divider
33
+
34
+ Code block: \`\`\`python Math block: $$
35
+ print("hi") E = mc^2
36
+ \`\`\` $$
37
+
38
+ Web app only: mermaid, callouts, query blocks, file uploads
39
+ `;
40
+ var Edit = class _Edit extends Command {
41
+ static description = "Edit a note in your $EDITOR";
42
+ static args = {
43
+ title: Args.string({ description: "Note title (partial match)", required: true })
44
+ };
45
+ async run() {
46
+ const { args } = await this.parse(_Edit);
47
+ const client = await getClient();
48
+ const userId = await getUserId();
49
+ const notes = await listNotes(client, { user_id: userId });
50
+ const query = args.title.toLowerCase();
51
+ const match = notes.find((n) => !n.deleted_at && n.title.toLowerCase().includes(query));
52
+ if (!match) {
53
+ this.error(`No note matching "${args.title}"`);
54
+ }
55
+ const editor = process.env.EDITOR || process.env.VISUAL || "vim";
56
+ this.log(`
57
+ Editing: ${match.title}`);
58
+ this.log(` Editor: ${editor}`);
59
+ this.log(SYNTAX_GUIDE);
60
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
61
+ await new Promise((resolve) => {
62
+ rl.question(" Press Enter to open editor...", () => {
63
+ rl.close();
64
+ resolve();
65
+ });
66
+ });
67
+ const md = await exportNoteAsMarkdown(client, match.id);
68
+ const tmpFile = join(tmpdir(), `vertex-${match.id}.md`);
69
+ writeFileSync(tmpFile, md, "utf-8");
70
+ try {
71
+ execSync(`${editor} "${tmpFile}"`, { stdio: "inherit" });
72
+ } catch {
73
+ this.error("Editor exited with error");
74
+ }
75
+ const edited = readFileSync(tmpFile, "utf-8");
76
+ if (edited === md) {
77
+ this.log("No changes.");
78
+ return;
79
+ }
80
+ const tiptapJson = markdownToTiptap(edited);
81
+ await saveNoteContent(client, match.id, userId, tiptapJson);
82
+ this.log(`Saved: ${match.title}`);
83
+ }
84
+ };
85
+ export {
86
+ Edit as default
87
+ };
88
+ //# sourceMappingURL=edit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/commands/edit.ts"],"sourcesContent":["import { Command, Args } from \"@oclif/core\";\nimport { tmpdir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { writeFileSync, readFileSync } from \"node:fs\";\nimport { execSync } from \"node:child_process\";\nimport { createInterface } from \"node:readline\";\nimport { listNotes, exportNoteAsMarkdown, saveNoteContent } from \"@vertex/core\";\nimport { getClient, getUserId } from \"../lib/client.js\";\nimport { markdownToTiptap } from \"../lib/md-to-tiptap.js\";\n\nconst SYNTAX_GUIDE = `\n Markdown Syntax Guide\n ─────────────────────\n\n Headings: # H1 ## H2 ### H3\n Formatting: **bold** *italic* \\`code\\` ~~strike~~\n Links: [[Wiki Link]] #tagname\n\n Lists: - bullet 1. numbered\n Tasks: - [x] done - [ ] open\n Other: > blockquote --- divider\n\n Code block: \\`\\`\\`python Math block: $$\n print(\"hi\") E = mc^2\n \\`\\`\\` $$\n\n Web app only: mermaid, callouts, query blocks, file uploads\n`;\n\nexport default class Edit extends Command {\n static override description = \"Edit a note in your $EDITOR\";\n\n static override args = {\n title: Args.string({ description: \"Note title (partial match)\", required: true }),\n };\n\n async run(): Promise<void> {\n const { args } = await this.parse(Edit);\n const client = await getClient();\n const userId = await getUserId();\n const notes = await listNotes(client, { user_id: userId });\n const query = args.title.toLowerCase();\n const match = notes.find((n) => !n.deleted_at && n.title.toLowerCase().includes(query));\n\n if (!match) {\n this.error(`No note matching \"${args.title}\"`);\n }\n\n const editor = process.env.EDITOR || process.env.VISUAL || \"vim\";\n\n this.log(`\\n Editing: ${match.title}`);\n this.log(` Editor: ${editor}`);\n this.log(SYNTAX_GUIDE);\n\n const rl = createInterface({ input: process.stdin, output: process.stdout });\n await new Promise<void>((resolve) => {\n rl.question(\" Press Enter to open editor...\", () => { rl.close(); resolve(); });\n });\n\n const md = await exportNoteAsMarkdown(client, match.id);\n const tmpFile = join(tmpdir(), `vertex-${match.id}.md`);\n writeFileSync(tmpFile, md, \"utf-8\");\n\n try {\n execSync(`${editor} \"${tmpFile}\"`, { stdio: \"inherit\" });\n } catch {\n this.error(\"Editor exited with error\");\n }\n\n const edited = readFileSync(tmpFile, \"utf-8\");\n if (edited === md) {\n this.log(\"No changes.\");\n return;\n }\n\n const tiptapJson = markdownToTiptap(edited);\n await saveNoteContent(client, match.id, userId, tiptapJson);\n this.log(`Saved: ${match.title}`);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA,SAAS,SAAS,YAAY;AAC9B,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,eAAe,oBAAoB;AAC5C,SAAS,gBAAgB;AACzB,SAAS,uBAAuB;AAKhC,IAAM,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAmBrB,IAAqB,OAArB,MAAqB,cAAa,QAAQ;AAAA,EACxC,OAAgB,cAAc;AAAA,EAE9B,OAAgB,OAAO;AAAA,IACrB,OAAO,KAAK,OAAO,EAAE,aAAa,8BAA8B,UAAU,KAAK,CAAC;AAAA,EAClF;AAAA,EAEA,MAAM,MAAqB;AACzB,UAAM,EAAE,KAAK,IAAI,MAAM,KAAK,MAAM,KAAI;AACtC,UAAM,SAAS,MAAM,UAAU;AAC/B,UAAM,SAAS,M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@
1
+ import {
2
+ getClient,
3
+ getUserId
4
+ } from "../chunk-DDFOKGIX.js";
5
+ import "../chunk-PBF5EE4Y.js";
6
+ import {
7
+ exportNoteAsJson,
8
+ exportNoteAsMarkdown,
9
+ listNotes
10
+ } from "../chunk-4QLCD6TZ.js";
11
+
12
+ // src/commands/export.ts
13
+ import { Command, Args, Flags } from "@oclif/core";
14
+ import { writeFileSync } from "fs";
15
+ var Export = class _Export extends Command {
16
+ static description = "Export a note as markdown or JSON";
17
+ static args = {
18
+ title: Args.string({ description: "Note title (partial match)", required: true })
19
+ };
20
+ static flags = {
21
+ json: Flags.boolean({ description: "Export as JSON instead of markdown", default: false }),
22
+ out: Flags.string({ char: "o", description: "Output file path (default: stdout)" })
23
+ };
24
+ async run() {
25
+ const { args, flags } = await this.parse(_Export);
26
+ const client = await getClient();
27
+ const userId = await getUserId();
28
+ const notes = await listNotes(client, { user_id: userId });
29
+ const query = args.title.toLowerCase();
30
+ const match = notes.find((n) => !n.deleted_at && n.title.toLowerCase().includes(query));
31
+ if (!match) {
32
+ this.error(`No note matching "${args.title}"`);
33
+ }
34
+ const content = flags.json ? await exportNoteAsJson(client, match.id) : await exportNoteAsMarkdown(client, match.id);
35
+ if (flags.out) {
36
+ writeFileSync(flags.out, content, "utf-8");
37
+ this.log(`Exported to ${flags.out}`);
38
+ } else {
39
+ this.log(content);
40
+ }
41
+ }
42
+ };
43
+ export {
44
+ Export as default
45
+ };
46
+ //# sourceMappingURL=export.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/commands/export.ts"],"sourcesContent":["import { Command, Args, Flags } from \"@oclif/core\";\nimport { writeFileSync } from \"node:fs\";\nimport { listNotes, exportNoteAsMarkdown, exportNoteAsJson } from \"@vertex/core\";\nimport { getClient, getUserId } from \"../lib/client.js\";\n\nexport default class Export extends Command {\n static override description = \"Export a note as markdown or JSON\";\n\n static override args = {\n title: Args.string({ description: \"Note title (partial match)\", required: true }),\n };\n\n static override flags = {\n json: Flags.boolean({ description: \"Export as JSON instead of markdown\", default: false }),\n out: Flags.string({ char: \"o\", description: \"Output file path (default: stdout)\" }),\n };\n\n async run(): Promise<void> {\n const { args, flags } = await this.parse(Export);\n const client = await getClient();\n const userId = await getUserId();\n const notes = await listNotes(client, { user_id: userId });\n const query = args.title.toLowerCase();\n const match = notes.find((n) => !n.deleted_at && n.title.toLowerCase().includes(query));\n\n if (!match) {\n this.error(`No note matching \"${args.title}\"`);\n }\n\n const content = flags.json\n ? await exportNoteAsJson(client, match.id)\n : await exportNoteAsMarkdown(client, match.id);\n\n if (flags.out) {\n writeFileSync(flags.out, content, \"utf-8\");\n this.log(`Exported to ${flags.out}`);\n } else {\n this.log(content);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;AAAA,SAAS,SAAS,MAAM,aAAa;AACrC,SAAS,qBAAqB;AAI9B,IAAqB,SAArB,MAAqB,gBAAe,QAAQ;AAAA,EAC1C,OAAgB,cAAc;AAAA,EAE9B,OAAgB,OAAO;AAAA,IACrB,OAAO,KAAK,OAAO,EAAE,aAAa,8BAA8B,UAAU,KAAK,CAAC;AAAA,EAClF;AAAA,EAEA,OAAgB,QAAQ;AAAA,IACtB,MAAM,MAAM,QAAQ,EAAE,aAAa,sCAAsC,SAAS,MAAM,CAAC;AAAA,IACzF,KAAK,MAAM,OAAO,EAAE,MAAM,KAAK,aAAa,qCAAqC,CAAC;AAAA,EACpF;AAAA,EAEA,MAAM,MAAqB;AACzB,UAAM,EAAE,MAAM,MAAM,IAAI,MAAM,KAAK,MAAM,OAAM;AAC/C,UAAM,SAAS,MAAM,UAAU;AAC/B,UAAM,SAAS,MAAM,UAAU;AAC/B,UAAM,QAAQ,MAAM,UAAU,QAAQ,EAAE,SAAS,OAAO,CAAC;AACzD,UAAM,QAAQ,KAAK,MAAM,YAAY;AACrC,UAAM,QAAQ,MAAM,KAAK,CAAC,MAAM,CAAC,EAAE,cAAc,EAAE,MAAM,YAAY,EAAE,SAAS,KAAK,CAAC;AAEtF,QAAI,CAAC,OAAO;AACV,WAAK,MAAM,qBAAqB,KAAK,KAAK,GAAG;AAAA,IAC/C;AAEA,UAAM,UAAU,MAAM,OAClB,MAAM,iBAAiB,QAAQ,MAAM,EAAE,IACvC,MAAM,qBAAqB,QAAQ,MAAM,EAAE;AAE/C,QAAI,MAAM,KAAK;AACb,oBAAc,MAAM,KAAK,SAAS,OAAO;AACzC,WAAK,IAAI,eAAe,MAAM,GAAG,EAAE;AAAA,IACrC,OAAO;AACL,WAAK,IAAI,OAAO;AAAA,IAClB;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1,16 @@
1
+ import {
2
+ VERTEX_VERSION
3
+ } from "../chunk-4QLCD6TZ.js";
4
+
5
+ // src/commands/hello.ts
6
+ import { Command } from "@oclif/core";
7
+ var Hello = class extends Command {
8
+ static description = "Verify Vertex CLI is working";
9
+ async run() {
10
+ this.log(`Vertex CLI ready (v${VERTEX_VERSION})`);
11
+ }
12
+ };
13
+ export {
14
+ Hello as default
15
+ };
16
+ //# sourceMappingURL=hello.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/commands/hello.ts"],"sourcesContent":["import { Command } from \"@oclif/core\";\nimport { VERTEX_VERSION } from \"@vertex/core\";\n\nexport default class Hello extends Command {\n static override description = \"Verify Vertex CLI is working\";\n\n async run(): Promise<void> {\n this.log(`Vertex CLI ready (v${VERTEX_VERSION})`);\n }\n}\n"],"mappings":";;;;;AAAA,SAAS,eAAe;AAGxB,IAAqB,QAArB,cAAmC,QAAQ;AAAA,EACzC,OAAgB,cAAc;AAAA,EAE9B,MAAM,MAAqB;AACzB,SAAK,IAAI,sBAAsB,cAAc,GAAG;AAAA,EAClD;AACF;","names":[]}