@nabnflow/cli 0.0.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/bin/run.js +5 -0
- package/dist/commands/auth/login.d.ts +16 -0
- package/dist/commands/auth/login.d.ts.map +1 -0
- package/dist/commands/auth/login.js +32 -0
- package/dist/commands/auth/login.js.map +1 -0
- package/dist/commands/auth/logout.d.ts +10 -0
- package/dist/commands/auth/logout.d.ts.map +1 -0
- package/dist/commands/auth/logout.js +13 -0
- package/dist/commands/auth/logout.js.map +1 -0
- package/dist/commands/auth/status.d.ts +12 -0
- package/dist/commands/auth/status.d.ts.map +1 -0
- package/dist/commands/auth/status.js +20 -0
- package/dist/commands/auth/status.js.map +1 -0
- package/dist/commands/blog/get.d.ts +26 -0
- package/dist/commands/blog/get.d.ts.map +1 -0
- package/dist/commands/blog/get.js +32 -0
- package/dist/commands/blog/get.js.map +1 -0
- package/dist/commands/blog/list.d.ts +23 -0
- package/dist/commands/blog/list.d.ts.map +1 -0
- package/dist/commands/blog/list.js +35 -0
- package/dist/commands/blog/list.js.map +1 -0
- package/dist/commands/blog/update.d.ts +24 -0
- package/dist/commands/blog/update.d.ts.map +1 -0
- package/dist/commands/blog/update.js +29 -0
- package/dist/commands/blog/update.js.map +1 -0
- package/dist/commands/hello.d.ts +6 -0
- package/dist/commands/hello.d.ts.map +1 -0
- package/dist/commands/hello.js +8 -0
- package/dist/commands/hello.js.map +1 -0
- package/dist/commands/notes/create.d.ts +19 -0
- package/dist/commands/notes/create.d.ts.map +1 -0
- package/dist/commands/notes/create.js +43 -0
- package/dist/commands/notes/create.js.map +1 -0
- package/dist/commands/notes/get.d.ts +24 -0
- package/dist/commands/notes/get.d.ts.map +1 -0
- package/dist/commands/notes/get.js +30 -0
- package/dist/commands/notes/get.js.map +1 -0
- package/dist/commands/notes/update.d.ts +22 -0
- package/dist/commands/notes/update.d.ts.map +1 -0
- package/dist/commands/notes/update.js +43 -0
- package/dist/commands/notes/update.js.map +1 -0
- package/dist/commands/projects/list.d.ts +19 -0
- package/dist/commands/projects/list.d.ts.map +1 -0
- package/dist/commands/projects/list.js +26 -0
- package/dist/commands/projects/list.js.map +1 -0
- package/dist/lib/client.d.ts +8 -0
- package/dist/lib/client.d.ts.map +1 -0
- package/dist/lib/client.js +47 -0
- package/dist/lib/client.js.map +1 -0
- package/dist/lib/config.d.ts +6 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +8 -0
- package/dist/lib/config.js.map +1 -0
- package/package.json +39 -0
package/bin/run.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class AuthLogin extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static enableJsonFlag: boolean;
|
|
5
|
+
static examples: string[];
|
|
6
|
+
static flags: {
|
|
7
|
+
token: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
'api-url': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
};
|
|
10
|
+
run(): Promise<{
|
|
11
|
+
authenticated: boolean;
|
|
12
|
+
token: string;
|
|
13
|
+
apiUrl: string;
|
|
14
|
+
}>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=login.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/commands/auth/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAQ,MAAM,aAAa,CAAA;AAG1C,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,OAAO;IAC5C,MAAM,CAAC,WAAW,SAA8C;IAEhE,MAAM,CAAC,cAAc,UAAO;IAE5B,MAAM,CAAC,QAAQ,WAEd;IAED,MAAM,CAAC,KAAK;;;MASX;IAEK,GAAG,IAAI,OAAO,CAAC;QAAC,aAAa,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,CAAC;CAgB9E"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Command, Flags } from '@oclif/core';
|
|
2
|
+
import { setBaseUrl, setToken } from '../../lib/config.js';
|
|
3
|
+
export default class AuthLogin extends Command {
|
|
4
|
+
static description = 'Authenticate with your Nab&Flow API token';
|
|
5
|
+
static enableJsonFlag = true;
|
|
6
|
+
static examples = [
|
|
7
|
+
'<%= config.bin %> auth login --token nf_live_xxx --api-url https://mydeployment.convex.site',
|
|
8
|
+
];
|
|
9
|
+
static flags = {
|
|
10
|
+
token: Flags.string({
|
|
11
|
+
description: 'API token (starts with nf_live_)',
|
|
12
|
+
required: true,
|
|
13
|
+
}),
|
|
14
|
+
'api-url': Flags.string({
|
|
15
|
+
description: 'Nab&Flow API base URL (e.g. https://mydeployment.convex.site)',
|
|
16
|
+
required: true,
|
|
17
|
+
}),
|
|
18
|
+
};
|
|
19
|
+
async run() {
|
|
20
|
+
const { flags } = await this.parse(AuthLogin);
|
|
21
|
+
if (!flags.token.startsWith('nf_live_')) {
|
|
22
|
+
this.error('Invalid token format. Token must start with nf_live_\n\nExample:\n nabflow auth login --token nf_live_xxx --api-url https://mydeployment.convex.site');
|
|
23
|
+
}
|
|
24
|
+
setToken(flags.token);
|
|
25
|
+
setBaseUrl(flags['api-url']);
|
|
26
|
+
const masked = `nf_live_***${flags.token.slice(-4)}`;
|
|
27
|
+
this.log(`Authenticated as ${masked}`);
|
|
28
|
+
this.log(`API URL: ${flags['api-url']}`);
|
|
29
|
+
return { authenticated: true, token: masked, apiUrl: flags['api-url'] };
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=login.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../../src/commands/auth/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EA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CAAC,EAAC,CAAA;IACvE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class AuthLogout extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static enableJsonFlag: boolean;
|
|
5
|
+
static examples: string[];
|
|
6
|
+
run(): Promise<{
|
|
7
|
+
success: boolean;
|
|
8
|
+
}>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=logout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../src/commands/auth/logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAA;AAGnC,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,OAAO;IAC7C,MAAM,CAAC,WAAW,SAAuC;IAEzD,MAAM,CAAC,cAAc,UAAO;IAE5B,MAAM,CAAC,QAAQ,WAAoC;IAE7C,GAAG,IAAI,OAAO,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAC,CAAC;CAKzC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { clearToken } from '../../lib/config.js';
|
|
3
|
+
export default class AuthLogout extends Command {
|
|
4
|
+
static description = 'Remove stored authentication token';
|
|
5
|
+
static enableJsonFlag = true;
|
|
6
|
+
static examples = ['<%= config.bin %> auth logout'];
|
|
7
|
+
async run() {
|
|
8
|
+
clearToken();
|
|
9
|
+
this.log('Logged out.');
|
|
10
|
+
return { success: true };
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=logout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logout.js","sourceRoot":"","sources":["../../../src/commands/auth/logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAA;AACnC,OAAO,EAAC,UAAU,EAAC,MAAM,qBAAqB,CAAA;AAE9C,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,OAAO;IAC7C,MAAM,CAAC,WAAW,GAAG,oCAAoC,CAAA;IAEzD,MAAM,CAAC,cAAc,GAAG,IAAI,CAAA;IAE5B,MAAM,CAAC,QAAQ,GAAG,CAAC,+BAA+B,CAAC,CAAA;IAEnD,KAAK,CAAC,GAAG;QACP,UAAU,EAAE,CAAA;QACZ,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;QACvB,OAAO,EAAC,OAAO,EAAE,IAAI,EAAC,CAAA;IACxB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class AuthStatus extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static enableJsonFlag: boolean;
|
|
5
|
+
static examples: string[];
|
|
6
|
+
run(): Promise<{
|
|
7
|
+
authenticated: boolean;
|
|
8
|
+
token: string | null;
|
|
9
|
+
apiUrl: string | null;
|
|
10
|
+
}>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/commands/auth/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAA;AAGnC,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,OAAO;IAC7C,MAAM,CAAC,WAAW,SAAuC;IAEzD,MAAM,CAAC,cAAc,UAAO;IAE5B,MAAM,CAAC,QAAQ,WAAoC;IAE7C,GAAG,IAAI,OAAO,CAAC;QAAC,aAAa,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;KAAC,CAAC;CAe5F"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { getBaseUrl, getToken } from '../../lib/config.js';
|
|
3
|
+
export default class AuthStatus extends Command {
|
|
4
|
+
static description = 'Show current authentication status';
|
|
5
|
+
static enableJsonFlag = true;
|
|
6
|
+
static examples = ['<%= config.bin %> auth status'];
|
|
7
|
+
async run() {
|
|
8
|
+
const token = getToken();
|
|
9
|
+
const apiUrl = getBaseUrl() || null;
|
|
10
|
+
if (!token) {
|
|
11
|
+
this.log('Not authenticated. Run:\n\n nabflow auth login --token <token> --api-url <url>');
|
|
12
|
+
return { authenticated: false, token: null, apiUrl };
|
|
13
|
+
}
|
|
14
|
+
const masked = `nf_live_***${token.slice(-4)}`;
|
|
15
|
+
this.log(`Authenticated: ${masked}`);
|
|
16
|
+
this.log(`API URL: ${apiUrl ?? '(not set)'}`);
|
|
17
|
+
return { authenticated: true, token: masked, apiUrl };
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../src/commands/auth/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAA;AACnC,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAC,MAAM,qBAAqB,CAAA;AAExD,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,OAAO;IAC7C,MAAM,CAAC,WAAW,GAAG,oCAAoC,CAAA;IAEzD,MAAM,CAAC,cAAc,GAAG,IAAI,CAAA;IAE5B,MAAM,CAAC,QAAQ,GAAG,CAAC,+BAA+B,CAAC,CAAA;IAEnD,KAAK,CAAC,GAAG;QACP,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAA;QACxB,MAAM,MAAM,GAAG,UAAU,EAAE,IAAI,IAAI,CAAA;QAEnC,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,IAAI,CAAC,GAAG,CAAC,iFAAiF,CAAC,CAAA;YAC3F,OAAO,EAAC,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAC,CAAA;QACpD,CAAC;QAED,MAAM,MAAM,GAAG,cAAc,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;QAC9C,IAAI,CAAC,GAAG,CAAC,kBAAkB,MAAM,EAAE,CAAC,CAAA;QACpC,IAAI,CAAC,GAAG,CAAC,kBAAkB,MAAM,IAAI,WAAW,EAAE,CAAC,CAAA;QAEnD,OAAO,EAAC,aAAa,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAC,CAAA;IACrD,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
interface BlogPost {
|
|
3
|
+
id: string;
|
|
4
|
+
slug: string;
|
|
5
|
+
title: string;
|
|
6
|
+
status: string;
|
|
7
|
+
publishedAt?: number;
|
|
8
|
+
excerpt?: string;
|
|
9
|
+
postTags?: string[];
|
|
10
|
+
createdAt: number;
|
|
11
|
+
updatedAt: number;
|
|
12
|
+
}
|
|
13
|
+
interface GetBlogPostResponse {
|
|
14
|
+
post: BlogPost;
|
|
15
|
+
}
|
|
16
|
+
export default class BlogGet extends Command {
|
|
17
|
+
static description: string;
|
|
18
|
+
static enableJsonFlag: boolean;
|
|
19
|
+
static examples: string[];
|
|
20
|
+
static args: {
|
|
21
|
+
slug: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
22
|
+
};
|
|
23
|
+
run(): Promise<GetBlogPostResponse>;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=get.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/blog/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,OAAO,EAAC,MAAM,aAAa,CAAA;AAGzC,UAAU,QAAQ;IAChB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,UAAU,mBAAmB;IAC3B,IAAI,EAAE,QAAQ,CAAA;CACf;AAED,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,OAAO;IAC1C,MAAM,CAAC,WAAW,SAA4B;IAE9C,MAAM,CAAC,cAAc,UAAO;IAE5B,MAAM,CAAC,QAAQ,WAGd;IAED,MAAM,CAAC,IAAI;;MAEV;IAEK,GAAG,IAAI,OAAO,CAAC,mBAAmB,CAAC;CAoB1C"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Args, Command } from '@oclif/core';
|
|
2
|
+
import { apiRequest } from '../../lib/client.js';
|
|
3
|
+
export default class BlogGet extends Command {
|
|
4
|
+
static description = 'Get a blog post by slug';
|
|
5
|
+
static enableJsonFlag = true;
|
|
6
|
+
static examples = [
|
|
7
|
+
'<%= config.bin %> blog get my-post-slug',
|
|
8
|
+
'<%= config.bin %> blog get my-post-slug --json',
|
|
9
|
+
];
|
|
10
|
+
static args = {
|
|
11
|
+
slug: Args.string({ description: 'Post slug', required: true }),
|
|
12
|
+
};
|
|
13
|
+
async run() {
|
|
14
|
+
const { args } = await this.parse(BlogGet);
|
|
15
|
+
const result = await apiRequest(`/api/blog/posts/${args.slug}`);
|
|
16
|
+
const { post } = result;
|
|
17
|
+
this.log(`ID: ${post.id}`);
|
|
18
|
+
this.log(`Slug: ${post.slug}`);
|
|
19
|
+
this.log(`Title: ${post.title}`);
|
|
20
|
+
this.log(`Status: ${post.status}`);
|
|
21
|
+
if (post.excerpt)
|
|
22
|
+
this.log(`Excerpt: ${post.excerpt}`);
|
|
23
|
+
if (post.postTags?.length)
|
|
24
|
+
this.log(`Tags: ${post.postTags.join(', ')}`);
|
|
25
|
+
if (post.publishedAt)
|
|
26
|
+
this.log(`Published: ${new Date(post.publishedAt).toISOString()}`);
|
|
27
|
+
this.log(`Created: ${new Date(post.createdAt).toISOString()}`);
|
|
28
|
+
this.log(`Updated: ${new Date(post.updatedAt).toISOString()}`);
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=get.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/commands/blog/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAE,OAAO,EAAC,MAAM,aAAa,CAAA;AACzC,OAAO,EAAC,UAAU,EAAC,MAAM,qBAAqB,CAAA;AAkB9C,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,OAAO;IAC1C,MAAM,CAAC,WAAW,GAAG,yBAAyB,CAAA;IAE9C,MAAM,CAAC,cAAc,GAAG,IAAI,CAAA;IAE5B,MAAM,CAAC,QAAQ,GAAG;QAChB,yCAAyC;QACzC,gDAAgD;KACjD,CAAA;IAED,MAAM,CAAC,IAAI,GAAG;QACZ,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,EAAC,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC;KAC9D,CAAA;IAED,KAAK,CAAC,GAAG;QACP,MAAM,EAAC,IAAI,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QAExC,MAAM,MAAM,GAAG,MAAM,UAAU,CAC7B,mBAAmB,IAAI,CAAC,IAAI,EAAE,CAC/B,CAAA;QACD,MAAM,EAAC,IAAI,EAAC,GAAG,MAAM,CAAA;QAErB,IAAI,CAAC,GAAG,CAAC,cAAc,IAAI,CAAC,EAAE,EAAE,CAAC,CAAA;QACjC,IAAI,CAAC,GAAG,CAAC,cAAc,IAAI,CAAC,IAAI,EAAE,CAAC,CAAA;QACnC,IAAI,CAAC,GAAG,CAAC,cAAc,IAAI,CAAC,KAAK,EAAE,CAAC,CAAA;QACpC,IAAI,CAAC,GAAG,CAAC,cAAc,IAAI,CAAC,MAAM,EAAE,CAAC,CAAA;QACrC,IAAI,IAAI,CAAC,OAAO;YAAE,IAAI,CAAC,GAAG,CAAC,cAAc,IAAI,CAAC,OAAO,EAAE,CAAC,CAAA;QACxD,IAAI,IAAI,CAAC,QAAQ,EAAE,MAAM;YAAE,IAAI,CAAC,GAAG,CAAC,cAAc,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QAC7E,IAAI,IAAI,CAAC,WAAW;YAAE,IAAI,CAAC,GAAG,CAAC,cAAc,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;QACxF,IAAI,CAAC,GAAG,CAAC,cAAc,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;QAChE,IAAI,CAAC,GAAG,CAAC,cAAc,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;QAEhE,OAAO,MAAM,CAAA;IACf,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
interface BlogPost {
|
|
3
|
+
id: string;
|
|
4
|
+
slug: string;
|
|
5
|
+
title: string;
|
|
6
|
+
status: string;
|
|
7
|
+
publishedAt?: number;
|
|
8
|
+
createdAt: number;
|
|
9
|
+
}
|
|
10
|
+
interface ListBlogPostsResponse {
|
|
11
|
+
posts: BlogPost[];
|
|
12
|
+
}
|
|
13
|
+
export default class BlogList extends Command {
|
|
14
|
+
static description: string;
|
|
15
|
+
static enableJsonFlag: boolean;
|
|
16
|
+
static examples: string[];
|
|
17
|
+
static flags: {
|
|
18
|
+
status: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
};
|
|
20
|
+
run(): Promise<ListBlogPostsResponse>;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/blog/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAQ,MAAM,aAAa,CAAA;AAG1C,UAAU,QAAQ;IAChB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,UAAU,qBAAqB;IAC7B,KAAK,EAAE,QAAQ,EAAE,CAAA;CAClB;AAED,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,OAAO;IAC3C,MAAM,CAAC,WAAW,SAAoB;IAEtC,MAAM,CAAC,cAAc,UAAO;IAE5B,MAAM,CAAC,QAAQ,WAId;IAED,MAAM,CAAC,KAAK;;MAMX;IAEK,GAAG,IAAI,OAAO,CAAC,qBAAqB,CAAC;CAsB5C"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Command, Flags } from '@oclif/core';
|
|
2
|
+
import { apiRequest } from '../../lib/client.js';
|
|
3
|
+
export default class BlogList extends Command {
|
|
4
|
+
static description = 'List blog posts';
|
|
5
|
+
static enableJsonFlag = true;
|
|
6
|
+
static examples = [
|
|
7
|
+
'<%= config.bin %> blog list',
|
|
8
|
+
'<%= config.bin %> blog list --status draft',
|
|
9
|
+
'<%= config.bin %> blog list --status all --json',
|
|
10
|
+
];
|
|
11
|
+
static flags = {
|
|
12
|
+
status: Flags.string({
|
|
13
|
+
description: 'Filter by status',
|
|
14
|
+
options: ['published', 'draft', 'all'],
|
|
15
|
+
default: 'published',
|
|
16
|
+
}),
|
|
17
|
+
};
|
|
18
|
+
async run() {
|
|
19
|
+
const { flags } = await this.parse(BlogList);
|
|
20
|
+
const result = await apiRequest(`/api/blog/posts?status=${flags.status}`);
|
|
21
|
+
const { posts } = result;
|
|
22
|
+
if (posts.length === 0) {
|
|
23
|
+
this.log('No posts found.');
|
|
24
|
+
return result;
|
|
25
|
+
}
|
|
26
|
+
const slugWidth = Math.max(4, ...posts.map((p) => p.slug.length));
|
|
27
|
+
this.log(`${'SLUG'.padEnd(slugWidth)} STATUS TITLE`);
|
|
28
|
+
this.log(`${'─'.repeat(slugWidth)} ${'─'.repeat(10)} ${'─'.repeat(40)}`);
|
|
29
|
+
for (const p of posts) {
|
|
30
|
+
this.log(`${p.slug.padEnd(slugWidth)} ${p.status.padEnd(10)} ${p.title}`);
|
|
31
|
+
}
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/blog/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAC,UAAU,EAAC,MAAM,qBAAqB,CAAA;AAe9C,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,OAAO;IAC3C,MAAM,CAAC,WAAW,GAAG,iBAAiB,CAAA;IAEtC,MAAM,CAAC,cAAc,GAAG,IAAI,CAAA;IAE5B,MAAM,CAAC,QAAQ,GAAG;QAChB,6BAA6B;QAC7B,4CAA4C;QAC5C,iDAAiD;KAClD,CAAA;IAED,MAAM,CAAC,KAAK,GAAG;QACb,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC;YACnB,WAAW,EAAE,kBAAkB;YAC/B,O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|
+
import { Command } from '@oclif/core';
|
|
2
|
+
interface BlogPost {
|
|
3
|
+
id: string;
|
|
4
|
+
slug: string;
|
|
5
|
+
title: string;
|
|
6
|
+
status: string;
|
|
7
|
+
}
|
|
8
|
+
interface UpdateBlogPostResponse {
|
|
9
|
+
post: BlogPost;
|
|
10
|
+
}
|
|
11
|
+
export default class BlogUpdate extends Command {
|
|
12
|
+
static description: string;
|
|
13
|
+
static enableJsonFlag: boolean;
|
|
14
|
+
static examples: string[];
|
|
15
|
+
static args: {
|
|
16
|
+
slug: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
17
|
+
};
|
|
18
|
+
static flags: {
|
|
19
|
+
title: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
+
};
|
|
21
|
+
run(): Promise<UpdateBlogPostResponse>;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=update.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/commands/blog/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,OAAO,EAAQ,MAAM,aAAa,CAAA;AAGhD,UAAU,QAAQ;IAChB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf;AAED,UAAU,sBAAsB;IAC9B,IAAI,EAAE,QAAQ,CAAA;CACf;AAED,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,OAAO;IAC7C,MAAM,CAAC,WAAW,SAAuB;IAEzC,MAAM,CAAC,cAAc,UAAO;IAE5B,MAAM,CAAC,QAAQ,WAGd;IAED,MAAM,CAAC,IAAI;;MAEV;IAED,MAAM,CAAC,KAAK;;MAEX;IAEK,GAAG,IAAI,OAAO,CAAC,sBAAsB,CAAC;CAoB7C"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Args, Command, Flags } from '@oclif/core';
|
|
2
|
+
import { apiRequest } from '../../lib/client.js';
|
|
3
|
+
export default class BlogUpdate extends Command {
|
|
4
|
+
static description = 'Update a blog post';
|
|
5
|
+
static enableJsonFlag = true;
|
|
6
|
+
static examples = [
|
|
7
|
+
'<%= config.bin %> blog update my-post-slug --title "New Title"',
|
|
8
|
+
'<%= config.bin %> blog update my-post-slug --title "New Title" --json',
|
|
9
|
+
];
|
|
10
|
+
static args = {
|
|
11
|
+
slug: Args.string({ description: 'Post slug', required: true }),
|
|
12
|
+
};
|
|
13
|
+
static flags = {
|
|
14
|
+
title: Flags.string({ description: 'New title' }),
|
|
15
|
+
};
|
|
16
|
+
async run() {
|
|
17
|
+
const { args, flags } = await this.parse(BlogUpdate);
|
|
18
|
+
if (flags.title === undefined) {
|
|
19
|
+
this.error('At least one flag is required.\n\nExample:\n nabflow blog update <slug> --title "New title"');
|
|
20
|
+
}
|
|
21
|
+
const body = {};
|
|
22
|
+
if (flags.title !== undefined)
|
|
23
|
+
body.title = flags.title;
|
|
24
|
+
const result = await apiRequest(`/api/blog/posts/${args.slug}`, { method: 'PUT', body: JSON.stringify(body) });
|
|
25
|
+
this.log(`Updated post: ${result.post.slug}`);
|
|
26
|
+
return result;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/commands/blog/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AAChD,OAAO,EAAC,UAAU,EAAC,MAAM,qBAAqB,CAAA;AAa9C,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,OAAO;IAC7C,MAAM,CAAC,WAAW,GAAG,oBAAoB,CAAA;IAEzC,MAAM,CAAC,cAAc,GAAG,IAAI,CAAA;I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W,SAAc;IAE1B,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAG3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hello.js","sourceRoot":"","sources":["../../src/commands/hello.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAA;AAEnC,MAAM,CAAC,OAAO,OAAO,KAAM,SAAQ,OAAO;IACxC,MAAM,CAAC,WAAW,GAAG,WAAW,CAAA;IAEhC,KAAK,CAAC,GAAG;QACP,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,CAAA;IAC3B,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
interface CreateNoteResponse {
|
|
3
|
+
documentId: string;
|
|
4
|
+
message: string;
|
|
5
|
+
}
|
|
6
|
+
export default class NotesCreate extends Command {
|
|
7
|
+
static description: string;
|
|
8
|
+
static enableJsonFlag: boolean;
|
|
9
|
+
static examples: string[];
|
|
10
|
+
static flags: {
|
|
11
|
+
title: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
body: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
project: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
tags: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
};
|
|
16
|
+
run(): Promise<CreateNoteResponse>;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=create.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/notes/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAQ,MAAM,aAAa,CAAA;AAG1C,UAAU,kBAAkB;IAC1B,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,OAAO;IAC9C,MAAM,CAAC,WAAW,SAAsB;IAExC,MAAM,CAAC,cAAc,UAAO;IAE5B,MAAM,CAAC,QAAQ,WAId;IAED,MAAM,CAAC,KAAK;;;;;MAcX;IAEK,GAAG,IAAI,OAAO,CAAC,kBAAkB,CAAC;CAgBzC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Command, Flags } from '@oclif/core';
|
|
2
|
+
import { apiRequest } from '../../lib/client.js';
|
|
3
|
+
export default class NotesCreate extends Command {
|
|
4
|
+
static description = 'Create a new note';
|
|
5
|
+
static enableJsonFlag = true;
|
|
6
|
+
static examples = [
|
|
7
|
+
'<%= config.bin %> notes create --title "My note"',
|
|
8
|
+
'<%= config.bin %> notes create --title "Meeting notes" --body "Discussed Q2 goals" --tags work,meetings',
|
|
9
|
+
'<%= config.bin %> notes create --title "Task" --project proj_abc123 --json',
|
|
10
|
+
];
|
|
11
|
+
static flags = {
|
|
12
|
+
title: Flags.string({
|
|
13
|
+
description: 'Note title',
|
|
14
|
+
required: true,
|
|
15
|
+
}),
|
|
16
|
+
body: Flags.string({
|
|
17
|
+
description: 'Note body content',
|
|
18
|
+
}),
|
|
19
|
+
project: Flags.string({
|
|
20
|
+
description: 'Project ID to associate the note with',
|
|
21
|
+
}),
|
|
22
|
+
tags: Flags.string({
|
|
23
|
+
description: 'Comma-separated list of tags',
|
|
24
|
+
}),
|
|
25
|
+
};
|
|
26
|
+
async run() {
|
|
27
|
+
const { flags } = await this.parse(NotesCreate);
|
|
28
|
+
const body = { title: flags.title };
|
|
29
|
+
if (flags.body)
|
|
30
|
+
body.description = flags.body;
|
|
31
|
+
if (flags.project)
|
|
32
|
+
body.projectId = flags.project;
|
|
33
|
+
if (flags.tags)
|
|
34
|
+
body.tags = flags.tags.split(',').map((t) => t.trim());
|
|
35
|
+
const result = await apiRequest('/api/notes', {
|
|
36
|
+
method: 'POST',
|
|
37
|
+
body: JSON.stringify(body),
|
|
38
|
+
});
|
|
39
|
+
this.log(`Created note: ${result.documentId}`);
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/commands/notes/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAC,UAAU,EAAC,MAAM,qBAAqB,CAAA;AAO9C,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,OAAO;IAC9C,MAAM,CAAC,WAAW,GAAG,mBAAmB,CAAA;IAExC,MAAM,CAAC,cAAc,GAAG,IAAI,CAAA;IAE5B,MAAM,CAAC,QAAQ,GAAG;QAChB,kDAAkD;QAClD,yGAAyG;QACzG,4EAA4E;KAC7E,CAAA;IAED,MAAM,CAAC,KAAK,GAAG;QACb,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC;YAClB,WAAW,EAAE,YAAY;YACzB,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC;YACjB,WAAW,EAAE,mBAAmB;SACjC,CAAC;QACF,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC;YACpB,WAAW,EAAE,uCAAuC;SACrD,CAAC;QACF,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC;YACjB,WAAW,EAAE,8BAA8B;SAC5C,CAAC;KACH,CAAA;IAED,KAAK,CAAC,GAAG;QACP,MAAM,EAAC,KAAK,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;QAE7C,MAAM,IAAI,GAA4B,EAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAC,CAAA;QAC1D,IAAI,KAAK,CAAC,IAAI;YAAE,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,IAAI,CAAA;QAC7C,IAAI,KAAK,CAAC,OAAO;YAAE,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,OAAO,CAAA;QACjD,IAAI,KAAK,CAAC,IAAI;YAAE,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;QAEtE,MAAM,MAAM,GAAG,MAAM,UAAU,CAAqB,YAAY,EAAE;YAChE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;SAC3B,CAAC,CAAA;QAEF,IAAI,CAAC,GAAG,CAAC,iBAAiB,MAAM,CAAC,UAAU,EAAE,CAAC,CAAA;QAC9C,OAAO,MAAM,CAAA;IACf,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
interface Note {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
tags?: string[];
|
|
7
|
+
projectId?: string;
|
|
8
|
+
createdAt: number;
|
|
9
|
+
updatedAt: number;
|
|
10
|
+
}
|
|
11
|
+
interface GetNoteResponse {
|
|
12
|
+
note: Note;
|
|
13
|
+
}
|
|
14
|
+
export default class NotesGet extends Command {
|
|
15
|
+
static description: string;
|
|
16
|
+
static enableJsonFlag: boolean;
|
|
17
|
+
static examples: string[];
|
|
18
|
+
static args: {
|
|
19
|
+
id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
20
|
+
};
|
|
21
|
+
run(): Promise<GetNoteResponse>;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=get.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/notes/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,OAAO,EAAC,MAAM,aAAa,CAAA;AAGzC,UAAU,IAAI;IACZ,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,UAAU,eAAe;IACvB,IAAI,EAAE,IAAI,CAAA;CACX;AAED,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,OAAO;IAC3C,MAAM,CAAC,WAAW,SAAqB;IAEvC,MAAM,CAAC,cAAc,UAAO;IAE5B,MAAM,CAAC,QAAQ,WAGd;IAED,MAAM,CAAC,IAAI;;MAEV;IAEK,GAAG,IAAI,OAAO,CAAC,eAAe,CAAC;CAgBtC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Args, Command } from '@oclif/core';
|
|
2
|
+
import { apiRequest } from '../../lib/client.js';
|
|
3
|
+
export default class NotesGet extends Command {
|
|
4
|
+
static description = 'Get a note by ID';
|
|
5
|
+
static enableJsonFlag = true;
|
|
6
|
+
static examples = [
|
|
7
|
+
'<%= config.bin %> notes get <id>',
|
|
8
|
+
'<%= config.bin %> notes get <id> --json',
|
|
9
|
+
];
|
|
10
|
+
static args = {
|
|
11
|
+
id: Args.string({ description: 'Note ID', required: true }),
|
|
12
|
+
};
|
|
13
|
+
async run() {
|
|
14
|
+
const { args } = await this.parse(NotesGet);
|
|
15
|
+
const result = await apiRequest(`/api/notes/${args.id}`);
|
|
16
|
+
const { note } = result;
|
|
17
|
+
this.log(`ID: ${note.id}`);
|
|
18
|
+
this.log(`Title: ${note.title}`);
|
|
19
|
+
if (note.description)
|
|
20
|
+
this.log(`Body: ${note.description}`);
|
|
21
|
+
if (note.tags?.length)
|
|
22
|
+
this.log(`Tags: ${note.tags.join(', ')}`);
|
|
23
|
+
if (note.projectId)
|
|
24
|
+
this.log(`Project: ${note.projectId}`);
|
|
25
|
+
this.log(`Created: ${new Date(note.createdAt).toISOString()}`);
|
|
26
|
+
this.log(`Updated: ${new Date(note.updatedAt).toISOString()}`);
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=get.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/commands/notes/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAE,OAAO,EAAC,MAAM,aAAa,CAAA;AACzC,OAAO,EAAC,UAAU,EAAC,MAAM,qBAAqB,CAAA;AAgB9C,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,OAAO;IAC3C,MAAM,CAAC,WAAW,GAAG,kBAAkB,CAAA;IAEvC,MAAM,CAAC,cAAc,GAAG,IAAI,CAAA;IAE5B,MAAM,CAAC,QAAQ,GAAG;QAChB,kCAAkC;QAClC,yCAAyC;KAC1C,CAAA;IAED,MAAM,CAAC,IAAI,GAAG;QACZ,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,EAAC,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC;KAC1D,CAAA;IAED,KAAK,CAAC,GAAG;QACP,MAAM,EAAC,IAAI,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;QAEzC,MAAM,MAAM,GAAG,MAAM,UAAU,CAAkB,cAAc,IAAI,CAAC,EAAE,EAAE,CAAC,CAAA;QACzE,MAAM,EAAC,IAAI,EAAC,GAAG,MAAM,CAAA;QAErB,IAAI,CAAC,GAAG,CAAC,YAAY,IAAI,CAAC,EAAE,EAAE,CAAC,CAAA;QAC/B,IAAI,CAAC,GAAG,CAAC,YAAY,IAAI,CAAC,KAAK,EAAE,CAAC,CAAA;QAClC,IAAI,IAAI,CAAC,WAAW;YAAE,IAAI,CAAC,GAAG,CAAC,YAAY,IAAI,CAAC,WAAW,EAAE,CAAC,CAAA;QAC9D,IAAI,IAAI,CAAC,IAAI,EAAE,MAAM;YAAE,IAAI,CAAC,GAAG,CAAC,YAAY,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QACnE,IAAI,IAAI,CAAC,SAAS;YAAE,IAAI,CAAC,GAAG,CAAC,YAAY,IAAI,CAAC,SAAS,EAAE,CAAC,CAAA;QAC1D,IAAI,CAAC,GAAG,CAAC,YAAY,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;QAC9D,IAAI,CAAC,GAAG,CAAC,YAAY,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;QAE9D,OAAO,MAAM,CAAA;IACf,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
interface UpdateNoteResponse {
|
|
3
|
+
documentId: string;
|
|
4
|
+
message: string;
|
|
5
|
+
}
|
|
6
|
+
export default class NotesUpdate extends Command {
|
|
7
|
+
static description: string;
|
|
8
|
+
static enableJsonFlag: boolean;
|
|
9
|
+
static examples: string[];
|
|
10
|
+
static args: {
|
|
11
|
+
id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
12
|
+
};
|
|
13
|
+
static flags: {
|
|
14
|
+
title: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
body: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
project: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
tags: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
};
|
|
19
|
+
run(): Promise<UpdateNoteResponse>;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=update.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/commands/notes/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,OAAO,EAAQ,MAAM,aAAa,CAAA;AAGhD,UAAU,kBAAkB;IAC1B,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,OAAO;IAC9C,MAAM,CAAC,WAAW,SAAkB;IAEpC,MAAM,CAAC,cAAc,UAAO;IAE5B,MAAM,CAAC,QAAQ,WAId;IAED,MAAM,CAAC,IAAI;;MAEV;IAED,MAAM,CAAC,KAAK;;;;;MAKX;IAEK,GAAG,IAAI,OAAO,CAAC,kBAAkB,CAAC;CAwBzC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Args, Command, Flags } from '@oclif/core';
|
|
2
|
+
import { apiRequest } from '../../lib/client.js';
|
|
3
|
+
export default class NotesUpdate extends Command {
|
|
4
|
+
static description = 'Update a note';
|
|
5
|
+
static enableJsonFlag = true;
|
|
6
|
+
static examples = [
|
|
7
|
+
'<%= config.bin %> notes update <id> --title "New title"',
|
|
8
|
+
'<%= config.bin %> notes update <id> --tags work,urgent',
|
|
9
|
+
'<%= config.bin %> notes update <id> --project proj_abc123 --json',
|
|
10
|
+
];
|
|
11
|
+
static args = {
|
|
12
|
+
id: Args.string({ description: 'Note ID', required: true }),
|
|
13
|
+
};
|
|
14
|
+
static flags = {
|
|
15
|
+
title: Flags.string({ description: 'New title' }),
|
|
16
|
+
body: Flags.string({ description: 'New body content (pass empty string to clear)' }),
|
|
17
|
+
project: Flags.string({ description: 'Project ID to move note to (pass "inbox" to clear)' }),
|
|
18
|
+
tags: Flags.string({ description: 'Comma-separated tags (replaces existing tags)' }),
|
|
19
|
+
};
|
|
20
|
+
async run() {
|
|
21
|
+
const { args, flags } = await this.parse(NotesUpdate);
|
|
22
|
+
const hasFlag = flags.title !== undefined || flags.body !== undefined || flags.project !== undefined || flags.tags !== undefined;
|
|
23
|
+
if (!hasFlag) {
|
|
24
|
+
this.error('At least one flag is required.\n\nExample:\n nabflow notes update <id> --title "New title"');
|
|
25
|
+
}
|
|
26
|
+
const body = {};
|
|
27
|
+
if (flags.title !== undefined)
|
|
28
|
+
body.title = flags.title;
|
|
29
|
+
if (flags.body !== undefined)
|
|
30
|
+
body.description = flags.body || null;
|
|
31
|
+
if (flags.project !== undefined)
|
|
32
|
+
body.projectId = flags.project === 'inbox' ? null : flags.project;
|
|
33
|
+
if (flags.tags !== undefined)
|
|
34
|
+
body.tags = flags.tags.split(',').map((t) => t.trim());
|
|
35
|
+
const result = await apiRequest(`/api/notes/${args.id}`, {
|
|
36
|
+
method: 'PUT',
|
|
37
|
+
body: JSON.stringify(body),
|
|
38
|
+
});
|
|
39
|
+
this.log(`Updated note: ${result.documentId}`);
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/commands/notes/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AAChD,OAAO,EAAC,UAAU,EAAC,MAAM,qBAAqB,CAAA;AAO9C,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,OAAO;IAC9C,MAAM,CAAC,WAAW,GAAG,eAAe,CAAA;IAEpC,MAAM,CAAC,cAAc,GAAG,IAAI,CAAA;IAE5B,MAAM,CAAC,QAAQ,GAAG;QAChB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AAI,CAAC,SAAS,GAAG,KAAK,CAAC,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAA;QAClG,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS;YAAE,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;QAEpF,MAAM,MAAM,GAAG,MAAM,UAAU,CAAqB,cAAc,IAAI,CAAC,EAAE,EAAE,EAAE;YAC3E,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;SAC3B,CAAC,CAAA;QAEF,IAAI,CAAC,GAAG,CAAC,iBAAiB,MAAM,CAAC,UAAU,EAAE,CAAC,CAAA;QAC9C,OAAO,MAAM,CAAA;IACf,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
interface Project {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
createdAt: number;
|
|
7
|
+
updatedAt: number;
|
|
8
|
+
}
|
|
9
|
+
interface ListProjectsResponse {
|
|
10
|
+
projects: Project[];
|
|
11
|
+
}
|
|
12
|
+
export default class ProjectsList extends Command {
|
|
13
|
+
static description: string;
|
|
14
|
+
static enableJsonFlag: boolean;
|
|
15
|
+
static examples: string[];
|
|
16
|
+
run(): Promise<ListProjectsResponse>;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/projects/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAA;AAGnC,UAAU,OAAO;IACf,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,OAAO,EAAE,CAAA;CACpB;AAED,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,OAAO;IAC/C,MAAM,CAAC,WAAW,SAAsB;IAExC,MAAM,CAAC,cAAc,UAAO;IAE5B,MAAM,CAAC,QAAQ,WAGd;IAEK,GAAG,IAAI,OAAO,CAAC,oBAAoB,CAAC;CAkB3C"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { apiRequest } from '../../lib/client.js';
|
|
3
|
+
export default class ProjectsList extends Command {
|
|
4
|
+
static description = 'List all projects';
|
|
5
|
+
static enableJsonFlag = true;
|
|
6
|
+
static examples = [
|
|
7
|
+
'<%= config.bin %> projects list',
|
|
8
|
+
'<%= config.bin %> projects list --json',
|
|
9
|
+
];
|
|
10
|
+
async run() {
|
|
11
|
+
const result = await apiRequest('/api/projects');
|
|
12
|
+
const { projects } = result;
|
|
13
|
+
if (projects.length === 0) {
|
|
14
|
+
this.log('No projects found.');
|
|
15
|
+
return result;
|
|
16
|
+
}
|
|
17
|
+
const idWidth = Math.max(2, ...projects.map((p) => p.id.length));
|
|
18
|
+
this.log(`${'ID'.padEnd(idWidth)} TITLE`);
|
|
19
|
+
this.log(`${'─'.repeat(idWidth)} ${'─'.repeat(40)}`);
|
|
20
|
+
for (const p of projects) {
|
|
21
|
+
this.log(`${p.id.padEnd(idWidth)} ${p.title}`);
|
|
22
|
+
}
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","s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CAAA;IACf,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare class NabflowError extends Error {
|
|
2
|
+
status: number;
|
|
3
|
+
constructor(status: number, message: string);
|
|
4
|
+
}
|
|
5
|
+
export declare function requireAuth(): string;
|
|
6
|
+
export declare function requireBaseUrl(): string;
|
|
7
|
+
export declare function apiRequest<T>(path: string, options?: RequestInit): Promise<T>;
|
|
8
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/lib/client.ts"],"names":[],"mappings":"AAEA,qBAAa,YAAa,SAAQ,KAAK;IAE5B,MAAM,EAAE,MAAM;gBAAd,MAAM,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM;CAKlB;AAED,wBAAgB,WAAW,IAAI,MAAM,CAUpC;AAED,wBAAgB,cAAc,IAAI,MAAM,CAUvC;AAED,wBAAsB,UAAU,CAAC,CAAC,EAChC,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,WAAgB,GACxB,OAAO,CAAC,CAAC,CAAC,CAyBZ"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { getBaseUrl, getToken } from './config.js';
|
|
2
|
+
export class NabflowError extends Error {
|
|
3
|
+
status;
|
|
4
|
+
constructor(status, message) {
|
|
5
|
+
super(message);
|
|
6
|
+
this.status = status;
|
|
7
|
+
this.name = 'NabflowError';
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export function requireAuth() {
|
|
11
|
+
const token = getToken();
|
|
12
|
+
if (!token) {
|
|
13
|
+
throw new NabflowError(401, 'Not authenticated. Run:\n\n nabflow auth login --token <token>');
|
|
14
|
+
}
|
|
15
|
+
return token;
|
|
16
|
+
}
|
|
17
|
+
export function requireBaseUrl() {
|
|
18
|
+
const url = getBaseUrl();
|
|
19
|
+
if (!url) {
|
|
20
|
+
throw new NabflowError(0, 'API URL not configured. Run:\n\n nabflow auth login --token <token> --api-url <url>');
|
|
21
|
+
}
|
|
22
|
+
return url;
|
|
23
|
+
}
|
|
24
|
+
export async function apiRequest(path, options = {}) {
|
|
25
|
+
const token = requireAuth();
|
|
26
|
+
const baseUrl = requireBaseUrl();
|
|
27
|
+
const url = `${baseUrl.replace(/\/$/, '')}${path}`;
|
|
28
|
+
const res = await fetch(url, {
|
|
29
|
+
...options,
|
|
30
|
+
headers: {
|
|
31
|
+
'Content-Type': 'application/json',
|
|
32
|
+
Authorization: `Bearer ${token}`,
|
|
33
|
+
...options.headers,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
if (!res.ok) {
|
|
37
|
+
let message = `HTTP ${res.status}`;
|
|
38
|
+
try {
|
|
39
|
+
const body = (await res.json());
|
|
40
|
+
message = body.error ?? body.message ?? message;
|
|
41
|
+
}
|
|
42
|
+
catch { }
|
|
43
|
+
throw new NabflowError(res.status, message);
|
|
44
|
+
}
|
|
45
|
+
return res.json();
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/lib/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAC,MAAM,aAAa,CAAA;AAEhD,MAAM,OAAO,YAAa,SAAQ,KAAK;IAE5B;IADT,YACS,MAAc,EACrB,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAA;QAHP,WAAM,GAAN,MAAM,CAAQ;QAIrB,IAAI,CAAC,IAAI,GAAG,cAAc,CAAA;IAC5B,CAAC;CACF;AAED,MAAM,UAAU,WAAW;IACzB,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAA;IACxB,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,YAAY,CACpB,GAAG,EACH,iEAAiE,CAClE,CAAA;IACH,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AAED,MAAM,UAAU,cAAc;IAC5B,MAAM,GAAG,GAAG,UAAU,EAAE,CAAA;IACxB,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,YAAY,CACpB,CAAC,EACD,sFAAsF,CACvF,CAAA;IACH,CAAC;IAED,OAAO,GAAG,CAAA;AACZ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,IAAY,EACZ,UAAuB,EAAE;IAEzB,MAAM,KAAK,GAAG,WAAW,EAAE,CAAA;IAC3B,MAAM,OAAO,GAAG,cAAc,EAAE,CAAA;IAEhC,MAAM,GAAG,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAA;IAClD,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;QAC3B,GAAG,OAAO;QACV,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;YAClC,aAAa,EAAE,UAAU,KAAK,EAAE;YAChC,GAAG,OAAO,CAAC,OAAO;SACnB;KACF,CAAC,CAAA;IAEF,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,IAAI,OAAO,GAAG,QAAQ,GAAG,CAAC,MAAM,EAAE,CAAA;QAClC,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAuC,CAAA;YACrE,OAAO,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,OAAO,IAAI,OAAO,CAAA;QACjD,CAAC;QAAC,MAAM,CAAC,CAAA,CAAC;QAEV,MAAM,IAAI,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC7C,CAAC;IAED,OAAO,GAAG,CAAC,IAAI,EAAgB,CAAA;AACjC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const getToken: () => string | undefined;
|
|
2
|
+
export declare const setToken: (token: string) => void;
|
|
3
|
+
export declare const clearToken: () => void;
|
|
4
|
+
export declare const getBaseUrl: () => string;
|
|
5
|
+
export declare const setBaseUrl: (url: string) => void;
|
|
6
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,QAAQ,QAAO,MAAM,GAAG,SAA+B,CAAA;AACpE,eAAO,MAAM,QAAQ,GAAI,OAAO,MAAM,KAAG,IAAiC,CAAA;AAC1E,eAAO,MAAM,UAAU,QAAO,IAA6B,CAAA;AAE3D,eAAO,MAAM,UAAU,QAAO,MAC6B,CAAA;AAE3D,eAAO,MAAM,UAAU,GAAI,KAAK,MAAM,KAAG,IAAiC,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import Conf from 'conf';
|
|
2
|
+
const store = new Conf({ projectName: 'nabflow' });
|
|
3
|
+
export const getToken = () => store.get('token');
|
|
4
|
+
export const setToken = (token) => store.set('token', token);
|
|
5
|
+
export const clearToken = () => store.delete('token');
|
|
6
|
+
export const getBaseUrl = () => process.env.NABFLOW_API_URL ?? store.get('baseUrl') ?? '';
|
|
7
|
+
export const setBaseUrl = (url) => store.set('baseUrl', url);
|
|
8
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AAOvB,MAAM,KAAK,GAAG,IAAI,IAAI,CAAgB,EAAC,WAAW,EAAE,SAAS,EAAC,CAAC,CAAA;AAE/D,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAuB,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;AACpE,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAa,EAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;AAC1E,MAAM,CAAC,MAAM,UAAU,GAAG,GAAS,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;AAE3D,MAAM,CAAC,MAAM,UAAU,GAAG,GAAW,EAAE,CACrC,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,CAAA;AAE3D,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,GAAW,EAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nabnflow/cli",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Nab&Flow CLI — project management from your terminal",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"nabflow": "bin/run.js"
|
|
8
|
+
},
|
|
9
|
+
"main": "./dist/index.js",
|
|
10
|
+
"files": [
|
|
11
|
+
"bin",
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc",
|
|
16
|
+
"dev": "tsc --watch",
|
|
17
|
+
"prepublishOnly": "pnpm build"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@oclif/core": "^4",
|
|
21
|
+
"@oclif/plugin-update": "^4.7.27",
|
|
22
|
+
"conf": "^15.1.0"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"typescript": "^5"
|
|
26
|
+
},
|
|
27
|
+
"oclif": {
|
|
28
|
+
"bin": "nabflow",
|
|
29
|
+
"dirname": "nabflow",
|
|
30
|
+
"commands": "./dist/commands",
|
|
31
|
+
"topicSeparator": " ",
|
|
32
|
+
"plugins": [
|
|
33
|
+
"@oclif/plugin-update"
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=18"
|
|
38
|
+
}
|
|
39
|
+
}
|