Skip to main content
← Back to list
01Issue
FeatureClosedSwamp Club
AssigneesNone

Track extracted files in upstream_extensions.json during extension pull

Opened by swampadmin · 12/16/2024

Context

When an extension is pulled, the list of extracted files is computed and displayed to the user but never persisted. This means there's no way to know which files belong to which extension after the fact — blocking a future extension rm command. The extractedFiles array already exists in the pull code; we just need to save it.

Current format

{
  "@keeb/proxmox": {
    "version": "2026.02.27.1",
    "pulledAt": "2026-02-27T17:08:40.019Z"
  }
}

Desired format

{
  "@keeb/proxmox": {
    "version": "2026.02.27.1",
    "pulledAt": "2026-02-27T17:08:40.019Z",
    "files": [
      "extensions/models/proxmox_node.ts",
      "extensions/models/proxmox_vm.ts",
      "extensions/models/lib/proxmox.ts",
      "extensions/workflows/create-vm.yaml",
      "extensions/workflows/sync-fleet.yaml",
      "extensions/workflows/guest-agent-test.yaml",
      "extensions/workflows/start-vm.yaml",
      "extensions/workflows/delete-vm.yaml",
      "extensions/workflows/stop-vm.yaml",
      "extensions/workflows/vm-lifecycle-test.yaml",
      ".swamp/bundles/proxmox_vm.js",
      ".swamp/bundles/proxmox_node.js"
    ]
  },
  "@keeb/ssh": {
    "version": "2026.02.27.1",
    "pulledAt": "2026-02-27T17:08:41.922Z",
    "files": [
      "extensions/models/lib/ssh.ts",
      "extensions/models/ssh_host.ts",
      ".swamp/bundles/ssh_host.js"
    ]
  }
}

Each extension records only its own files. Dependencies get their own entry with their own file list.

Changes

1. Update UpstreamExtensionEntry interface

File: src/cli/commands/extension_pull.ts

Add optional files field for backward compatibility with existing upstream_extensions.json files written before this change:

interface UpstreamExtensionEntry {
  version: string;
  pulledAt: string;
  files?: string[];
}

2. Update updateUpstreamExtensions function signature and body

File: src/cli/commands/extension_pull.ts

  • Add files: string[] parameter
  • Include files in the merged entry

3. Pass extractedFiles at the call site

File: src/cli/commands/extension_pull.ts (line 539)

Change:

await updateUpstreamExtensions(absoluteModelsDir, ref.name, version);

To:

await updateUpstreamExtensions(absoluteModelsDir, ref.name, version, extractedFiles);

4. Add tests

  • Unit test in src/cli/commands/extension_pull_test.ts
  • Integration test in integration/extension_pull_test.ts verifying files is persisted in the JSON

Backward compatibility

Existing upstream_extensions.json files without files will still parse fine — the field is optional. The dependency-check code only checks for key existence (upstream[dep]), so it's unaffected.

Verification

  1. deno check — type checking
  2. deno lint — linting
  3. deno fmt — formatting
  4. deno run test — all tests pass
  5. Manual: swamp extension pull @keeb/ssh --force then inspect extensions/models/upstream_extensions.json to confirm files array is present
02Bog Flow
OPENTRIAGEDIN PROGRESSCLOSED

Closed

No activity in this phase yet.

03Sludge Pulse

Sign in to post a ripple.