gipity 1.1.23 → 1.1.24

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.
@@ -48,17 +48,21 @@ recordsCommand
48
48
  }));
49
49
  recordsCommand
50
50
  .command('config <table>')
51
- .description('Show or set a table\'s Records API config (auth level, search, etc.)')
52
- .addOption(new Option('--auth <level>', 'Auth level: public (anonymous writes), member (sign-in), or user').choices(['public', 'member', 'user']))
51
+ .description('Show or set a table\'s Records API config (auth level, search, auto-numbering, etc.)')
52
+ .addOption(new Option('--auth <level>', 'Auth level: public (anonymous writes), user (any signed-in caller), or member (owner and project members only)').choices(['public', 'member', 'user']))
53
53
  .option('--searchable <bool>', 'Enable full-text search (true/false)')
54
54
  .option('--primary-key <col>', 'Primary key column (default: id)')
55
55
  .option('--soft-delete <col>', 'Soft-delete column (pass "none" to clear)')
56
+ .option('--auto-number <prefix>', 'Number new records automatically, e.g. INC -> INC0001001 (pass "none" to turn off). Same as auto_number in gipity.yaml')
57
+ .option('--auto-number-pad <n>', 'Zero-pad width of the auto-number (default 7)')
58
+ .option('--auto-number-column <col>', 'Column the auto-number is written to (default: number)')
56
59
  .option('--json', 'Output as JSON')
