<commit_before>Pj = require \../package.json

const MODE-MAINT  = \maintenance
const MODE-NORMAL = \normal

mode = MODE-NORMAL

module.exports =
  get-is-mode-maintenance: -> mode is MODE-MAINT

  read: (req, res, next) ->
    res.json do
      env    : process.env.NODE_ENV
      mode   : mode
      version: Pj.version

  toggle-mode: (req, res, next) ->
    mode := if mode is MODE-NORMAL then MODE-MAINT else MODE-NORMAL
    res.json mode:mode
<commit_msg>amend /api/sys to include nodejs, npm and os<commit_after>Cp = require \child_process
Os = require \os
Pj = require \../package.json

const MODE-MAINT  = \maintenance
const MODE-NORMAL = \normal

mode = MODE-NORMAL
nodejs = version: process.version.replace \v ''
npm = version: Cp.execSync 'npm --version' .toString!replace Os.EOL, ''
os =
  architecture: Os.arch!
  platform    : Os.platform!
  release     : Os.release!
  type        : Os.type!

module.exports =
  get-is-mode-maintenance: -> mode is MODE-MAINT

  read: (req, res, next) ->
    res.json do
      env    : process.env.NODE_ENV
      mode   : mode
      nodejs : nodejs
      npm    : npm
      os     : os
      version: Pj.version

  toggle-mode: (req, res, next) ->
    mode := if mode is MODE-NORMAL then MODE-MAINT else MODE-NORMAL
    res.json mode:mode

{'fraction_non_alphanumeric': 0.11888111888111888, 'fraction_numerical': 0.0, 'mean_word_length': 2.4623655913978495, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '4690550', 'n_tokens_mistral': 456, 'n_tokens_neox': 454, 'n_words': 125}