MCPcopy Index your code
hub / github.com/coder/mux / computeExtraParams

Method computeExtraParams

src/node/services/coderService.ts:818–842  ·  view source on GitHub ↗

* Compute extra --parameter flags needed for workspace creation. * Filters to non-ephemeral params not covered by preset, using their defaults. * Values are passed through as-is (list(string) types expect JSON-encoded arrays).

(
    allParams: Array<{
      name: string;
      defaultValue: string;
      type: string;
      ephemeral: boolean;
      required: boolean;
    }>,
    coveredByPreset: Set<string>
  )

Source from the content-addressed store, hash-verified

816 * Values are passed through as-is (list(string) types expect JSON-encoded arrays).
817 */
818 computeExtraParams(
819 allParams: Array<{
820 name: string;
821 defaultValue: string;
822 type: string;
823 ephemeral: boolean;
824 required: boolean;
825 }>,
826 coveredByPreset: Set<string>
827 ): Array<{ name: string; encoded: string }> {
828 const extra: Array<{ name: string; encoded: string }> = [];
829
830 for (const p of allParams) {
831 // Skip ephemeral params
832 if (p.ephemeral) continue;
833 // Skip params covered by preset
834 if (coveredByPreset.has(p.name)) continue;
835
836 // Encode for CLI's CSV parser (escape quotes/commas)
837 const encoded = this.encodeParameterValue(`${p.name}=${p.defaultValue}`);
838 extra.push({ name: p.name, encoded });
839 }
840
841 return extra;
842 }
843
844 /**
845 * Validate that all required params have values (either from preset or defaults).

Callers 2

createWorkspaceMethod · 0.95

Calls 3

encodeParameterValueMethod · 0.95
pushMethod · 0.65
hasMethod · 0.45

Tested by

no test coverage detected