<commit_before>const readPlan = require('./hcl-hil.js').readPlan;

export namespace terraform {

enum DiffAttrType {
  DiffAttrUnknown = 0,
  DiffAttrInput,
  DiffAttrOutput
}

export interface ResourceAttrDiff {
  Old: string;
  New: string;
  NewComputed: boolean;
  NewRemoved: boolean;
  NewExtra: any;
  RequiresNew: boolean;
  Sensitive: boolean;
  Diff: DiffAttrType;
}

export interface InstanceDiff {
  Attributes: { [key: string]: ResourceAttrDiff };
  Destroy: boolean;
  DestroyDeposed: boolean;
  DestroyTainted: boolean;
  Meta: { [key: string]: any };
}

export interface ModuleDiff {
  Path: string[];
  Resources: { [key: string]: InstanceDiff }
  Destroy: boolean
}

export interface Diff {
  Modules: ModuleDiff[]
}

export interface Plan {
  Diff: any;
  Module: any;
  State: any;
  Vars: { [key: string]: any };
  Targets: string[];
  TerraformVersion: string;
  ProviderSHA256s: { [key: string]: any };
  Backend: any;
  Destroy: boolean;
}

}  // namespace terraform

export function parsePlan(buffer: Buffer): terraform.Plan {
  let [rawPlan, error] = readPlan(buffer);
  if (error) {
    throw new Error(`Error: ${error.Err}`);
  }

  return <terraform.Plan>rawPlan;
}
<commit_msg>Add type info to terraform.Plan.Diff<commit_after>const readPlan = require('./hcl-hil.js').readPlan;

export namespace terraform {

enum DiffAttrType {
  DiffAttrUnknown = 0,
  DiffAttrInput,
  DiffAttrOutput
}

export interface ResourceAttrDiff {
  Old: string;
  New: string;
  NewComputed: boolean;
  NewRemoved: boolean;
  NewExtra: any;
  RequiresNew: boolean;
  Sensitive: boolean;
  Diff: DiffAttrType;
}

export interface InstanceDiff {
  Attributes: { [key: string]: ResourceAttrDiff };
  Destroy: boolean;
  DestroyDeposed: boolean;
  DestroyTainted: boolean;
  Meta: { [key: string]: any };
}

export interface ModuleDiff {
  Path: string[];
  Resources: { [key: string]: InstanceDiff }
  Destroy: boolean
}

export interface Diff {
  Modules: ModuleDiff[]
}

export interface Plan {
  Diff: Diff;
  Module: any;
  State: any;
  Vars: { [key: string]: any };
  Targets: string[];
  TerraformVersion: string;
  ProviderSHA256s: { [key: string]: any };
  Backend: any;
  Destroy: boolean;
}

}  // namespace terraform

export function parsePlan(buffer: Buffer): terraform.Plan {
  let [rawPlan, error] = readPlan(buffer);
  if (error) {
    throw new Error(`Error: ${error.Err}`);
  }

  return <terraform.Plan>rawPlan;
}

{'fraction_non_alphanumeric': 0.12387202625102543, 'fraction_numerical': 0.003281378178835111, 'mean_word_length': 4.20042643923241, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7514064', 'n_tokens_mistral': 822, 'n_tokens_neox': 818, 'n_words': 220}