@startanaicompany/crm 2.5.0 → 2.5.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.
Files changed (2) hide show
  1. package/index.js +95 -0
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -276,6 +276,9 @@ workspaceCmd
276
276
  .requiredOption('--name <keyname>', 'Name/label for the initial API key')
277
277
  .option('--scope <scope>', 'Key scope: agent (default) or admin', 'agent')
278
278
  .option('--admin-password <password>', 'Admin password (required for scope=admin; will prompt if not provided)')
279
+ .option('--owner-email <email>', 'Owner email — creates a human login account for /workspaces/login')
280
+ .option('--owner-password <password>', 'Owner password (min 8 chars) — required if --owner-email is provided')
281
+ .option('--owner-name <name>', 'Owner display name (default: Owner)')
279
282
  .option('--save-key', 'Save the returned key to CLI config (default: true)', true)
280
283
  .action(async (opts) => {
281
284
  const globalOpts = program.opts();
@@ -299,6 +302,17 @@ workspaceCmd
299
302
  body.admin_password = adminPw;
300
303
  }
301
304
 
305
+ // BUG-S9-B fix: pass owner credentials so /workspaces/login works immediately
306
+ if (opts.ownerEmail) {
307
+ if (!opts.ownerPassword) {
308
+ console.error('Error: --owner-password is required when --owner-email is provided');
309
+ process.exit(1);
310
+ }
311
+ body.owner_email = opts.ownerEmail.trim().toLowerCase();
312
+ body.owner_password = opts.ownerPassword;
313
+ if (opts.ownerName) body.owner_name = opts.ownerName.trim();
314
+ }
315
+
302
316
  try {
303
317
  const res = await axios.post(
304
318
  `${apiUrl.replace(/\/$/, '')}/api/v1/workspaces/register`,
@@ -308,6 +322,9 @@ workspaceCmd
308
322
  const data = res.data.data;
309
323
  console.log(`Workspace '${data.workspace}' initialized. API key created.`);
310
324
  console.log('Store the key — it will not be shown again.');
325
+ if (data.owner_user) {
326
+ console.log(`Owner user created: ${data.owner_user.email} — use POST /api/v1/workspaces/login to get a JWT.`);
327
+ }
311
328
  printJSON(data);
312
329
 
313
330
  // Auto-save to config
@@ -2131,4 +2148,82 @@ program
2131
2148
  }
2132
2149
  });
2133
2150
 
2151
+ // ============================================================
2152
+ // SUPPORT commands — Sprint 10 (saac_crm support bugs|features ...)
2153
+ // ============================================================
2154
+ const supportCmd = program.command('support').description('Submit and manage bug reports and feature requests');
2155
+
2156
+ ['bugs', 'features'].forEach((type) => {
2157
+ const typeCmd = supportCmd.command(type).description(`Manage ${type} support tickets`);
2158
+ const singular = type === 'bugs' ? 'bug' : 'feature';
2159
+
2160
+ typeCmd
2161
+ .command('add')
2162
+ .description(`Submit a new ${singular} report`)
2163
+ .requiredOption('--title <title>', `${singular} title (max 200 chars)`)
2164
+ .requiredOption('--description <desc>', 'Full description (max 2000 chars)')
2165
+ .action(async (opts) => {
2166
+ const globalOpts = program.opts();
2167
+ const client = getClient(globalOpts);
2168
+ try {
2169
+ const res = await client.post(`/support/${type}`, {
2170
+ title: opts.title,
2171
+ description: opts.description
2172
+ });
2173
+ console.log(`${singular.charAt(0).toUpperCase() + singular.slice(1)} submitted. ID: ${res.data.data.id}`);
2174
+ printJSON(res.data);
2175
+ } catch (err) {
2176
+ handleError(err);
2177
+ }
2178
+ });
2179
+
2180
+ typeCmd
2181
+ .command('list')
2182
+ .description(`List your workspace's ${type}`)
2183
+ .action(async () => {
2184
+ const globalOpts = program.opts();
2185
+ const client = getClient(globalOpts);
2186
+ try {
2187
+ const res = await client.get(`/support/${type}`);
2188
+ printJSON(res.data);
2189
+ } catch (err) {
2190
+ handleError(err);
2191
+ }
2192
+ });
2193
+
2194
+ typeCmd
2195
+ .command('get')
2196
+ .description(`Get a ${singular} ticket by ID`)
2197
+ .requiredOption('--id <id>', 'Ticket ID')
2198
+ .action(async (opts) => {
2199
+ const globalOpts = program.opts();
2200
+ const client = getClient(globalOpts);
2201
+ try {
2202
+ const res = await client.get(`/support/${type}/${opts.id}`);
2203
+ printJSON(res.data);
2204
+ } catch (err) {
2205
+ handleError(err);
2206
+ }
2207
+ });
2208
+
2209
+ typeCmd
2210
+ .command('comment')
2211
+ .description(`Add a comment to your own ${singular} ticket`)
2212
+ .requiredOption('--id <id>', 'Ticket ID')
2213
+ .requiredOption('--message <msg>', 'Comment message (max 2000 chars)')
2214
+ .action(async (opts) => {
2215
+ const globalOpts = program.opts();
2216
+ const client = getClient(globalOpts);
2217
+ try {
2218
+ const res = await client.post(`/support/${type}/${opts.id}/comments`, {
2219
+ message: opts.message
2220
+ });
2221
+ console.log('Comment added.');
2222
+ printJSON(res.data);
2223
+ } catch (err) {
2224
+ handleError(err);
2225
+ }
2226
+ });
2227
+ });
2228
+
2134
2229
  program.parse(process.argv);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@startanaicompany/crm",
3
- "version": "2.5.0",
3
+ "version": "2.5.1",
4
4
  "description": "AI-first CRM CLI \u2014 manage leads and API keys from the terminal",
5
5
  "main": "index.js",
6
6
  "bin": {