puls-dev 0.3.1 → 0.3.3

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,4 +1,4 @@
1
- import { Agent } from "undici";
1
+ import { Agent, fetch } from "undici";
2
2
  import { Config } from "../../core/config.js";
3
3
  import { withRetry } from "../../core/retry.js";
4
4
  import { resourceContextStorage } from "../../core/context.js";
@@ -55,6 +55,7 @@ export declare class VMBuilder extends BaseBuilder {
55
55
  node?: undefined;
56
56
  }>;
57
57
  private resolveExistingIp;
58
+ private registerHost;
58
59
  destroy(): Promise<any>;
59
60
  private waitForTask;
60
61
  private destroyVmByName;
@@ -122,6 +122,7 @@ export class VMBuilder extends BaseBuilder {
122
122
  if (this.resolvedIp) {
123
123
  this.out.ip.resolve(this.resolvedIp);
124
124
  }
125
+ this.registerHost();
125
126
  const activeIp = this.resolvedIp ?? "0.0.0.0";
126
127
  // 1. Calculate hashes and check if playbooks need to run
127
128
  const appliedHashes = parseProvisionMetadata(existing.description ?? "");
@@ -359,6 +360,7 @@ export class VMBuilder extends BaseBuilder {
359
360
  this.out.ip.resolve(this.resolvedIp);
360
361
  console.log(` 🌐 IP: ${this.resolvedIp}`);
361
362
  }
363
+ this.registerHost();
362
364
  if (this._provision.length > 0) {
363
365
  await this.waitFor(`SSH on ${this.resolvedIp} to be ready`, () => this.checkPort(this.resolvedIp, 22), { intervalMs: 10_000, timeoutMs: 300_000 });
364
366
  await this.waitFor(`cloud-init to finish on ${this.resolvedIp}`, () => this.checkCloudInit(this.resolvedIp), { intervalMs: 15_000, timeoutMs: 300_000 });
@@ -377,19 +379,6 @@ export class VMBuilder extends BaseBuilder {
377
379
  if (this._replace) {
378
380
  await this.destroyVmByName(this._replace, pm);
379
381
  }
380
- const context = resourceContextStorage.getStore();
381
- if (context && context.hosts) {
382
- const activeIp = this.resolvedIp ?? "0.0.0.0";
383
- if (!context.hosts.some(h => h.name === this.name)) {
384
- context.hosts.push({
385
- name: this.name,
386
- ip: activeIp,
387
- user: "root",
388
- sshKey: this.sshKeyPath(),
389
- provider: "proxmox"
390
- });
391
- }
392
- }
393
382
  return { name: this.name, vmid: this.resolvedVmid, ip: this.resolvedIp };
394
383
  }
395
384
  async resolveExistingIp(node, vmid, pm) {
@@ -422,6 +411,21 @@ export class VMBuilder extends BaseBuilder {
422
411
  }
423
412
  return null;
424
413
  }
414
+ registerHost() {
415
+ const context = resourceContextStorage.getStore();
416
+ if (context && context.hosts) {
417
+ const activeIp = this.resolvedIp ?? "0.0.0.0";
418
+ if (!context.hosts.some((h) => h.name === this.name)) {
419
+ context.hosts.push({
420
+ name: this.name,
421
+ ip: activeIp,
422
+ user: "root",
423
+ sshKey: this.sshKeyPath(),
424
+ provider: "proxmox",
425
+ });
426
+ }
427
+ }
428
+ }
425
429
  async destroy() {
426
430
  const dryRun = this.isDryRunActive();
427
431
  const existing = await this.discoveryPromise;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "puls-dev",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "Intent-driven infrastructure-as-code with eager discovery and no state files.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",