insta 0.0.47 → 0.0.48

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,5 +1,28 @@
1
1
  import { ApiClient, requireProject } from '../api.js';
2
2
  import { info, printJson } from '../util.js';
3
+ /**
4
+ * The label that names WHERE a resource runs.
5
+ *
6
+ * `kind` is the platform's internal resource kind, and for compute it is always 'fly' — 'fly' is
7
+ * the compute SEAT, occupied by the microvm plane on any environment that has cut over. Printing
8
+ * it is how `insta manifest` came to tell users and agents that a microvm-backed service ran on
9
+ * Fly (staging, 2026-08-25: `fly(api)` for a row serving from warm pod insta-warm-00178a-16).
10
+ *
11
+ * So for compute rows the label is the platform's explicit `provider`, and when that is absent --
12
+ * an older platform, or a row whose provider the platform itself could not determine -- we fall
13
+ * back to the neutral 'compute'. That names the resource without asserting a plane: no provider
14
+ * beats a wrong one. Non-compute kinds keep printing their kind.
15
+ */
16
+ export function resourceLabel(r) {
17
+ const kind = r.kind ?? 'resource';
18
+ const label = kind === 'fly' ? (r.provider === 'fly' || r.provider === 'microvm' ? r.provider : 'compute') : kind;
19
+ return `${label}${r.name ? `(${r.name})` : ''}`;
20
+ }
21
+ // One `manifest` resource line. Pure, so the label is unit-tested without a network mock.
22
+ export function resourceLine(r) {
23
+ const where = r.ref?.url ?? r.ref?.bucket ?? r.ref?.neonProjectId ?? '';
24
+ return ` - ${resourceLabel(r)} ${where} [${r.status}]`;
25
+ }
3
26
  // Agent-legible view of each environment's databases / storage / compute.
4
27
  export async function manifest(opts) {
5
28
  const api = await ApiClient.load();
@@ -11,10 +34,8 @@ export async function manifest(opts) {
11
34
  for (const b of detail.branches) {
12
35
  info(` branch ${b.name}${b.is_default ? ' *' : ''} [${b.status}]`);
13
36
  const rs = detail.resources.filter((r) => r.branchId === b.id || (b.is_default && r.branchId === null));
14
- for (const r of rs) {
15
- const where = r.ref?.url ?? r.ref?.bucket ?? r.ref?.neonProjectId ?? '';
16
- info(` - ${r.kind}${r.name ? `(${r.name})` : ''} ${where} [${r.status}]`);
17
- }
37
+ for (const r of rs)
38
+ info(resourceLine(r));
18
39
  }
19
40
  }
20
41
  //# sourceMappingURL=manifest.js.map
@@ -15,6 +15,7 @@ import { readPersistedGlobal, resolveEnv } from '../config.js';
15
15
  import { DEFAULT_ENV, ENVS, ENV_NAMES, envForApiUrl, envFromEnvVar, isEnvName, mcpServerName } from '../env.js';
16
16
  import { info } from '../util.js';
17
17
  import { loginOauth } from './auth.js';
18
+ import { projectLink } from './project.js';
18
19
  import { envUse } from './env.js';
19
20
  import { installAgentConfigs } from './mcp.js';
20
21
  import { detectChannel } from './upgrade.js';
@@ -424,7 +425,7 @@ export async function setupAgent(opts, run = defaultRunner, mint, installConfigs
424
425
  login: () => loginOauth('github', {}),
425
426
  stdinTty: canPromptViaTty(),
426
427
  stdoutTty: !!process.stdout.isTTY,
427
- }) {
428
+ }, link = projectLink) {
428
429
  if (!opts.yes && !process.stdout.isTTY) {
429
430
  info('non-interactive shell — assuming -y');
430
431
  }
@@ -485,6 +486,31 @@ export async function setupAgent(opts, run = defaultRunner, mint, installConfigs
485
486
  }
486
487
  }
487
488
  }
489
+ // --project: link this directory inside the SAME process. The console's connect panel used to
490
+ // print `setup agent && insta project link <id>` as one paste — but no shell joiner survives
491
+ // every Windows shell, and in shells without bracketed paste the queued link line is eaten as
492
+ // the answer to the login prompt above (console PR #290). Carrying the id as a flag is the one
493
+ // form where "one line" is safe. Linking needs the session: without one the manual command is
494
+ // the hint, never a hang; a failed link (bad id, no access) is a REAL error — the link is the
495
+ // entire point of the flag — so it sets the exit code instead of pretending setup succeeded.
496
+ if (opts.project) {
497
+ if (!loggedIn) {
498
+ info(` not logged in — project not linked; run \`insta login\`, then \`insta project link ${opts.project}\``);
499
+ }
500
+ else {
501
+ try {
502
+ await link(opts.project);
503
+ }
504
+ catch (e) {
505
+ // Stop here — like the skill-install failure above, finishing with the success summary
506
+ // and a cheerful `next:` after an error is mixed messaging. Setup itself did succeed,
507
+ // so say exactly that alongside the retry command.
508
+ info(` project link failed (${e instanceof Error ? e.message : String(e)}) — agent setup itself is done; run \`insta project link ${opts.project}\` to retry the link`);
509
+ process.exitCode = 1;
510
+ return;
511
+ }
512
+ }
513
+ }
488
514
  // THE summary line. The restart note exists because config-file agents only read their MCP
489
515
  // config at startup; the skill files need no restart.
490
516
  const mcpOk = claude === 'new' || claude === 'existing' || others.length > 0;
package/dist/index.js CHANGED
@@ -87,6 +87,7 @@ setupCmd.command('agent').description('Install the insta CLI (if missing), the i
87
87
  .option('-y, --yes', 'non-interactive')
88
88
  .option('--env <prod|staging>', 'deployment to set this machine up for (default: prod — switches and persists, like `insta env use`)')
89
89
  .option('--mcp-token', 'register the MCP server with a minted insta_ API token instead of OAuth (headless machines / CI)')
90
+ .option('--project <id>', 'also link this directory to an existing project after setup (flows through login first if needed)')
90
91
  .action(guard((o) => setup.setupAgent(o)));
91
92
  // ---- MCP server integration ----
92
93
  const mcpCmd = program.command('mcp').description('insta-cloud remote MCP server integration');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "insta",
3
- "version": "0.0.47",
3
+ "version": "0.0.48",
4
4
  "type": "module",
5
5
  "description": "InstaCloud CLI — a thin client of the platform control-plane API.",
6
6
  "keywords": [