57
60
  .action((table, opts) => run('Config', async () => {
58
61
  const config = requireConfig();
59
62
  const base = `/api/${config.projectGuid}/records/${table}/config`;
60
63
  // No setter flags → just show the current config.
61
- const setting = opts.auth || opts.searchable !== undefined || opts.primaryKey || opts.softDelete;
64
+ const setting = opts.auth || opts.searchable !== undefined || opts.primaryKey || opts.softDelete
65
+ || opts.autoNumber || opts.autoNumberPad || opts.autoNumberColumn;
62
66
  if (!setting) {
63
67
  const res = await get(base);
64
68
  printResult(JSON.stringify(res.data, null, 2), opts, res.data);
@@ -73,8 +77,22 @@ recordsCommand
73
77
  body.primary_key_column = opts.primaryKey;
74
78
  if (opts.softDelete)
75
79
  body.soft_delete_column = opts.softDelete === 'none' ? null : opts.softDelete;
80
+ if (opts.autoNumber)
81
+ body.auto_number_prefix = opts.autoNumber === 'none' ? null : opts.autoNumber;
82
+ if (opts.autoNumberPad) {
83
+ const pad = Number(opts.autoNumberPad);
84
+ if (!Number.isInteger(pad))
85
+ throw new Error(`--auto-number-pad must be a whole number (got '${opts.autoNumberPad}')`);
86
+ body.auto_number_pad = pad;
87
+ }
88
+ if (opts.autoNumberColumn)
89
+ body.auto_number_column = opts.autoNumberColumn;
76
90
  const res = await patch(base, body);
77
- printResult(`Configured "${table}": auth=${res.data.auth_level}, searchable=${res.data.searchable}, pk=${res.data.primary_key_column}`, opts, res.data);
91
+ const d = res.data;
92
+ const autoNumber = d.auto_number_prefix
93
+ ? `${d.auto_number_prefix} (pad ${d.auto_number_pad}, column ${d.auto_number_column})`
94
+ : 'off';
95
+ printResult(`Configured "${table}": auth=${d.auth_level}, searchable=${d.searchable}, pk=${d.primary_key_column}, auto-number=${autoNumber}`, opts, d);
78
96
  }));
79
97
  recordsCommand
80
98
  .command('query <table>')
@@ -133,8 +133,17 @@ async function revokeDeviceBestEffort() {
133
133
  export const uninstallCommand = new Command('uninstall')
134
134
  .description('Uninstall Gipity')
135
135
  .option('--yes', 'Skip confirmation prompts')
136
+ .option('--json', 'Output a structured result as JSON (requires --yes)')
136
137
  .action(async (opts) => {
137
138
  const autoYes = opts.yes || getAutoConfirm();
139
+ // JSON mode can't share stdout with a y/N prompt, so it needs consent up front.
140
+ if (opts.json && !autoYes) {
141
+ console.error(clrError('uninstall --json needs --yes (there is no prompt in JSON mode).'));
142
+ process.exit(1);
143
+ }
144
+ // Human progress lines; silent in JSON mode, where one result object is printed at the end.
145
+ const say = (line) => { if (!opts.json)
146
+ console.log(line); };
138
147
  const gipityDir = join(homedir(), '.gipity');
139
148
  // Installs from install.sh / install.ps1 keep the launcher binary itself
140
149
  // under ~/.gipity/launcher/bin, so wiping ~/.gipity removes the binary too -
@@ -143,89 +152,103 @@ export const uninstallCommand = new Command('uninstall')
143
152
  // in npm's bin dir, which the user removes with `npm uninstall -g gipity`.
144
153
  const launcherBin = join(gipityDir, 'launcher', 'bin', 'gipity');
145
154
  const installedViaLauncher = existsSync(launcherBin);
146
- console.log(`${bold('Gipity uninstall')} - this will:`);
147
- console.log(`• Stop the running relay daemon (if any)`);
148
- console.log(`• Remove the OS autostart service (launchd / systemd / Task Scheduler)`);
149
- console.log(`• Revoke this device on the server (best-effort)`);
150
- console.log(`• Remove the Gipity Claude Code plugin enablement (all Gipity hooks)`);
151
- console.log(`• Delete ${gipityDir}/${installedViaLauncher ? dim(' (includes the gipity launcher binary itself)') : ''}`);
155
+ say(`${bold('Gipity uninstall')} - this will:`);
156
+ say(`• Stop the running relay daemon (if any)`);
157
+ say(`• Remove the OS autostart service (launchd / systemd / Task Scheduler)`);
158
+ say(`• Revoke this device on the server (best-effort)`);
159
+ say(`• Remove the Gipity Claude Code plugin enablement (all Gipity hooks)`);
160
+ say(`• Delete ${gipityDir}/${installedViaLauncher ? dim(' (includes the gipity launcher binary itself)') : ''}`);
152
161
  if (installedViaLauncher)
153
- console.log(`• Remove the launcher PATH line from your shell startup files`);
154
- console.log('');
162
+ say(`• Remove the launcher PATH line from your shell startup files`);
163
+ say('');
155
164
  if (installedViaLauncher) {
156
- console.log(`${dim('The `gipity` launcher lives under ~/.gipity, so this removes the binary too - no separate `npm uninstall` needed.')}`);
165
+ say(`${dim('The `gipity` launcher lives under ~/.gipity, so this removes the binary too - no separate `npm uninstall` needed.')}`);
157
166
  }
158
167
  else {
159
- console.log(`${dim('It will NOT remove the `gipity` binary. Run `npm uninstall -g gipity` afterward if you want that too.')}`);
168
+ say(`${dim('It will NOT remove the `gipity` binary. Run `npm uninstall -g gipity` afterward if you want that too.')}`);
160
169
  }
161
- console.log('');
170
+ say('');
162
171
  if (!autoYes) {
163
172
  const ok = await confirm('Proceed?');
164
173
  if (!ok) {
165
- console.log(`${muted('Cancelled.')}`);
174
+ say(`${muted('Cancelled.')}`);
166
175
  return;
167
176
  }
168
177
  }
169
178
  // 1. Stop daemon.
170
179
  await stopDaemon();
171
- console.log(`${success('Daemon stopped.')}`);
180
+ say(`${success('Daemon stopped.')}`);
172
181
  // 2. Remove OS service.
173
182
  const svc = removeServiceUnit();
174
183
  if (svc.ran && svc.ok)
175
- console.log(`${success('Autostart service removed.')} ${svc.note ? dim(`(${svc.note})`) : ''}`);
184
+ say(`${success('Autostart service removed.')} ${svc.note ? dim(`(${svc.note})`) : ''}`);
176
185
  else if (svc.ran)
177
- console.log(`${muted('Autostart service not installed or already gone.')}`);
186
+ say(`${muted('Autostart service not installed or already gone.')}`);
178
187
  else
179
- console.log(`${muted(svc.note ?? 'Autostart skipped.')}`);
188
+ say(`${muted(svc.note ?? 'Autostart skipped.')}`);
180
189
  // 3. Revoke device on server.
181
190
  await revokeDeviceBestEffort();
182
- console.log(`${success('Device revoked on server (or was already revoked).')}`);
191
+ say(`${success('Device revoked on server (or was already revoked).')}`);
183
192
  // 4. Remove each detected agent's Gipity integration: the Claude Code
184
193
  // plugin enablement + legacy hook blocks, the Grok plugin, and the
185
194
  // skills the CLI copied into Codex's/Antigravity's skill roots. Every
186
195
  // step is best-effort - none existing is the common case.
187
- let anyAgentIntegration = false;
196
+ const agentNotes = [];
188
197
  for (const agent of AGENT_ADAPTERS) {
189
198
  const note = agent.setup?.uninstall();
190
199
  if (note) {
191
- console.log(`${success(note)}`);
192
- anyAgentIntegration = true;
200
+ say(`${success(note)}`);
201
+ agentNotes.push(note);
193
202
  }
194
203
  }
195
- if (!anyAgentIntegration) {
196
- console.log(`${muted('No Gipity entries in any detected coding agent.')}`);
204
+ if (!agentNotes.length) {
205
+ say(`${muted('No Gipity entries in any detected coding agent.')}`);
197
206
  }
198
207
  // 5. Wipe ~/.gipity/ (this also removes the agent-hooks scripts and the
199
208
  // agent-skills manifest, which live under it).
209
+ let gipityDirRemoved = false;
200
210
  if (existsSync(gipityDir)) {
201
211
  try {
202
212
  rmSync(gipityDir, { recursive: true, force: true });
203
- console.log(`${success(`Removed ${gipityDir}/`)}`);
213
+ gipityDirRemoved = true;
214
+ say(`${success(`Removed ${gipityDir}/`)}`);
204
215
  }
205
216
  catch (err) {
206
217
  console.error(`${clrError(`Could not remove ${gipityDir}: ${err?.message || err}`)}`);
207
218
  }
208
219
  }
209
220
  else {
210
- console.log(`${muted(`${gipityDir}/ already gone.`)}`);
221
+ say(`${muted(`${gipityDir}/ already gone.`)}`);
211
222
  }
212
223
  // 6. Strip the launcher PATH line the installer added to shell rc files, so
213
224
  // we don't leave a dangling entry pointing at the dir we just deleted.
214
225
  const touchedRc = removeInstallerPathLines();
226
+ if (opts.json) {
227
+ console.log(JSON.stringify({
228
+ success: true,
229
+ autostartService: svc.ran ? (svc.ok ? 'removed' : 'not_installed') : 'skipped',
230
+ agentIntegrationsRemoved: agentNotes,
231
+ gipityDir,
232
+ gipityDirRemoved,
233
+ shellRcFilesUpdated: touchedRc,
234
+ binaryRemoved: installedViaLauncher,
235
+ }));
236
+ return;
237
+ }
215
238
  if (touchedRc.length) {
216
- console.log(`${success('Removed the launcher PATH line from')} ${dim(touchedRc.map(tildify).join(', '))}`);
239
+ say(`${success('Removed the launcher PATH line from')} ${dim(touchedRc.map(tildify).join(', '))}`);
217
240
  }
218
- console.log('');
219
- console.log(`${success('Uninstall complete.')}`);
241
+ say('');
242
+ say(`${success('Uninstall complete.')}`);
220
243
  if (installedViaLauncher) {
221
- console.log(`${dim('The launcher binary was under ~/.gipity and is now gone - nothing left to remove.')}`);
244
+ say(`${dim('The launcher binary was under ~/.gipity and is now gone - nothing left to remove.')}`);
222
245
  }
223
246
  else {
224
- console.log(`${dim('Run')} ${brand('npm uninstall -g gipity')} ${dim('to remove the `gipity` binary too.')}`);
247
+ say(`${dim('Run')} ${brand('npm uninstall -g gipity')} ${dim('to remove the `gipity` binary too.')}`);
225
248
  }
226
249
  // The current shell caches the removed binary's path in its command hash, so
227
250
  // the next `gipity` here reports "No such file or directory" until it's
228
251
  // cleared. A new terminal always fixes it; `hash -r` fixes this one.
229
- console.log(`${dim('Open a new terminal - or run')} ${brand('hash -r')} ${dim('in this one - so your shell forgets the removed binary’s path.')}`);
252
+ say(`${dim('Open a new terminal - or run')} ${brand('hash -r')} ${dim('in this one - so your shell forgets the removed binary’s path.')}`);
230
253
  });
231
254
  //# sourceMappingURL=uninstall.js.map
@@ -3,9 +3,24 @@ import { runCheck } from '../updater/check.js';
3
3
  import { success, warning, info, dim } from '../colors.js';
4
4
  export const updateCommand = new Command('update')
5
5
  .description('Update the CLI')
6
- .action(async () => {
7
- console.log(info('Checking for updates...'));
6
+ .option('--json', 'Output as JSON')
7
+ .action(async (opts) => {
8
+ if (!opts.json)
9
+ console.log(info('Checking for updates...'));
8
10
  const result = await runCheck({ force: true, verbose: true });
11
+ if (opts.json) {
12
+ // upToDate is distinct from a failed update, which carries `reason`.
13
+ console.log(JSON.stringify({
14
+ updated: result.updated,
15
+ upToDate: result.reason === 'up-to-date',
16
+ from: result.from ?? null,
17
+ to: result.to ?? null,
18
+ reason: result.updated || result.reason === 'up-to-date' ? null : result.reason ?? null,
19
+ }));
20
+ if (!result.updated && result.reason !== 'up-to-date')
21
+ process.exitCode = 1;
22
+ return;
23
+ }
9
24
  console.log('');
10
25
  if (result.updated) {
11
26
  console.log(success(`Updated ${result.from} → ${result.to}`));
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * sync.ts - Shared sync-before-action helper.
3
3
  */
4
- import { sync, isLocalTreeClean } from '../sync.js';
4
+ import { sync, isLocalTreeClean, appUploadNote } from '../sync.js';
5
5
  import { muted, error as clrError } from '../colors.js';
6
6
  import { createProgressReporter } from '../progress.js';
7
7
  /**
@@ -33,6 +33,9 @@ export async function syncBeforeAction(opts) {
33
33
  if (result.applied > 0 && !opts.json) {
34
34
  console.log(muted(`Synced ${result.applied} change${result.applied > 1 ? 's' : ''}`));
35
35
  }
36
+ const note = appUploadNote(result.appUploadsLeftLocal);
37
+ if (note && !opts.json)
38
+ console.log(muted(note));
36
39
  if (result.errors.length > 0 && !opts.json) {
37
40
  for (const e of result.errors)
38
41
  console.error(clrError(`[sync] ${e}`));