gipity 1.1.22 → 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.
- package/README.md +33 -15
- package/dist/adopt-cwd.js +2 -2
- package/dist/commands/brand.js +1 -1
- package/dist/commands/deploy.js +57 -16
- package/dist/commands/env.js +168 -0
- package/dist/commands/file.js +6 -2
- package/dist/commands/fn.js +1 -1
- package/dist/commands/init.js +66 -24
- package/dist/commands/job.js +18 -2
- package/dist/commands/login.js +31 -14
- package/dist/commands/logout.js +7 -6
- package/dist/commands/push.js +11 -3
- package/dist/commands/rbac.js +2 -1
- package/dist/commands/realtime.js +6 -0
- package/dist/commands/records.js +22 -4
- package/dist/commands/service.js +2 -2
- package/dist/commands/status.js +3 -0
- package/dist/commands/test.js +6 -6
- package/dist/commands/uninstall.js +53 -30
- package/dist/commands/update.js +17 -2
- package/dist/config.js +34 -3
- package/dist/helpers/sync.js +4 -1
- package/dist/index.js +593 -169
- package/dist/knowledge.js +19 -15
- package/dist/login-flow.js +9 -7
- package/dist/prompts.js +2 -2
- package/dist/provider-docs.js +1 -1
- package/dist/setup.js +52 -7
- package/dist/sync.js +72 -10
- package/dist/template-vars.js +1 -1
- package/dist/utils.js +5 -3
- package/package.json +3 -3
|
@@ -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
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
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
|
-
|
|
154
|
-
|
|
162
|
+
say(`• Remove the launcher PATH line from your shell startup files`);
|
|
163
|
+
say('');
|
|
155
164
|
if (installedViaLauncher) {
|
|
156
|
-
|
|
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
|
-
|
|
168
|
+
say(`${dim('It will NOT remove the `gipity` binary. Run `npm uninstall -g gipity` afterward if you want that too.')}`);
|
|
160
169
|
}
|
|
161
|
-
|
|
170
|
+
say('');
|
|
162
171
|
if (!autoYes) {
|
|
163
172
|
const ok = await confirm('Proceed?');
|
|
164
173
|
if (!ok) {
|
|
165
|
-
|
|
174
|
+
say(`${muted('Cancelled.')}`);
|
|
166
175
|
return;
|
|
167
176
|
}
|
|
168
177
|
}
|
|
169
178
|
// 1. Stop daemon.
|
|
170
179
|
await stopDaemon();
|
|
171
|
-
|
|
180
|
+
say(`${success('Daemon stopped.')}`);
|
|
172
181
|
// 2. Remove OS service.
|
|
173
182
|
const svc = removeServiceUnit();
|
|
174
183
|
if (svc.ran && svc.ok)
|
|
175
|
-
|
|
184
|
+
say(`${success('Autostart service removed.')} ${svc.note ? dim(`(${svc.note})`) : ''}`);
|
|
176
185
|
else if (svc.ran)
|
|
177
|
-
|
|
186
|
+
say(`${muted('Autostart service not installed or already gone.')}`);
|
|
178
187
|
else
|
|
179
|
-
|
|
188
|
+
say(`${muted(svc.note ?? 'Autostart skipped.')}`);
|
|
180
189
|
// 3. Revoke device on server.
|
|
181
190
|
await revokeDeviceBestEffort();
|
|
182
|
-
|
|
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
|
-
|
|
196
|
+
const agentNotes = [];
|
|
188
197
|
for (const agent of AGENT_ADAPTERS) {
|
|
189
198
|
const note = agent.setup?.uninstall();
|
|
190
199
|
if (note) {
|
|
191
|
-
|
|
192
|
-
|
|
200
|
+
say(`${success(note)}`);
|
|
201
|
+
agentNotes.push(note);
|
|
193
202
|
}
|
|
194
203
|
}
|
|
195
|
-
if (!
|
|
196
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
239
|
+
say(`${success('Removed the launcher PATH line from')} ${dim(touchedRc.map(tildify).join(', '))}`);
|
|
217
240
|
}
|
|
218
|
-
|
|
219
|
-
|
|
241
|
+
say('');
|
|
242
|
+
say(`${success('Uninstall complete.')}`);
|
|
220
243
|
if (installedViaLauncher) {
|
|
221
|
-
|
|
244
|
+
say(`${dim('The launcher binary was under ~/.gipity and is now gone - nothing left to remove.')}`);
|
|
222
245
|
}
|
|
223
246
|
else {
|
|
224
|
-
|
|
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
|
-
|
|
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
|
package/dist/commands/update.js
CHANGED
|
@@ -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
|
-
.
|
|
7
|
-
|
|
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}`));
|
package/dist/config.js
CHANGED
|
@@ -2,9 +2,31 @@ import { readFileSync, writeFileSync, existsSync } from 'fs';
|
|
|
2
2
|
import { dirname, resolve } from 'path';
|
|
3
3
|
import ignore from 'ignore';
|
|
4
4
|
const CONFIG_FILE = '.gipity.json';
|
|
5
|
+
/** The app's prod environment name. */
|
|
6
|
+
export const PROD_ENV = 'prod';
|
|
5
7
|
export const DEFAULT_API_BASE = 'https://a.gipity.ai';
|
|
6
8
|
let cached = null;
|
|
7
9
|
let cachedPath = null;
|
|
10
|
+
let envOption;
|
|
11
|
+
/** Record the global `--env <name>` flag (index.ts preAction). */
|
|
12
|
+
export function setEnvOption(name) {
|
|
13
|
+
envOption = name;
|
|
14
|
+
}
|
|
15
|
+
/** The `--env <name>` this invocation was given, if any. */
|
|
16
|
+
export function getEnvOption() {
|
|
17
|
+
return envOption;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Point this invocation's config at an app environment's project, so every
|
|
21
|
+
* project-scoped command (db, fn, logs, secrets, domain, ...) acts on that env.
|
|
22
|
+
* In memory only: saveConfig refuses while it is applied.
|
|
23
|
+
*/
|
|
24
|
+
export function applyEnvOverride(env) {
|
|
25
|
+
const base = getConfig();
|
|
26
|
+
if (!base)
|
|
27
|
+
throw new Error('--env needs a Gipity project directory');
|
|
28
|
+
cached = { ...base, projectGuid: env.projectGuid, projectSlug: env.projectSlug, env: { name: env.name, appSlug: base.projectSlug } };
|
|
29
|
+
}
|
|
8
30
|
/** Global --api-base override (set from root CLI option, takes precedence over config file) */
|
|
9
31
|
let apiBaseOverride = null;
|
|
10
32
|
export function setApiBaseOverride(url) {
|
|
@@ -182,9 +204,15 @@ export async function resolveProjectContext(opts) {
|
|
|
182
204
|
* by hand or guess a subdomain like `<slug>.gipity.app` (which doesn't
|
|
183
205
|
* resolve). Mirrors the server's deploy URL; `deploy` itself prints the
|
|
184
206
|
* server-authoritative URL, the read-only commands derive it from config. */
|
|
185
|
-
export function liveUrl(config,
|
|
186
|
-
|
|
187
|
-
|
|
207
|
+
export function liveUrl(config, env = config.env?.name ?? PROD_ENV) {
|
|
208
|
+
// The app's own slug, even when --env pointed the config at an env project.
|
|
209
|
+
const appSlug = config.env?.appSlug ?? config.projectSlug;
|
|
210
|
+
if (env === PROD_ENV)
|
|
211
|
+
return `https://app.gipity.ai/${config.accountSlug}/${appSlug}/`;
|
|
212
|
+
// Every other env is on the dev host: `dev` at the app's bare slug, the
|
|
213
|
+
// rest at `<slug>--<env>`.
|
|
214
|
+
const segment = env === 'dev' ? appSlug : `${appSlug}--${env}`;
|
|
215
|
+
return `https://dev.gipity.ai/${config.accountSlug}/${segment}/`;
|
|
188
216
|
}
|
|
189
217
|
export function clearConfigCache() {
|
|
190
218
|
cached = null;
|
|
@@ -197,6 +225,9 @@ export function saveConfig(data) {
|
|
|
197
225
|
// create-on-save here would silently turn that folder - in the wild, often
|
|
198
226
|
// `$HOME` itself - into a Gipity project. Creating a config is always an
|
|
199
227
|
// explicit act and must go through `saveConfigAt(dir, …)`.
|
|
228
|
+
if (cached?.env || data.env) {
|
|
229
|
+
throw new Error('Can\'t change the linked project while --env is set: run it without --env.');
|
|
230
|
+
}
|
|
200
231
|
const path = getConfigPath();
|
|
201
232
|
if (!path) {
|
|
202
233
|
throw new Error('saveConfig: no .gipity.json found to update. ' +
|
package/dist/helpers/sync.js
CHANGED
|
@@ -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}`));
|