<commit_before>function! FetchBlueprint()
  let api_name = split(expand("%"), ':')[1]
  let blueprint = system("apiary fetch --output=/dev/fd/1 --api-name=" . shellescape(api_name))
  call append(0, split(blueprint, '\n'))
  set filetype=apiblueprint
  normal gg
endfunction

augroup Apiary
  au!
  au BufReadCmd apiary:* call FetchBlueprint()
  au FileReadCmd apiary:* call FetchBlueprint()<commit_msg>Support publishing blueprints to Apiary #8<commit_after>function! FetchBlueprint()
  let api_name = split(expand("%"), ':')[1]
  let blueprint = system("apiary fetch --output=/dev/fd/1 --api-name=" . shellescape(api_name))
  call append(0, split(blueprint, '\n'))
  set filetype=apiblueprint
  normal gg
endfunction

function! PublishBlueprint()
  let api_name = split(expand("%"), ':')[1]
  let blueprint = join(getline(1, '$'), "\n")
  let result = system("apiary publish --path=/dev/fd/0 --api-name=" . shellescape(api_name), blueprint)
  echomsg result
endfunction

augroup Apiary
  au!
  au BufReadCmd apiary:* call FetchBlueprint()
  au FileReadCmd apiary:* call FetchBlueprint()
  au BufWriteCmd apiary:* call PublishBlueprint()
  au FileWriteCmd apiary:* call PublishBlueprint()
{'fraction_non_alphanumeric': 0.14465937762825903, 'fraction_numerical': 0.008410428931875526, 'mean_word_length': 5.16580310880829, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6841168', 'n_tokens_mistral': 409, 'n_tokens_neox': 404, 'n_words': 105}