@clickminded/coauthor-cli 0.0.28 → 0.0.29

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/dist/commands.js CHANGED
@@ -244,6 +244,17 @@ async function runProjectCommand(action, input, client) {
244
244
  const data = await client.request({ method: 'POST', path: `projects/${encodeURIComponent(projectId)}/rename`, body: { title } });
245
245
  return { ok: true, message: `Renamed to "${title.trim()}".`, data };
246
246
  }
247
+ if (action === 'duplicate') {
248
+ const projectId = requireProjectId(input);
249
+ const title = getString(input.values, 'title');
250
+ const data = await client.request({
251
+ method: 'POST',
252
+ path: `projects/${encodeURIComponent(projectId)}/duplicate`,
253
+ body: title !== undefined && title.trim() ? { title } : {},
254
+ });
255
+ const newId = data.project?.id;
256
+ return { ok: true, message: newId ? `Duplicated project ${projectId} as ${newId}${data.project?.title ? ` ("${data.project.title}")` : ''}.` : `Duplicated project ${projectId}.`, data };
257
+ }
247
258
  if (action === 'delete') {
248
259
  const projectId = requireProjectId(input);
249
260
  if (!getBoolean(input.values, 'yes')) {
@@ -252,7 +263,7 @@ async function runProjectCommand(action, input, client) {
252
263
  const data = await client.request({ method: 'DELETE', path: `projects/${encodeURIComponent(projectId)}` });
253
264
  return { ok: true, message: `Deleted project ${projectId}.`, data };
254
265
  }
255
- throw new Error('Usage: coauthor project <create|list|show|rename|delete>');
266
+ throw new Error('Usage: coauthor project <create|list|show|rename|delete|duplicate>');
256
267
  }
257
268
  async function runWorkspaceCommand(action, input, client) {
258
269
  if (action !== 'show')
@@ -1838,7 +1849,7 @@ export function helpResult(command = []) {
1838
1849
  '',
1839
1850
  'Commands:',
1840
1851
  ' auth login|status|logout (logout supports --local-only)',
1841
- ' project create|list|show|rename|delete',
1852
+ ' project create|list|show|rename|delete|duplicate',
1842
1853
  ' workspace show',
1843
1854
  ' chat [show|list]',
1844
1855
  ' contract show|save|approve',
@@ -1879,6 +1890,11 @@ function commandHelp(command) {
1879
1890
  'Revokes the remote token before removing local credentials. If revocation cannot be confirmed, the token is kept locally so the command can be retried.',
1880
1891
  '--local-only removes the local credential without revoking the remote token. Use it only when explicitly abandoning remote revocation.',
1881
1892
  ].join('\n'),
1893
+ 'project duplicate': [
1894
+ 'Usage: coauthor project duplicate <project-id> [--title "..."] [--json]',
1895
+ '',
1896
+ 'Copies the brief, outline, research, chats, draft, images and repurposed posts into a new project that keeps the same profile. The default title is "<title> (Copy)". Prints the new project id.',
1897
+ ].join('\n'),
1882
1898
  'project create': [
1883
1899
  'Usage: coauthor project create [--title <title>] [--topic <brief>] [--audience <audience>] [--contract <json>] [--profile <profile-id>] [--json]',
1884
1900
  '',
@@ -1923,9 +1939,10 @@ function commandHelp(command) {
1923
1939
  DRAFT_SAVE_SHAPE,
1924
1940
  ].join('\n'),
1925
1941
  project: [
1926
- 'Usage: coauthor project <create|list|show|rename|delete> [<project-id>] [--title "..."] [--yes] [--json]',
1942
+ 'Usage: coauthor project <create|list|show|rename|delete|duplicate> [<project-id>] [--title "..."] [--yes] [--json]',
1927
1943
  '',
1928
1944
  'create: --title, --topic, --audience, --contract <json|@file>. list: --limit. show: one project.',
1945
+ 'duplicate <project-id> [--title "..."]: copies the brief, outline, research, chats, draft, images and repurposed posts into a new project that keeps the same profile (default title is "<title> (Copy)"). Prints the new project id.',
1929
1946
  ].join('\n'),
1930
1947
  profile: [
1931
1948
  'Usage: coauthor profile list [--json]',
package/dist/parser.js CHANGED
@@ -142,7 +142,7 @@ function commandLength(positionals) {
142
142
  if (first === 'auth')
143
143
  return second && ['login', 'status', 'logout'].includes(second) ? 2 : 1;
144
144
  if (first === 'project')
145
- return second && ['create', 'list', 'show', 'rename', 'delete'].includes(second) ? 2 : 1;
145
+ return second && ['create', 'list', 'show', 'rename', 'delete', 'duplicate'].includes(second) ? 2 : 1;
146
146
  if (first === 'workspace')
147
147
  return second === 'show' ? 2 : 1;
148
148
  if (first === 'chat')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clickminded/coauthor-cli",
3
- "version": "0.0.28",
3
+ "version": "0.0.29",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "coauthor": "dist/index.js",
@@ -62,7 +62,7 @@ Everything else, including auth problems: `references/troubleshooting.md`. Credi
62
62
 
63
63
  ## Housekeeping
64
64
 
65
- `coauthor project rename <id> --title "..."` renames a project. `coauthor project delete <id> --yes` deletes it permanently, so only do it when the user asks, or for a test project you created yourself.
65
+ `coauthor project rename <id> --title "..."` renames a project. `coauthor project duplicate <id> [--title "..."]` copies it with its brief, outline, research, draft, images, and posts (keeping its profile), for example to try a different angle without losing the original. `coauthor project delete <id> --yes` deletes it permanently, so only do it when the user asks, or for a test project you created yourself.
66
66
 
67
67
  ## Not in the CLI yet
68
68
 
@@ -64,7 +64,7 @@ Everything else, including auth problems: `references/troubleshooting.md`. Credi
64
64
 
65
65
  ## Housekeeping
66
66
 
67
- `coauthor project rename <id> --title "..."` renames a project. `coauthor project delete <id> --yes` deletes it permanently, so only do it when the user asks, or for a test project you created yourself.
67
+ `coauthor project rename <id> --title "..."` renames a project. `coauthor project duplicate <id> [--title "..."]` copies it with its brief, outline, research, draft, images, and posts (keeping its profile), for example to try a different angle without losing the original. `coauthor project delete <id> --yes` deletes it permanently, so only do it when the user asks, or for a test project you created yourself.
68
68
 
69
69
  ## Not in the CLI yet
70
70