@verbatims/cli 0.1.15 → 0.1.16

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/README.md CHANGED
@@ -19,6 +19,13 @@ verbatims config
19
19
  # List quotes
20
20
  verbatims quotes list --language fr --limit 10
21
21
 
22
+ # Filter quotes by reference and inspect provenance
23
+ verbatims quotes list --reference 42
24
+ verbatims quotes get 123 --format json
25
+
26
+ # Create a quote with a source
27
+ verbatims quotes create --source-type book --source-url https://example.com/edition
28
+
22
29
  # Browse interactively
23
30
  verbatims quotes browse
24
31
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verbatims/cli",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "description": "CLI for the Verbatims quotes API",
5
5
  "type": "module",
6
6
  "bin": {
@@ -19,6 +19,7 @@ export function registerQuotesCommand(program: Command) {
19
19
  .option('--language <lang>', 'Filter by language')
20
20
  .option('--limit <n>', 'Number of results', '20')
21
21
  .option('--author <id>', 'Filter by author ID')
22
+ .option('--reference <id>', 'Filter by reference ID')
22
23
  .option('--tag <name>', 'Filter by tag')
23
24
  .option('--search <q>', 'Search in quote text')
24
25
  .option('--status <status>', 'Filter by status (draft|pending|approved|rejected)')
@@ -33,6 +34,7 @@ export function registerQuotesCommand(program: Command) {
33
34
  language: options.language,
34
35
  limit: Number(options.limit),
35
36
  author_id: options.author ? Number(options.author) : undefined,
37
+ reference_id: options.reference ? Number(options.reference) : undefined,
36
38
  tag: options.tag,
37
39
  search: options.search,
38
40
  q: options.search,
@@ -66,6 +68,8 @@ export function registerQuotesCommand(program: Command) {
66
68
  .option('--language <lang>', 'Language')
67
69
  .option('--author-id <id>', 'Author ID')
68
70
  .option('--reference-id <id>', 'Reference ID')
71
+ .option('--source-type <type>', 'Source type')
72
+ .option('--source-url <url>', 'Source URL')
69
73
  .action(async (options: Record<string, string>) => {
70
74
  const client = await getClient()
71
75
  const format = getFormat(program)
@@ -80,7 +84,7 @@ export function registerQuotesCommand(program: Command) {
80
84
  const referenceId = options.referenceId ? Number(options.referenceId) : undefined
81
85
 
82
86
  const { data } = await withSpinner('Creating quote', () =>
83
- client.quotes.create({ content: name as string, name: name as string, language: language as string, author_id: authorId, reference_id: referenceId }),
87
+ client.quotes.create({ content: name as string, name: name as string, language: language as string, author_id: authorId, reference_id: referenceId, source_type: options.sourceType, source_url: options.sourceUrl }),
84
88
  format,
85
89
  )
86
90
  console.log(chalk.green(' Quote created'))
@@ -94,6 +98,8 @@ export function registerQuotesCommand(program: Command) {
94
98
  .option('--language <lang>', 'Language')
95
99
  .option('--author-id <id>', 'Author ID')
96
100
  .option('--reference-id <id>', 'Reference ID')
101
+ .option('--source-type <type>', 'Source type')
102
+ .option('--source-url <url>', 'Source URL')
97
103
  .action(async (id: string, options: Record<string, string>) => {
98
104
  const client = await getClient()
99
105
  const format = getFormat(program)
@@ -103,6 +109,8 @@ export function registerQuotesCommand(program: Command) {
103
109
  if (options.language) data_.language = options.language
104
110
  if (options.authorId !== undefined) data_.author_id = options.authorId === 'null' ? null : Number(options.authorId)
105
111
  if (options.referenceId !== undefined) data_.reference_id = options.referenceId === 'null' ? null : Number(options.referenceId)
112
+ if (options.sourceType !== undefined) data_.source_type = options.sourceType
113
+ if (options.sourceUrl !== undefined) data_.source_url = options.sourceUrl
106
114
 
107
115
  const { data } = await withSpinner('Updating quote', () => client.quotes.update(Number(id), data_ as any), format)
108
116
  console.log(chalk.green(' Quote updated'))
@@ -172,6 +180,7 @@ export function registerQuotesCommand(program: Command) {
172
180
  .description('Browse quotes interactively')
173
181
  .option('--language <lang>', 'Filter by language')
174
182
  .option('--author <id>', 'Filter by author ID')
183
+ .option('--reference <id>', 'Filter by reference ID')
175
184
  .option('--tag <name>', 'Filter by tag')
176
185
  .option('--search <q>', 'Search in quote text')
177
186
  .option('--status <status>', 'Filter by status (draft|pending|approved|rejected)')
@@ -185,6 +194,7 @@ export function registerQuotesCommand(program: Command) {
185
194
  page,
186
195
  language: options.language,
187
196
  author_id: options.author ? Number(options.author) : undefined,
197
+ reference_id: options.reference ? Number(options.reference) : undefined,
188
198
  tag: options.tag,
189
199
  search: options.search,
190
200
  q: options.search,
@@ -32,7 +32,7 @@ export async function browse(fetchPage: PageFetcher, format: Format): Promise<vo
32
32
  }
33
33
 
34
34
  const allKeys = Object.keys(items[0] as Record<string, unknown>)
35
- const keyOrder = ['id', 'content', 'name', 'language', 'type', 'author', 'reference', 'quotes_count']
35
+ const keyOrder = ['id', 'content', 'name', 'language', 'type', 'author', 'reference', 'source', 'attributions', 'sources', 'quotes_count']
36
36
  const columns = keyOrder
37
37
  .filter((k) => allKeys.includes(k))
38
38
  .map((k) => ({ key: k, label: k }))
@@ -137,7 +137,7 @@ export function output(data: unknown, format: Format): void {
137
137
  }
138
138
 
139
139
  const allKeys = Object.keys(data[0] as Record<string, unknown>)
140
- const keyOrder = ['id', 'content', 'name', 'language', 'type', 'author', 'reference', 'quotes_count', 'platform', 'label', 'enabled', 'status', 'position', 'quote_text', 'quote_language', 'author_name', 'reference_name', 'post_text', 'post_url', 'posted_at', 'error_message']
140
+ const keyOrder = ['id', 'content', 'name', 'language', 'type', 'author', 'reference', 'source', 'attributions', 'sources', 'quotes_count', 'platform', 'label', 'enabled', 'status', 'position', 'quote_text', 'quote_language', 'author_name', 'reference_name', 'post_text', 'post_url', 'posted_at', 'error_message']
141
141
  const columns = keyOrder
142
142
  .filter((k) => allKeys.includes(k))
143
143
  .map((k) => ({ key: k, label: k }))