ente-cli 0.1.0 → 0.4.53

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/package.json CHANGED
@@ -1,32 +1,45 @@
1
1
  {
2
2
  "name": "ente-cli",
3
- "version": "0.1.0",
4
- "description": "CLI for ente — relationship manager and knowledge graph",
3
+ "version": "0.4.53",
4
+ "description": "CLI for ente — relationship manager and knowledge graph (Convex backend).",
5
5
  "type": "module",
6
6
  "bin": {
7
- "ente": "dist/index.js"
7
+ "ente": "dist/cli.mjs"
8
8
  },
9
9
  "files": [
10
- "dist/**/*.js",
11
- "dist/**/*.d.ts"
10
+ "dist",
11
+ "README.md"
12
12
  ],
13
13
  "scripts": {
14
- "build": "tsc",
15
- "dev": "tsc --watch",
16
- "prepublishOnly": "npm run build"
14
+ "dev": "node --import tsx cli.ts",
15
+ "build": "node build.mjs",
16
+ "typecheck": "tsc -p tsconfig.json --noEmit",
17
+ "test": "node --import tsx --test tests/*.test.ts tests/release.test.mjs",
18
+ "test:package": "pnpm build && node --test tests/package.test.mjs"
17
19
  },
18
- "keywords": ["ente", "crm", "knowledge-graph", "cli"],
19
- "license": "MIT",
20
20
  "repository": {
21
21
  "type": "git",
22
- "url": "https://github.com/valentindoering/ente.git",
22
+ "url": "git+https://github.com/valentindoering/ente.git",
23
23
  "directory": "cli"
24
24
  },
25
- "dependencies": {
26
- "commander": "^13.1.0"
25
+ "engines": {
26
+ "node": ">=22"
27
+ },
28
+ "publishConfig": {
29
+ "access": "public"
27
30
  },
28
31
  "devDependencies": {
29
- "@types/node": "^22.10.2",
30
- "typescript": "^5.7.2"
32
+ "@types/node": "^22.10.0",
33
+ "clipanion": "4.0.0-rc.4",
34
+ "convex": "^1.46.0",
35
+ "esbuild": "0.27.0",
36
+ "smol-toml": "^1.7.1",
37
+ "tsx": "^4.21.0",
38
+ "typescript": "^6.0.3"
39
+ },
40
+ "pnpm": {
41
+ "onlyBuiltDependencies": [
42
+ "esbuild"
43
+ ]
31
44
  }
32
45
  }
package/dist/api.d.ts DELETED
@@ -1,221 +0,0 @@
1
- /**
2
- * Typed HTTP client for the ente external API.
3
- */
4
- export interface EnteConfig {
5
- baseUrl: string;
6
- apiKey: string;
7
- }
8
- export declare function getConfig(): EnteConfig;
9
- export interface OpenTaskSummary {
10
- shortId?: number;
11
- title?: string;
12
- activityId: string;
13
- }
14
- export interface EntityResult {
15
- entity: {
16
- _id: string;
17
- _creationTime: number;
18
- name: string;
19
- type: string;
20
- attributes?: Record<string, unknown>;
21
- tags?: string[];
22
- aliases?: string[];
23
- descriptionPlainText?: string;
24
- archived?: boolean;
25
- createdBy?: string;
26
- updatedAt?: number;
27
- };
28
- spaceIds: string[];
29
- openTasks: OpenTaskSummary[];
30
- descriptionPlainText?: string;
31
- activityCount?: number;
32
- lastActivityAt?: number;
33
- }
34
- export interface Pin {
35
- entityId: string;
36
- name: string;
37
- type: string;
38
- }
39
- export interface Activity {
40
- _id: string;
41
- _creationTime: number;
42
- type: string;
43
- title?: string;
44
- contentPlainText?: string;
45
- deadline?: number;
46
- completed?: boolean;
47
- shortId?: number;
48
- assigneeIds?: string[];
49
- attributes?: Record<string, unknown>;
50
- createdAt: number;
51
- spaceId: string;
52
- createdBy: string;
53
- updatedAt?: number;
54
- }
55
- export interface TaskResult {
56
- activity: Activity;
57
- entities: Array<{
58
- entityId: string;
59
- name: string;
60
- type: string;
61
- }>;
62
- }
63
- export interface UserInfo {
64
- name?: string;
65
- email?: string;
66
- }
67
- export interface SpaceInfo {
68
- spaceId: string;
69
- spaceName: string;
70
- memberEmails: string[];
71
- scope?: string;
72
- }
73
- export interface ApiError {
74
- error: {
75
- kind: string;
76
- message: string;
77
- [key: string]: unknown;
78
- };
79
- }
80
- export declare class EnteClient {
81
- private baseUrl;
82
- private apiKey;
83
- constructor(config: EnteConfig);
84
- private url;
85
- private request;
86
- searchEntities(q?: string, opts?: {
87
- limit?: number;
88
- spaceId?: string;
89
- }): Promise<{
90
- data: {
91
- entities: EntityResult[];
92
- spaces: Record<string, SpaceInfo>;
93
- openTasksPartial?: boolean;
94
- };
95
- }>;
96
- getEntity(id: string, opts?: {
97
- hoursBack?: number;
98
- limit?: number;
99
- }): Promise<{
100
- data: {
101
- entity: EntityResult["entity"];
102
- pins: Pin[];
103
- activities: Activity[];
104
- openTasks: OpenTaskSummary[];
105
- spaces: Array<{
106
- spaceId: string;
107
- spaceName: string;
108
- }>;
109
- descriptionPlainText?: string;
110
- };
111
- }>;
112
- createEntity(body: {
113
- name: string;
114
- type?: string;
115
- description?: string;
116
- tags?: string[];
117
- attributes?: Record<string, unknown>;
118
- aliases?: string[];
119
- }): Promise<{
120
- data: {
121
- entityId: string;
122
- };
123
- }>;
124
- updateEntity(id: string, body: {
125
- name?: string;
126
- tags?: string[];
127
- attributes?: Record<string, unknown>;
128
- description?: string;
129
- aliases?: string[];
130
- }): Promise<{
131
- data: {
132
- success: boolean;
133
- };
134
- }>;
135
- listPins(entityId: string): Promise<{
136
- data: Pin[];
137
- }>;
138
- addPin(sourceEntityId: string, targetEntityId: string): Promise<{
139
- data: {
140
- pinId: string | null;
141
- alreadyExists: boolean;
142
- };
143
- }>;
144
- removePin(sourceEntityId: string, targetEntityId: string): Promise<{
145
- data: {
146
- success: boolean;
147
- };
148
- }>;
149
- searchActivities(q: string, opts?: {
150
- entityId?: string;
151
- type?: string;
152
- limit?: number;
153
- }): Promise<{
154
- data: Activity[];
155
- }>;
156
- listActivities(opts?: {
157
- entityId?: string;
158
- limit?: number;
159
- hoursBack?: number;
160
- before?: number;
161
- after?: number;
162
- }): Promise<{
163
- data: Activity[];
164
- hasMore?: boolean;
165
- }>;
166
- createActivity(body: {
167
- entityIds: string[];
168
- type: string;
169
- title?: string;
170
- content?: string;
171
- deadline?: number;
172
- completed?: boolean;
173
- attributes?: Record<string, unknown>;
174
- assigneeIds?: string[];
175
- autoLinkPersonalSpace?: boolean;
176
- spaceId?: string;
177
- }): Promise<{
178
- data: {
179
- activityId: string;
180
- };
181
- }>;
182
- updateActivity(id: string, body: {
183
- title?: string;
184
- content?: string;
185
- completed?: boolean;
186
- deadline?: number | null;
187
- entityIds?: string[];
188
- type?: string;
189
- attributes?: Record<string, unknown>;
190
- assigneeIds?: string[];
191
- }): Promise<{
192
- data: {
193
- success: boolean;
194
- };
195
- }>;
196
- deleteActivity(id: string): Promise<{
197
- data: {
198
- success: boolean;
199
- };
200
- }>;
201
- listTasks(opts?: {
202
- entityId?: string;
203
- onlyOpen?: boolean;
204
- dueBy?: number;
205
- }): Promise<{
206
- data: TaskResult[];
207
- users: Record<string, UserInfo>;
208
- }>;
209
- getActivity(id: string): Promise<{
210
- data: Activity & {
211
- entityIds?: string[];
212
- };
213
- }>;
214
- getTaskByNumber(number: number, opts?: {
215
- spaceId?: string;
216
- }): Promise<{
217
- data: TaskResult;
218
- users: Record<string, UserInfo>;
219
- }>;
220
- listSpaces(): Promise<Record<string, SpaceInfo>>;
221
- }
package/dist/api.js DELETED
@@ -1,182 +0,0 @@
1
- /**
2
- * Typed HTTP client for the ente external API.
3
- */
4
- import { readStoredConfig } from "./commands/auth.js";
5
- export function getConfig() {
6
- // Priority: env vars > config file
7
- const envUrl = process.env.ENTE_API_URL;
8
- const envKey = process.env.ENTE_API_KEY;
9
- if (envUrl && envKey) {
10
- return { baseUrl: envUrl.replace(/\/+$/, ""), apiKey: envKey };
11
- }
12
- // Fall back to stored config (~/.config/ente/config.json)
13
- const stored = readStoredConfig();
14
- if (stored) {
15
- return { baseUrl: stored.url.replace(/\/+$/, ""), apiKey: stored.key };
16
- }
17
- console.error("Error: Not authenticated.\n\n" +
18
- "Either run:\n" +
19
- " ente auth login --url <url> --key <key>\n\n" +
20
- "Or set environment variables:\n" +
21
- " export ENTE_API_URL=https://your-deployment.convex.site\n" +
22
- " export ENTE_API_KEY=your-key-here");
23
- process.exit(1);
24
- }
25
- // ---------------------------------------------------------------------------
26
- // Client
27
- // ---------------------------------------------------------------------------
28
- export class EnteClient {
29
- baseUrl;
30
- apiKey;
31
- constructor(config) {
32
- // Strip trailing slash and /api/external suffix if user included it
33
- let base = config.baseUrl.replace(/\/+$/, "");
34
- if (base.endsWith("/api/external")) {
35
- base = base.slice(0, -"/api/external".length);
36
- }
37
- this.baseUrl = base;
38
- this.apiKey = config.apiKey;
39
- }
40
- url(path, params) {
41
- const u = new URL(`${this.baseUrl}/api/external${path}`);
42
- if (params) {
43
- for (const [k, v] of Object.entries(params)) {
44
- if (v !== undefined && v !== "")
45
- u.searchParams.set(k, v);
46
- }
47
- }
48
- return u.toString();
49
- }
50
- async request(method, path, opts) {
51
- const url = this.url(path, opts?.params);
52
- const headers = {
53
- Authorization: `Bearer ${this.apiKey}`,
54
- };
55
- if (opts?.body !== undefined) {
56
- headers["Content-Type"] = "application/json";
57
- }
58
- const res = await fetch(url, {
59
- method,
60
- headers,
61
- body: opts?.body !== undefined ? JSON.stringify(opts.body) : undefined,
62
- });
63
- if (!res.ok) {
64
- let errMsg = `HTTP ${res.status} ${res.statusText}`;
65
- try {
66
- const errBody = (await res.json());
67
- if (errBody.error?.message) {
68
- errMsg = errBody.error.message;
69
- }
70
- }
71
- catch {
72
- // ignore JSON parse failure
73
- }
74
- throw new Error(errMsg);
75
- }
76
- return (await res.json());
77
- }
78
- // -- Entities -------------------------------------------------------------
79
- async searchEntities(q, opts) {
80
- const params = {};
81
- if (q)
82
- params.q = q;
83
- if (opts?.limit)
84
- params.limit = String(opts.limit);
85
- if (opts?.spaceId)
86
- params.spaceId = opts.spaceId;
87
- return this.request("GET", "/entities", { params });
88
- }
89
- async getEntity(id, opts) {
90
- const params = { id };
91
- if (opts?.hoursBack)
92
- params.hoursBack = String(opts.hoursBack);
93
- if (opts?.limit)
94
- params.limit = String(opts.limit);
95
- return this.request("GET", "/entity", { params });
96
- }
97
- async createEntity(body) {
98
- return this.request("POST", "/entities", { body });
99
- }
100
- async updateEntity(id, body) {
101
- return this.request("PATCH", "/entities", {
102
- params: { id },
103
- body,
104
- });
105
- }
106
- // -- Pins -----------------------------------------------------------------
107
- async listPins(entityId) {
108
- return this.request("GET", "/pins", { params: { entityId } });
109
- }
110
- async addPin(sourceEntityId, targetEntityId) {
111
- return this.request("POST", "/pins", {
112
- body: { sourceEntityId, targetEntityId },
113
- });
114
- }
115
- async removePin(sourceEntityId, targetEntityId) {
116
- return this.request("DELETE", "/pins", {
117
- params: { sourceEntityId, targetEntityId },
118
- });
119
- }
120
- // -- Activities -----------------------------------------------------------
121
- async searchActivities(q, opts) {
122
- const params = { q };
123
- if (opts?.entityId)
124
- params.entityId = opts.entityId;
125
- if (opts?.type)
126
- params.type = opts.type;
127
- if (opts?.limit)
128
- params.limit = String(opts.limit);
129
- return this.request("GET", "/activities/search", { params });
130
- }
131
- async listActivities(opts) {
132
- const params = {};
133
- if (opts?.entityId)
134
- params.entityId = opts.entityId;
135
- if (opts?.limit)
136
- params.limit = String(opts.limit);
137
- if (opts?.hoursBack)
138
- params.hoursBack = String(opts.hoursBack);
139
- if (opts?.before)
140
- params.before = String(opts.before);
141
- if (opts?.after)
142
- params.after = String(opts.after);
143
- return this.request("GET", "/activities", { params });
144
- }
145
- async createActivity(body) {
146
- return this.request("POST", "/activities", { body });
147
- }
148
- async updateActivity(id, body) {
149
- return this.request("PATCH", "/activities", {
150
- params: { id },
151
- body,
152
- });
153
- }
154
- async deleteActivity(id) {
155
- return this.request("DELETE", "/activities", { params: { id } });
156
- }
157
- // -- Tasks ----------------------------------------------------------------
158
- async listTasks(opts) {
159
- const params = {};
160
- if (opts?.entityId)
161
- params.entityId = opts.entityId;
162
- if (opts?.onlyOpen !== undefined)
163
- params.onlyOpen = String(opts.onlyOpen);
164
- if (opts?.dueBy)
165
- params.dueBy = String(opts.dueBy);
166
- return this.request("GET", "/tasks", { params });
167
- }
168
- async getActivity(id) {
169
- return this.request("GET", "/activity", { params: { id } });
170
- }
171
- async getTaskByNumber(number, opts) {
172
- const params = { number: String(number) };
173
- if (opts?.spaceId)
174
- params.spaceId = opts.spaceId;
175
- return this.request("GET", "/tasks/number", { params });
176
- }
177
- async listSpaces() {
178
- const res = await this.searchEntities(undefined, { limit: 1 });
179
- return res.data.spaces;
180
- }
181
- }
182
- //# sourceMappingURL=api.js.map
@@ -1,16 +0,0 @@
1
- import { Command } from "commander";
2
- import type { EnteClient } from "../api.js";
3
- export interface ActivityListOpts {
4
- entity?: string;
5
- type?: string;
6
- attr?: string[];
7
- onlyOpen?: boolean;
8
- hours?: number;
9
- limit?: number;
10
- sort?: string;
11
- before?: number;
12
- after?: number;
13
- json?: boolean;
14
- }
15
- export declare function runActivityList(client: EnteClient, opts: ActivityListOpts): Promise<void>;
16
- export declare function registerActivityCommands(program: Command, getClient: () => EnteClient): void;