gipity 1.1.9 → 1.1.10

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.
@@ -1,3 +1,4 @@
1
+ import { planForInstall, whichFirst } from './self-update.js';
1
2
  import { ensureClaudeInstalled, CLAUDE_PACKAGE } from '../claude-setup.js';
2
3
  import { parseTranscript as parseClaudeTranscript } from '../capture/sources/claude-code.js';
3
4
  import { userScopeInstallState, ensureGipityPluginInstalled, setupClaudeHooks, removeGipityPluginConfig, } from '../setup.js';
@@ -47,6 +48,13 @@ export const claudeCodeAdapter = {
47
48
  return ensureClaudeInstalled().installed;
48
49
  },
49
50
  installHint: `npm install -g ${CLAUDE_PACKAGE}`,
51
+ updatePlan() {
52
+ // Same-channel rule (see agents/self-update.ts): npm-global installs
53
+ // (what ensureClaudeInstalled sets up) update via npm; anything else gets
54
+ // Anthropic's own `claude update` - the native installer's self-updater,
55
+ // which is a harmless error on installs it doesn't manage.
56
+ return planForInstall(whichFirst('claude'), CLAUDE_PACKAGE, ['claude', 'update']);
57
+ },
50
58
  detectEnv() {
51
59
  // Most reliable: CLAUDECODE=1 plus a versioned exec path.
52
60
  if (process.env.CLAUDECODE === '1' || process.env.CLAUDE_CODE_ENTRYPOINT) {
@@ -1,4 +1,5 @@
1
1
  import { hasEnvPrefix } from './types.js';
2
+ import { planForInstall, whichFirst } from './self-update.js';
2
3
  import { parseTranscript as parseCodexTranscript } from '../capture/sources/codex.js';
3
4
  import { agentSkillsState, ensureAgentSkillsInstalled, setupCodexHooks, removeAgentSkills } from '../setup.js';
4
5
  export const codexAdapter = {
@@ -45,6 +46,11 @@ export const codexAdapter = {
45
46
  daemonStreamCapture: false,
46
47
  oneTimeSetupNote: 'Codex runs project hooks only after a one-time approval: run /hooks inside Codex and approve the Gipity entries, or session recording stays off.',
47
48
  installHint: 'npm install -g @openai/codex',
49
+ updatePlan() {
50
+ // npm-global installs only; brew/other channels stay manual (no
51
+ // self-updater fallback - see agents/self-update.ts's same-channel rule).
52
+ return planForInstall(whichFirst('codex'), '@openai/codex', null);
53
+ },
48
54
  detectEnv() {
49
55
  return hasEnvPrefix('CODEX_') ? { harness: 'codex' } : null;
50
56
  },
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Install-type detection + update plans backing adapter `updatePlan()`s
3
+ * (the relay daemon's daily harness auto-update; see relay/agent-updates.ts).
4
+ *
5
+ * The rule is conservative: only update through the SAME channel the binary
6
+ * was installed with. An npm-global install (what our own ensureInstalled
7
+ * paths set up) gets `npm install -g <pkg>@latest`; anything else falls back
8
+ * to the agent's own self-updater when it has one (`claude update`), and is
9
+ * otherwise left alone (brew, curl-script, GUI installs) - a wrong-channel
10
+ * update could shadow or corrupt the real install.
11
+ */
12
+ import { execSync } from 'child_process';
13
+ import { existsSync, realpathSync } from 'fs';
14
+ import { dirname, join, sep } from 'path';
15
+ /** First PATH hit for `binary` (`which`/`where`), or null when absent. */
16
+ export function whichFirst(binary) {
17
+ const cmd = process.platform === 'win32' ? `where ${binary}` : `which ${binary}`;
18
+ try {
19
+ const out = execSync(cmd, { stdio: ['ignore', 'pipe', 'ignore'], encoding: 'utf-8', windowsHide: true });
20
+ return out.split('\n').map(l => l.trim()).find(Boolean) || null;
21
+ }
22
+ catch {
23
+ return null; // execSync throws when the binary isn't on PATH
24
+ }
25
+ }
26
+ /**
27
+ * True when `binPath` is an npm-global install of `pkg`: the bin shim either
28
+ * realpath-resolves into `node_modules/<pkg>/` (Unix symlink shims) or sits
29
+ * next to a `node_modules/<pkg>` dir (Windows .cmd shims live in the prefix
30
+ * root beside node_modules).
31
+ */
32
+ export function isNpmManaged(binPath, pkg) {
33
+ const marker = join('node_modules', ...pkg.split('/')) + sep;
34
+ try {
35
+ if (realpathSync(binPath).includes(marker))
36
+ return true;
37
+ }
38
+ catch { /* dangling symlink or unreadable - fall through */ }
39
+ try {
40
+ return existsSync(join(dirname(binPath), 'node_modules', ...pkg.split('/')));
41
+ }
42
+ catch {
43
+ return false;
44
+ }
45
+ }
46
+ /** npm-global update argv. Lifecycle scripts stay ENABLED - this is the same
47
+ * channel the original `npm install -g` used, and some agent packages need
48
+ * their scripts to finish an install. */
49
+ export function npmLatestArgv(pkg) {
50
+ return ['npm', 'install', '-g', '--no-audit', '--no-fund', `${pkg}@latest`];
51
+ }
52
+ /**
53
+ * Pick the update plan for a resolved binary path (null when not installed).
54
+ * `selfUpdateArgv` is the agent's own self-updater for non-npm installs, or
55
+ * null when it has none (those installs stay manual).
56
+ */
57
+ export function planForInstall(binPath, pkg, selfUpdateArgv) {
58
+ if (!binPath)
59
+ return null;
60
+ if (isNpmManaged(binPath, pkg))
61
+ return { argv: npmLatestArgv(pkg), label: 'npm', pkg };
62
+ return selfUpdateArgv ? { argv: selfUpdateArgv, label: selfUpdateArgv.join(' ') } : null;
63
+ }
64
+ //# sourceMappingURL=self-update.js.map
@@ -257,11 +257,13 @@ Examples:
257
257
  gipity generate video "a bird flying over a mountain lake at sunset"
258
258
  gipity generate video "close-up of coffee being poured" --model veo-3.1-fast-generate-preview
259
259
  gipity generate video "vertical dance video" --aspect 9:16 --resolution 1080p -o dance.mp4
260
+ gipity generate video "a wave crashing" --duration 4 --model veo-3.1-lite-generate-preview
260
261
  `)
261
262
  .argument('<prompt>', 'Description of the video scene, action, camera movement, and dialogue')
262
263
  .option('--model <model>', 'Veo model: veo-3.1-generate-preview (quality), veo-3.1-fast-generate-preview (speed), veo-3.1-lite-generate-preview (budget)')
263
264
  .option('--aspect <ratio>', 'Aspect ratio: 16:9 (landscape), 9:16 (portrait), 1:1 (square)')
264
265
  .option('--resolution <res>', 'Video resolution: 720p, 1080p, 4k')
266
+ .option('--duration <seconds>', 'Clip length in seconds. Veo models: 4, 6, or 8 (8 required at 1080p/4K); omni-flash: 3-10. Default 8. Billing is per second, so shorter is cheaper.')
265
267
  .option('-o, --output <file>', 'Output path (default ./generated.mp4). For a clip your app ships, write it into the source tree so it deploys, e.g. -o src/assets/video/clip.mp4; the cwd default is fine for one-off generation.')
266
268
  .option('--json', 'Output as JSON')
267
269
  .action(async (prompt, opts) => {
@@ -274,6 +276,7 @@ Examples:
274
276
  model: opts.model,
275
277
  aspect_ratio: opts.aspect,
276
278
  resolution: opts.resolution,
279
+ duration_seconds: opts.duration ? Number(opts.duration) : undefined,
277
280
  });
278
281
  // Veo runs 30-120s; the bouncing bar + timer keeps the wait honest.
279
282
  const result = opts.json
@@ -254,6 +254,36 @@ relayCommand
254
254
  ? `${success('Diagnostics sharing on.')} ${muted('Reported on the next daily heartbeat.')}`
255
255
  : `${success('Diagnostics sharing off.')} ${muted('No host/version data will be sent.')}`);
256
256
  });
257
+ // ─── gipity relay updates [on|off] ─────────────────────────────────────
258
+ relayCommand
259
+ .command('updates [state]')
260
+ .description('View or set daily auto-update of installed coding agents (on|off)')
261
+ .action((arg) => {
262
+ if (arg === undefined) {
263
+ const stored = state.getAgentUpdatesPref();
264
+ const effective = state.agentUpdatesEnabled();
265
+ const label = stored === undefined ? 'on (default, not yet chosen)' : stored ? 'on' : 'off';
266
+ console.log(`Agent auto-updates: ${effective ? success(label) : muted(label)}`);
267
+ if (!effective && stored !== false) {
268
+ console.log(muted(' (overridden off by DISABLE_AUTOUPDATER / GIPITY_RELAY_AGENT_UPDATES / CI)'));
269
+ }
270
+ console.log(muted(' Once a day, while idle, the relay brings its coding agents (Claude Code, Codex) to the latest release.'));
271
+ console.log(muted(' Upgrades appear in `gipity relay log` and in the device diagnostics on the web.'));
272
+ console.log(muted(' Set with `gipity relay updates on` / `gipity relay updates off`.'));
273
+ return;
274
+ }
275
+ const on = /^(on|true|yes|1|enable)$/i.test(arg);
276
+ const off = /^(off|false|no|0|disable)$/i.test(arg);
277
+ if (!on && !off) {
278
+ console.log(clrError("Expected 'on' or 'off'."));
279
+ process.exitCode = 1;
280
+ return;
281
+ }
282
+ state.setAgentUpdatesPref(on);
283
+ console.log(on
284
+ ? `${success('Agent auto-updates on.')} ${muted("Runs on the relay daemon's next daily maintenance tick.")}`
285
+ : `${success('Agent auto-updates off.')} ${muted('Installed agents only change when you update them yourself.')}`);
286
+ });
257
287
  // ─── gipity relay rename <name> ────────────────────────────────────────
258
288
  relayCommand
259
289
  .command('rename <new-name>')
@@ -9,7 +9,7 @@ export const updateCommand = new Command('update')
9
9
  console.log('');
10
10
  if (result.updated) {
11
11
  console.log(success(`Updated ${result.from} → ${result.to}`));
12
- console.log(dim('The new version takes effect on your next gipity command.'));
12
+ console.log(dim(`Installed. This command ran on ${result.from}; everything from here on uses ${result.to}.`));
13
13
  }
14
14
  else if (result.reason === 'up-to-date') {
15
15
  console.log(success('Already on the latest version.'));