@tightknitai/tightknit 0.1.0-alpha.3 → 0.1.0-alpha.4
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/tightknit-mcp.js +12 -10
- package/bin/tightknit.js +15 -13
- package/bin/tightknit.ts +2 -2
- package/package.json +1 -1
- package/src/cli/awards/assign.ts +13 -13
- package/src/cli/config/get.ts +12 -11
- package/src/cli/config/set.ts +17 -11
- package/src/cli/error-handler.ts +6 -4
- package/src/cli/events/create.ts +24 -20
- package/src/cli/events/delete.ts +12 -10
- package/src/cli/events/get.ts +8 -8
- package/src/cli/events/list.ts +17 -14
- package/src/cli/events/update.ts +12 -12
- package/src/cli/feeds/get.ts +8 -8
- package/src/cli/feeds/list.ts +12 -12
- package/src/cli/feeds/posts.ts +12 -12
- package/src/cli/groups/add-member.ts +11 -11
- package/src/cli/index.ts +35 -31
- package/src/cli/members/add.ts +12 -12
- package/src/cli/members/check.ts +8 -8
- package/src/cli/messages/send.ts +15 -12
- package/src/cli/posts/get.ts +8 -8
- package/src/cli/search/query.ts +15 -12
- package/src/core/config.ts +2 -19
- package/src/mcp/server.ts +5 -5
- package/src/mcp/tools.ts +227 -111
package/bin/tightknit-mcp.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { spawn } from
|
|
3
|
-
import { fileURLToPath } from
|
|
4
|
-
import { dirname, join } from
|
|
5
|
-
import { realpathSync, existsSync } from
|
|
2
|
+
import { spawn } from 'node:child_process';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { dirname, join } from 'node:path';
|
|
5
|
+
import { realpathSync, existsSync } from 'node:fs';
|
|
6
6
|
|
|
7
7
|
const __filename = realpathSync(fileURLToPath(import.meta.url));
|
|
8
8
|
const __dirname = dirname(__filename);
|
|
@@ -10,15 +10,17 @@ const __dirname = dirname(__filename);
|
|
|
10
10
|
function findTsx() {
|
|
11
11
|
let dir = __dirname;
|
|
12
12
|
while (dir !== dirname(dir)) {
|
|
13
|
-
const candidate = join(dir,
|
|
14
|
-
if (existsSync(candidate))
|
|
13
|
+
const candidate = join(dir, 'node_modules', '.bin', 'tsx');
|
|
14
|
+
if (existsSync(candidate)) {
|
|
15
|
+
return candidate;
|
|
16
|
+
}
|
|
15
17
|
dir = dirname(dir);
|
|
16
18
|
}
|
|
17
|
-
return
|
|
19
|
+
return 'tsx';
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
const tsx = findTsx();
|
|
21
|
-
const script = join(__dirname,
|
|
23
|
+
const script = join(__dirname, '..', 'src', 'mcp', 'server.ts');
|
|
22
24
|
|
|
23
|
-
const child = spawn(tsx, [script], { stdio:
|
|
24
|
-
child.on(
|
|
25
|
+
const child = spawn(tsx, [script], { stdio: 'inherit' });
|
|
26
|
+
child.on('exit', (code) => process.exit(code ?? 0));
|
package/bin/tightknit.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { spawn, execFileSync } from
|
|
3
|
-
import { fileURLToPath } from
|
|
4
|
-
import { dirname, join } from
|
|
5
|
-
import { realpathSync, existsSync } from
|
|
2
|
+
import { spawn, execFileSync } from 'node:child_process';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { dirname, join } from 'node:path';
|
|
5
|
+
import { realpathSync, existsSync } from 'node:fs';
|
|
6
6
|
|
|
7
7
|
// Resolve symlinks to get the actual package directory
|
|
8
8
|
const __filename = realpathSync(fileURLToPath(import.meta.url));
|
|
@@ -12,26 +12,28 @@ const __dirname = dirname(__filename);
|
|
|
12
12
|
function findTsx() {
|
|
13
13
|
let dir = __dirname;
|
|
14
14
|
while (dir !== dirname(dir)) {
|
|
15
|
-
const candidate = join(dir,
|
|
16
|
-
if (existsSync(candidate))
|
|
15
|
+
const candidate = join(dir, 'node_modules', '.bin', 'tsx');
|
|
16
|
+
if (existsSync(candidate)) {
|
|
17
|
+
return candidate;
|
|
18
|
+
}
|
|
17
19
|
dir = dirname(dir);
|
|
18
20
|
}
|
|
19
21
|
// Fallback: assume tsx is on PATH
|
|
20
|
-
return
|
|
22
|
+
return 'tsx';
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
const tsx = findTsx();
|
|
24
26
|
|
|
25
27
|
// If first arg is "mcp", run the MCP server (needs spawn for bidirectional stdio)
|
|
26
|
-
if (process.argv[2] ===
|
|
27
|
-
const script = join(__dirname,
|
|
28
|
-
const child = spawn(tsx, [script], { stdio:
|
|
29
|
-
child.on(
|
|
28
|
+
if (process.argv[2] === 'mcp') {
|
|
29
|
+
const script = join(__dirname, '..', 'src', 'mcp', 'server.ts');
|
|
30
|
+
const child = spawn(tsx, [script], { stdio: 'inherit' });
|
|
31
|
+
child.on('exit', (code) => process.exit(code ?? 0));
|
|
30
32
|
} else {
|
|
31
33
|
// Run the CLI
|
|
32
|
-
const script = join(__dirname,
|
|
34
|
+
const script = join(__dirname, 'tightknit.ts');
|
|
33
35
|
try {
|
|
34
|
-
execFileSync(tsx, [script, ...process.argv.slice(2)], { stdio:
|
|
36
|
+
execFileSync(tsx, [script, ...process.argv.slice(2)], { stdio: 'inherit' });
|
|
35
37
|
} catch (err) {
|
|
36
38
|
process.exit(err.status ?? 1);
|
|
37
39
|
}
|
package/bin/tightknit.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env tsx
|
|
2
|
-
import { createProgram } from
|
|
2
|
+
import { createProgram } from '../src/cli/index';
|
|
3
3
|
|
|
4
4
|
const program = createProgram();
|
|
5
5
|
|
|
6
6
|
// Set version from package.json dynamically
|
|
7
7
|
// Using a static version here to avoid JSON import complexity
|
|
8
|
-
program.version(
|
|
8
|
+
program.version('0.1.0-alpha.0');
|
|
9
9
|
|
|
10
10
|
program.parseAsync(process.argv).catch(() => {
|
|
11
11
|
process.exit(1);
|
package/package.json
CHANGED
package/src/cli/awards/assign.ts
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { Command } from
|
|
2
|
-
import { assignAward } from
|
|
3
|
-
import { printOutput, printSuccess } from
|
|
4
|
-
import { handleCommandError } from
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { assignAward } from '../../core/client';
|
|
3
|
+
import { printOutput, printSuccess } from '../../core/output';
|
|
4
|
+
import { handleCommandError } from '../error-handler';
|
|
5
5
|
|
|
6
|
-
export const assignAwardCommand = new Command(
|
|
7
|
-
.description(
|
|
8
|
-
.argument(
|
|
9
|
-
.requiredOption(
|
|
10
|
-
.option(
|
|
11
|
-
.option(
|
|
12
|
-
.option(
|
|
6
|
+
export const assignAwardCommand = new Command('assign')
|
|
7
|
+
.description('Assign an award to a user')
|
|
8
|
+
.argument('<award-id>', 'Award UUID')
|
|
9
|
+
.requiredOption('--recipient-email <email>', 'Recipient email address')
|
|
10
|
+
.option('--sender-email <email>', 'Sender email address')
|
|
11
|
+
.option('--anonymous', 'Send the award anonymously')
|
|
12
|
+
.option('--json', 'Output as JSON')
|
|
13
13
|
.action(async (awardId: string, opts) => {
|
|
14
14
|
try {
|
|
15
15
|
const result = await assignAward(awardId, {
|
|
16
16
|
recipient: { email: opts.recipientEmail },
|
|
17
17
|
sender: opts.senderEmail ? { email: opts.senderEmail } : undefined,
|
|
18
|
-
send_anonymously: opts.anonymous
|
|
18
|
+
send_anonymously: opts.anonymous
|
|
19
19
|
});
|
|
20
20
|
if (opts.json) {
|
|
21
21
|
printOutput(result, { json: true });
|
|
22
22
|
} else {
|
|
23
|
-
printSuccess(
|
|
23
|
+
printSuccess('Award assigned successfully');
|
|
24
24
|
}
|
|
25
25
|
} catch (error) {
|
|
26
26
|
handleCommandError(error, opts.json);
|
package/src/cli/config/get.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { Command } from
|
|
2
|
-
import { getConfigPath, getConfigValue } from
|
|
3
|
-
import { printOutput } from
|
|
4
|
-
import { handleCommandError } from
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { getConfigPath, getConfigValue } from '../../core/config';
|
|
3
|
+
import { printOutput } from '../../core/output';
|
|
4
|
+
import { handleCommandError } from '../error-handler';
|
|
5
5
|
|
|
6
|
-
export const getConfigCommand = new Command(
|
|
7
|
-
.description(
|
|
8
|
-
.argument(
|
|
9
|
-
.option(
|
|
10
|
-
.option(
|
|
6
|
+
export const getConfigCommand = new Command('get')
|
|
7
|
+
.description('Get a configuration value')
|
|
8
|
+
.argument('<key>', 'Config key (api-key, default-output)')
|
|
9
|
+
.option('--json', 'Output as JSON')
|
|
10
|
+
.option('--show-path', 'Show the config file path')
|
|
11
11
|
.action(async (key: string, opts) => {
|
|
12
12
|
try {
|
|
13
13
|
if (opts.showPath) {
|
|
@@ -15,11 +15,12 @@ export const getConfigCommand = new Command("get")
|
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
17
|
const value = getConfigValue(key);
|
|
18
|
-
const displayValue =
|
|
18
|
+
const displayValue =
|
|
19
|
+
key === 'api-key' && value ? `${value.slice(0, 8)}...` : value;
|
|
19
20
|
if (opts.json) {
|
|
20
21
|
printOutput({ key, value: displayValue }, { json: true });
|
|
21
22
|
} else {
|
|
22
|
-
console.log(displayValue ||
|
|
23
|
+
console.log(displayValue || '(not set)');
|
|
23
24
|
}
|
|
24
25
|
} catch (error) {
|
|
25
26
|
handleCommandError(error, opts.json);
|
package/src/cli/config/set.ts
CHANGED
|
@@ -1,20 +1,26 @@
|
|
|
1
|
-
import { Command } from
|
|
2
|
-
import { setConfigValue } from
|
|
3
|
-
import { printSuccess } from
|
|
4
|
-
import { handleCommandError } from
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { setConfigValue } from '../../core/config';
|
|
3
|
+
import { printSuccess } from '../../core/output';
|
|
4
|
+
import { handleCommandError } from '../error-handler';
|
|
5
5
|
|
|
6
|
-
export const setConfigCommand = new Command(
|
|
7
|
-
.description(
|
|
8
|
-
.argument(
|
|
9
|
-
.argument(
|
|
10
|
-
.option(
|
|
6
|
+
export const setConfigCommand = new Command('set')
|
|
7
|
+
.description('Set a configuration value')
|
|
8
|
+
.argument('<key>', 'Config key (api-key, default-output)')
|
|
9
|
+
.argument('<value>', 'Config value')
|
|
10
|
+
.option('--json', 'Output as JSON')
|
|
11
11
|
.action(async (key: string, value: string, opts) => {
|
|
12
12
|
try {
|
|
13
13
|
setConfigValue(key, value);
|
|
14
14
|
if (opts.json) {
|
|
15
|
-
console.log(
|
|
15
|
+
console.log(
|
|
16
|
+
JSON.stringify(
|
|
17
|
+
{ success: true, key, value: key === 'api-key' ? '***' : value },
|
|
18
|
+
null,
|
|
19
|
+
2
|
|
20
|
+
)
|
|
21
|
+
);
|
|
16
22
|
} else {
|
|
17
|
-
const displayValue = key ===
|
|
23
|
+
const displayValue = key === 'api-key' ? '***' : value;
|
|
18
24
|
printSuccess(`Set ${key} = ${displayValue}`);
|
|
19
25
|
}
|
|
20
26
|
} catch (error) {
|
package/src/cli/error-handler.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TightknitApiError } from
|
|
2
|
-
import { printError } from
|
|
1
|
+
import { TightknitApiError } from '../core/client';
|
|
2
|
+
import { printError } from '../core/output';
|
|
3
3
|
|
|
4
4
|
/** Handle errors in CLI commands with consistent formatting */
|
|
5
5
|
export function handleCommandError(error: unknown, json?: boolean): never {
|
|
@@ -14,13 +14,15 @@ export function handleCommandError(error: unknown, json?: boolean): never {
|
|
|
14
14
|
|
|
15
15
|
if (error instanceof Error) {
|
|
16
16
|
if (json) {
|
|
17
|
-
console.error(
|
|
17
|
+
console.error(
|
|
18
|
+
JSON.stringify({ error: true, message: error.message }, null, 2)
|
|
19
|
+
);
|
|
18
20
|
} else {
|
|
19
21
|
printError(error.message);
|
|
20
22
|
}
|
|
21
23
|
process.exit(1);
|
|
22
24
|
}
|
|
23
25
|
|
|
24
|
-
printError(
|
|
26
|
+
printError('An unknown error occurred');
|
|
25
27
|
process.exit(1);
|
|
26
28
|
}
|
package/src/cli/events/create.ts
CHANGED
|
@@ -1,23 +1,27 @@
|
|
|
1
|
-
import { Command } from
|
|
2
|
-
import { createEvent } from
|
|
3
|
-
import { printOutput, printSuccess } from
|
|
4
|
-
import { handleCommandError } from
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { createEvent } from '../../core/client';
|
|
3
|
+
import { printOutput, printSuccess } from '../../core/output';
|
|
4
|
+
import { handleCommandError } from '../error-handler';
|
|
5
5
|
|
|
6
|
-
export const createEventCommand = new Command(
|
|
7
|
-
.description(
|
|
8
|
-
.requiredOption(
|
|
9
|
-
.requiredOption(
|
|
10
|
-
.requiredOption(
|
|
11
|
-
.requiredOption(
|
|
12
|
-
.option(
|
|
13
|
-
.option(
|
|
14
|
-
.option(
|
|
15
|
-
.option(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
.option(
|
|
6
|
+
export const createEventCommand = new Command('create')
|
|
7
|
+
.description('Create a new calendar event')
|
|
8
|
+
.requiredOption('--title <title>', 'Event title (3-70 chars)')
|
|
9
|
+
.requiredOption('--description <text>', 'Event description')
|
|
10
|
+
.requiredOption('--start-date <datetime>', 'Start date/time (ISO 8601)')
|
|
11
|
+
.requiredOption('--end-date <datetime>', 'End date/time (ISO 8601)')
|
|
12
|
+
.option('--location <location>', 'Event location')
|
|
13
|
+
.option('--link <url>', 'Event link/URL')
|
|
14
|
+
.option('--slug <slug>', 'URL slug (3-70 chars)')
|
|
15
|
+
.option(
|
|
16
|
+
'--status <status>',
|
|
17
|
+
'Status: needs_approval or published',
|
|
18
|
+
'published'
|
|
19
|
+
)
|
|
20
|
+
.option('--publish-to-site', 'Publish to companion site')
|
|
21
|
+
.option('--no-publish-to-site', 'Do not publish to companion site')
|
|
22
|
+
.option('--enable-registration', 'Enable registration button')
|
|
23
|
+
.option('--triggers-webhooks', 'Trigger webhooks on creation')
|
|
24
|
+
.option('--json', 'Output as JSON')
|
|
21
25
|
.action(async (opts) => {
|
|
22
26
|
try {
|
|
23
27
|
const result = await createEvent({
|
|
@@ -31,7 +35,7 @@ export const createEventCommand = new Command("create")
|
|
|
31
35
|
status: opts.status,
|
|
32
36
|
publish_to_site: opts.publishToSite,
|
|
33
37
|
enable_registration_button: opts.enableRegistration,
|
|
34
|
-
triggers_webhooks: opts.triggersWebhooks
|
|
38
|
+
triggers_webhooks: opts.triggersWebhooks
|
|
35
39
|
});
|
|
36
40
|
if (opts.json) {
|
|
37
41
|
printOutput(result, { json: true });
|
package/src/cli/events/delete.ts
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import { Command } from
|
|
2
|
-
import { deleteEvent } from
|
|
3
|
-
import { printSuccess } from
|
|
4
|
-
import { handleCommandError } from
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { deleteEvent } from '../../core/client';
|
|
3
|
+
import { printSuccess } from '../../core/output';
|
|
4
|
+
import { handleCommandError } from '../error-handler';
|
|
5
5
|
|
|
6
|
-
export const deleteEventCommand = new Command(
|
|
7
|
-
.description(
|
|
8
|
-
.argument(
|
|
9
|
-
.option(
|
|
6
|
+
export const deleteEventCommand = new Command('delete')
|
|
7
|
+
.description('Delete a calendar event')
|
|
8
|
+
.argument('<id>', 'Event ID')
|
|
9
|
+
.option('--json', 'Output as JSON')
|
|
10
10
|
.action(async (id: string, opts) => {
|
|
11
11
|
try {
|
|
12
12
|
await deleteEvent(id);
|
|
13
13
|
if (opts.json) {
|
|
14
|
-
console.log(
|
|
14
|
+
console.log(
|
|
15
|
+
JSON.stringify({ success: true, message: 'Event deleted' }, null, 2)
|
|
16
|
+
);
|
|
15
17
|
} else {
|
|
16
|
-
printSuccess(
|
|
18
|
+
printSuccess('Event deleted successfully');
|
|
17
19
|
}
|
|
18
20
|
} catch (error) {
|
|
19
21
|
handleCommandError(error, opts.json);
|
package/src/cli/events/get.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Command } from
|
|
2
|
-
import { getEvent } from
|
|
3
|
-
import { printOutput } from
|
|
4
|
-
import { handleCommandError } from
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { getEvent } from '../../core/client';
|
|
3
|
+
import { printOutput } from '../../core/output';
|
|
4
|
+
import { handleCommandError } from '../error-handler';
|
|
5
5
|
|
|
6
|
-
export const getEventCommand = new Command(
|
|
7
|
-
.description(
|
|
8
|
-
.argument(
|
|
9
|
-
.option(
|
|
6
|
+
export const getEventCommand = new Command('get')
|
|
7
|
+
.description('Get a calendar event by ID')
|
|
8
|
+
.argument('<id>', 'Event ID')
|
|
9
|
+
.option('--json', 'Output as JSON')
|
|
10
10
|
.action(async (id: string, opts) => {
|
|
11
11
|
try {
|
|
12
12
|
const result = await getEvent(id);
|
package/src/cli/events/list.ts
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import { Command } from
|
|
2
|
-
import { listEvents } from
|
|
3
|
-
import { printOutput } from
|
|
4
|
-
import { handleCommandError } from
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { listEvents } from '../../core/client';
|
|
3
|
+
import { printOutput } from '../../core/output';
|
|
4
|
+
import { handleCommandError } from '../error-handler';
|
|
5
5
|
|
|
6
|
-
export const listEventsCommand = new Command(
|
|
7
|
-
.description(
|
|
8
|
-
.option(
|
|
9
|
-
.option(
|
|
10
|
-
.option(
|
|
11
|
-
.option(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
export const listEventsCommand = new Command('list')
|
|
7
|
+
.description('List calendar events')
|
|
8
|
+
.option('--page <number>', 'Page number (0-indexed)', '0')
|
|
9
|
+
.option('--per-page <number>', 'Records per page', '25')
|
|
10
|
+
.option('--time-filter <filter>', 'Filter by time: upcoming or past')
|
|
11
|
+
.option(
|
|
12
|
+
'--status <status>',
|
|
13
|
+
'Filter by status: draft, needs_approval, published'
|
|
14
|
+
)
|
|
15
|
+
.option('--feed-id <id>', 'Filter by feed ID')
|
|
16
|
+
.option('--tag-ids <ids>', 'Comma-separated tag UUIDs')
|
|
17
|
+
.option('--json', 'Output as JSON')
|
|
15
18
|
.action(async (opts) => {
|
|
16
19
|
try {
|
|
17
20
|
const result = await listEvents({
|
|
@@ -20,7 +23,7 @@ export const listEventsCommand = new Command("list")
|
|
|
20
23
|
time_filter: opts.timeFilter,
|
|
21
24
|
status: opts.status,
|
|
22
25
|
feed_id: opts.feedId,
|
|
23
|
-
tag_ids: opts.tagIds
|
|
26
|
+
tag_ids: opts.tagIds
|
|
24
27
|
});
|
|
25
28
|
printOutput(result.data, { json: opts.json });
|
|
26
29
|
} catch (error) {
|
package/src/cli/events/update.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { Command } from
|
|
2
|
-
import { updateAttendee } from
|
|
3
|
-
import { printOutput, printSuccess } from
|
|
4
|
-
import { handleCommandError } from
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { updateAttendee } from '../../core/client';
|
|
3
|
+
import { printOutput, printSuccess } from '../../core/output';
|
|
4
|
+
import { handleCommandError } from '../error-handler';
|
|
5
5
|
|
|
6
|
-
export const updateAttendeeCommand = new Command(
|
|
7
|
-
.description(
|
|
8
|
-
.argument(
|
|
9
|
-
.requiredOption(
|
|
10
|
-
.option(
|
|
11
|
-
.option(
|
|
6
|
+
export const updateAttendeeCommand = new Command('update-attendee')
|
|
7
|
+
.description('Update a calendar event attendee')
|
|
8
|
+
.argument('<event-id>', 'Calendar event ID')
|
|
9
|
+
.requiredOption('--email <email>', 'Attendee email (user identifier)')
|
|
10
|
+
.option('--personal-join-link <url>', 'Personal join link for the attendee')
|
|
11
|
+
.option('--json', 'Output as JSON')
|
|
12
12
|
.action(async (eventId: string, opts) => {
|
|
13
13
|
try {
|
|
14
14
|
const result = await updateAttendee(eventId, {
|
|
15
15
|
user: { email: opts.email },
|
|
16
|
-
personal_join_link: opts.personalJoinLink
|
|
16
|
+
personal_join_link: opts.personalJoinLink
|
|
17
17
|
});
|
|
18
18
|
if (opts.json) {
|
|
19
19
|
printOutput(result, { json: true });
|
|
20
20
|
} else {
|
|
21
|
-
printSuccess(
|
|
21
|
+
printSuccess('Attendee updated successfully');
|
|
22
22
|
printOutput(result, {});
|
|
23
23
|
}
|
|
24
24
|
} catch (error) {
|
package/src/cli/feeds/get.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Command } from
|
|
2
|
-
import { getFeed } from
|
|
3
|
-
import { printOutput } from
|
|
4
|
-
import { handleCommandError } from
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { getFeed } from '../../core/client';
|
|
3
|
+
import { printOutput } from '../../core/output';
|
|
4
|
+
import { handleCommandError } from '../error-handler';
|
|
5
5
|
|
|
6
|
-
export const getFeedCommand = new Command(
|
|
7
|
-
.description(
|
|
8
|
-
.argument(
|
|
9
|
-
.option(
|
|
6
|
+
export const getFeedCommand = new Command('get')
|
|
7
|
+
.description('Retrieve a feed by ID')
|
|
8
|
+
.argument('<feed-id>', 'Feed ID')
|
|
9
|
+
.option('--json', 'Output as JSON')
|
|
10
10
|
.action(async (feedId: string, opts) => {
|
|
11
11
|
try {
|
|
12
12
|
const result = await getFeed(feedId);
|
package/src/cli/feeds/list.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { Command } from
|
|
2
|
-
import { listFeeds } from
|
|
3
|
-
import { printOutput } from
|
|
4
|
-
import { handleCommandError } from
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { listFeeds } from '../../core/client';
|
|
3
|
+
import { printOutput } from '../../core/output';
|
|
4
|
+
import { handleCommandError } from '../error-handler';
|
|
5
5
|
|
|
6
|
-
export const listFeedsCommand = new Command(
|
|
7
|
-
.description(
|
|
8
|
-
.option(
|
|
9
|
-
.option(
|
|
10
|
-
.option(
|
|
11
|
-
.option(
|
|
12
|
-
.option(
|
|
6
|
+
export const listFeedsCommand = new Command('list')
|
|
7
|
+
.description('List feeds')
|
|
8
|
+
.option('--page <number>', 'Page number (0-indexed)', '0')
|
|
9
|
+
.option('--per-page <number>', 'Records per page', '25')
|
|
10
|
+
.option('--is-unlisted', 'Filter to unlisted feeds only')
|
|
11
|
+
.option('--is-archived', 'Filter to archived feeds only')
|
|
12
|
+
.option('--json', 'Output as JSON')
|
|
13
13
|
.action(async (opts) => {
|
|
14
14
|
try {
|
|
15
15
|
const result = await listFeeds({
|
|
16
16
|
page: Number(opts.page),
|
|
17
17
|
per_page: Number(opts.perPage),
|
|
18
18
|
is_unlisted: opts.isUnlisted,
|
|
19
|
-
is_archived: opts.isArchived
|
|
19
|
+
is_archived: opts.isArchived
|
|
20
20
|
});
|
|
21
21
|
printOutput(result.data, { json: opts.json });
|
|
22
22
|
} catch (error) {
|
package/src/cli/feeds/posts.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { Command } from
|
|
2
|
-
import { listPostsInFeed } from
|
|
3
|
-
import { printOutput } from
|
|
4
|
-
import { handleCommandError } from
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { listPostsInFeed } from '../../core/client';
|
|
3
|
+
import { printOutput } from '../../core/output';
|
|
4
|
+
import { handleCommandError } from '../error-handler';
|
|
5
5
|
|
|
6
|
-
export const listPostsInFeedCommand = new Command(
|
|
7
|
-
.description(
|
|
8
|
-
.argument(
|
|
9
|
-
.option(
|
|
10
|
-
.option(
|
|
11
|
-
.option(
|
|
12
|
-
.option(
|
|
6
|
+
export const listPostsInFeedCommand = new Command('posts')
|
|
7
|
+
.description('List posts in a feed')
|
|
8
|
+
.argument('<feed-id>', 'Feed ID or "home" for the Home feed')
|
|
9
|
+
.option('--page <number>', 'Page number (0-indexed)', '0')
|
|
10
|
+
.option('--per-page <number>', 'Records per page', '25')
|
|
11
|
+
.option('--sort <method>', 'Sort: oldest, newest, most-recent-activity')
|
|
12
|
+
.option('--json', 'Output as JSON')
|
|
13
13
|
.action(async (feedId: string, opts) => {
|
|
14
14
|
try {
|
|
15
15
|
const result = await listPostsInFeed(feedId, {
|
|
16
16
|
page: Number(opts.page),
|
|
17
17
|
per_page: Number(opts.perPage),
|
|
18
|
-
sort: opts.sort
|
|
18
|
+
sort: opts.sort
|
|
19
19
|
});
|
|
20
20
|
printOutput(result.data, { json: opts.json });
|
|
21
21
|
} catch (error) {
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { Command } from
|
|
2
|
-
import { addUserToGroup } from
|
|
3
|
-
import { printOutput, printSuccess } from
|
|
4
|
-
import { handleCommandError } from
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { addUserToGroup } from '../../core/client';
|
|
3
|
+
import { printOutput, printSuccess } from '../../core/output';
|
|
4
|
+
import { handleCommandError } from '../error-handler';
|
|
5
5
|
|
|
6
|
-
export const addGroupMemberCommand = new Command(
|
|
7
|
-
.description(
|
|
8
|
-
.argument(
|
|
9
|
-
.requiredOption(
|
|
10
|
-
.option(
|
|
6
|
+
export const addGroupMemberCommand = new Command('add-member')
|
|
7
|
+
.description('Add a user to a group')
|
|
8
|
+
.argument('<group-id>', 'Group ID')
|
|
9
|
+
.requiredOption('--email <email>', 'User email address')
|
|
10
|
+
.option('--json', 'Output as JSON')
|
|
11
11
|
.action(async (groupId: string, opts) => {
|
|
12
12
|
try {
|
|
13
13
|
const result = await addUserToGroup(groupId, {
|
|
14
|
-
user: { email: opts.email }
|
|
14
|
+
user: { email: opts.email }
|
|
15
15
|
});
|
|
16
16
|
if (opts.json) {
|
|
17
17
|
printOutput(result, { json: true });
|
|
18
18
|
} else {
|
|
19
|
-
printSuccess(
|
|
19
|
+
printSuccess('User added to group');
|
|
20
20
|
}
|
|
21
21
|
} catch (error) {
|
|
22
22
|
handleCommandError(error, opts.json);
|