Skip to content

romainsimon/paperasse / comptable

comptable

Verified

Comptabilité, fiscalité et facturation pour entreprises françaises. Gère écritures PCG, déclarations TVA, IS/IR, clôture annuelle, liasse fiscale (2033/2065), FEC, états financiers, et chaîne facturation (mentions obligatoires, numérotation, Factur-X/UBL/CII, plateformes agréées PDP/PA, e-reporting, réforme 2026, PEPPOL). Utiliser dès qu'une question porte sur comptabilité française, TVA, impôts, bilan, compte de résultat, amortissement, PCA, clôture, notes de frais, indemnités kilométriques, facture, avoir, devis, acompte, facturation électronique, ou e-invoicing. Couvre aussi le social et la TVA des artistes-auteurs : affiliation URSSAF, cotisations, RAAP/IRCEC, revenus sans précompte, franchise de TVA des auteurs (293 B I bis), régularisation. Triggers : artiste-auteur, droits d'auteur, précompte, URSSAF Limousin, Maison des artistes, IRCEC, RAAP, Patreon, Substack, autoédition, franchise auteurs, 293 B.

FileKindSize
SKILL.mdskill md20.2 KB
company.example.jsonconfig2.6 KB
data/artistes-auteurs-2026.jsonconfig27.0 KB
data/bareme-kilometrique.jsonconfig6.0 KB
data/facturation/mentions-obligatoires.jsonconfig7.3 KB
data/invoices/_template.jsonconfig1.0 KB
data/invoices/index.jsonconfig293 B
data/journal-entries.jsonconfig11.0 KB
data/nomenclature-liasse-fiscale.csvother2.1 KB
data/pcg_2026.jsonconfig395.5 KB
data/sources.jsonconfig7.9 KB
evals/evals.jsonconfig22.3 KB
evals/files/company-techflow.jsonconfig858 B
evals/files/company-webdev.jsonconfig841 B
evals/files/invoice-test.jsonconfig538 B
evals/files/qonto-transactions.jsonconfig4.9 KB
evals/files/stripe-transactions.jsonconfig5.8 KB
integrations/README.mdmarkdown5.6 KB
integrations/pennylane/fetch.jsscript7.6 KB
integrations/pennylane/fetch.test.jsscript7.0 KB
integrations/pennylane/fixtures/transactions-pages.jsonconfig1.8 KB
integrations/qonto/fetch.jsscript9.5 KB
integrations/qonto/fetch.test.jsscript2.5 KB
integrations/stripe/fetch.jsscript9.5 KB
references/arborescence.mdmarkdown3.8 KB
references/artistes-auteurs-champ.mdmarkdown6.1 KB
references/artistes-auteurs-plateformes.mdmarkdown12.1 KB
references/artistes-auteurs-tva.mdmarkdown7.8 KB
references/artistes-auteurs.mdmarkdown11.8 KB
references/calendar.mdmarkdown7.4 KB
references/closing.mdmarkdown10.3 KB
references/cloture-workflow.mdmarkdown14.1 KB
references/facturation/e-reporting.mdmarkdown4.1 KB
references/facturation/formats-facturx.mdmarkdown6.3 KB
references/facturation/mentions-obligatoires.mdmarkdown5.5 KB
references/facturation/numerotation-conservation.mdmarkdown3.9 KB
references/facturation/plateformes-agreees.mdmarkdown4.3 KB
references/facturation/reforme-2026.mdmarkdown7.6 KB
references/facturation/setup-facturation.mdmarkdown3.2 KB
references/facturation/stripe-sync.mdmarkdown5.6 KB
references/facturation/workflow.mdmarkdown7.2 KB
references/formats.mdmarkdown721 B
references/frais-professionnels.mdmarkdown12.4 KB
references/integrations.mdmarkdown2.1 KB
references/legal-forms.mdmarkdown9.3 KB
references/pcg.mdmarkdown3.1 KB
references/regional.mdmarkdown9.6 KB
references/setup.mdmarkdown6.0 KB
references/taxes.mdmarkdown7.4 KB
references/tva.mdmarkdown10.7 KB
scripts/calc.jsscript14.2 KB
scripts/calc_artiste_auteur.pyexecutablescript6.8 KB
scripts/check-skill-descriptions.jsscript2.3 KB
scripts/fetch_company.pyexecutablescript6.2 KB
scripts/fetch_notaire_data.pyscript18.2 KB
scripts/generate-facturx.jsscript28.4 KB
scripts/generate-fec.jsscript6.6 KB
scripts/generate-pdfs.jsscript12.7 KB
scripts/generate-statements.jsscript25.5 KB
scripts/import-stripe-invoices.jsscript12.1 KB
scripts/parse-einvoice.jsscript39.2 KB
scripts/test-deterministic-calculations.jsscript25.1 KB
scripts/test-parse-einvoice.jsscript32.4 KB
scripts/test_fetch_notaire_data.pyscript7.8 KB
scripts/update_data.pyscript13.4 KB
scripts/upload-qonto-attachments.jsexecutablescript12.8 KB
scripts/validate-facture.jsscript12.1 KB
templates/2065-sd.htmlother15.6 KB
templates/approbation-comptes.mdmarkdown3.0 KB
templates/declaration-confidentialite.htmlother3.7 KB
templates/depot-greffe-checklist.mdmarkdown3.1 KB
templates/facturation/avoir.htmlother7.6 KB
templates/facturation/avoir.mdmarkdown4.9 KB
templates/facturation/checklist-conformite.mdmarkdown2.5 KB
templates/facturation/facture.htmlother9.0 KB
templates/facturation/facture.mdmarkdown6.3 KB
templates/liasse-fiscale-2033.mdmarkdown5.5 KB

integrations/pennylane/fetch.js

View on GitHub
/**
 * Connecteur Pennylane
 * Récupère les transactions bancaires depuis l'API Company v2 et les normalise
 * au format data/transactions/ de Paperasse.
 *
 * Variable d'environnement requise :
 * - PENNYLANE_API_TOKEN (token Company avec le scope transactions:readonly)
 *
 * Prérequis côté Pennylane : offre Essential ou supérieure, et un rôle autorisé
 * (Executive, Internal Accountant, External Accountant) pour créer le token.
 * Le connecteur est opt-in : il exige "pennylane": {"enabled": true} dans company.json.
 *
 * Usage :
 *   node integrations/pennylane/fetch.js
 *   node integrations/pennylane/fetch.js --start 2025-01-01 --end 2025-12-31
 */

const fs = require('fs');
const path = require('path');

const PENNYLANE_API_BASE = 'https://app.pennylane.com/api/external/v2';

function getHeaders(token = process.env.PENNYLANE_API_TOKEN) {
  if (!token) {
    throw new Error(
      'Variable PENNYLANE_API_TOKEN manquante.\n' +
      'Créez un token Company Pennylane avec le scope transactions:readonly.'
    );
  }

  return {
    Authorization: `Bearer ${token}`,
    Accept: 'application/json'
  };
}

function validateDate(value, flag) {
  const parsed = new Date(`${value}T00:00:00Z`);
  if (
    !/^\d{4}-\d{2}-\d{2}$/.test(value) ||
    Number.isNaN(parsed.getTime()) ||
    parsed.toISOString().slice(0, 10) !== value
  ) {
    throw new Error(`${flag} doit être une date au format YYYY-MM-DD`);
  }
}

/**
 * Construit les paramètres de l'endpoint GET /transactions.
 * Le filtre Pennylane est un tableau JSON de triplets field/operator/value.
 */
function buildTransactionsParams(options = {}) {
  const params = new URLSearchParams({
    limit: '100',
    sort: 'id'
  });
  const filters = [];

  if (options.startDate) {
    validateDate(options.startDate, '--start');
    filters.push({ field: 'date', operator: 'gteq', value: options.startDate });
  }
  if (options.endDate) {
    validateDate(options.endDate, '--end');
    filters.push({ field: 'date', operator: 'lteq', value: options.endDate });
  }
  if (filters.length > 0) params.set('filter', JSON.stringify(filters));
  if (options.cursor) params.set('cursor', options.cursor);

  return params;
}

async function getTransactionsPage(options = {}) {
  const fetchImpl = options.fetchImpl || globalThis.fetch;
  if (typeof fetchImpl !== 'function') {
    throw new Error('Cette intégration nécessite Node.js 18 ou supérieur (fetch indisponible).');
  }

  const params = buildTransactionsParams(options);
  const apiBase = options.apiBase || PENNYLANE_API_BASE;
  const response = await fetchImpl(`${apiBase}/transactions?${params}`, {
    headers: getHeaders(options.token)
  });

  if (!response.ok) {
    throw new Error(`Erreur API Pennylane : ${response.status} ${response.statusText}`);
  }

  const page = await response.json();
  if (!page || !Array.isArray(page.items) || typeof page.has_more !== 'boolean') {
    throw new Error('Réponse API Pennylane invalide : pagination ou liste de transactions absente.');
  }
  return page;
}

/** Récupère toutes les pages, en protégeant contre un curseur absent ou répété. */
async function getAllTransactions(options = {}) {
  const transactions = [];
  const seenCursors = new Set();
  let cursor;

  while (true) {
    const page = await getTransactionsPage({ ...options, cursor });
    transactions.push(...page.items);

    if (!page.has_more) break;
    if (!page.next_cursor || page.next_cursor === cursor || seenCursors.has(page.next_cursor)) {
      throw new Error('Pagination Pennylane invalide : next_cursor absent ou répété.');
    }
    seenCursors.add(page.next_cursor);
    cursor = page.next_cursor;
  }

  return transactions;
}

function toNumber(value, field, transactionId, nullable = false) {
  if (nullable && (value === null || value === undefined || value === '')) return null;
  const number = Number(value);
  if (!Number.isFinite(number)) {
    throw new Error(`Transaction Pennylane ${transactionId} invalide : ${field} n'est pas un montant.`);
  }
  return number;
}

/** Transforme une transaction Pennylane au format standard Paperasse. */
function transformTransaction(tx) {
  if (tx.id === null || tx.id === undefined || !tx.date) {
    throw new Error('Transaction Pennylane invalide : id ou date absent.');
  }

  const categoryLabels = Array.isArray(tx.categories)
    ? tx.categories.map(category => category.label).filter(Boolean)
    : [];

  return {
    id: `pennylane-${tx.id}`,
    source: 'pennylane',
    account_id: tx.bank_account && tx.bank_account.id != null
      ? String(tx.bank_account.id)
      : null,
    date: tx.date,
    amount: toNumber(tx.currency_amount, 'currency_amount', tx.id),
    amount_eur: toNumber(tx.amount, 'amount', tx.id),
    currency: tx.currency,
    fee: toNumber(tx.currency_fee, 'currency_fee', tx.id, true),
    fee_eur: toNumber(tx.fee, 'fee', tx.id, true),
    label: tx.label || `Transaction Pennylane ${tx.id}`,
    reference: tx.interbank_code || null,
    counterparty: tx.label || null,
    category: categoryLabels[0] || null,
    categories: categoryLabels,
    our_category: null,
    status: tx.archived_at ? 'archived' : 'completed',
    attachment_required: Boolean(tx.attachment_required),
    raw: tx
  };
}

function parseArgs(args) {
  const options = {};
  for (let i = 0; i < args.length; i++) {
    if ((args[i] === '--start' || args[i] === '--end') && !args[i + 1]) {
      throw new Error(`Valeur manquante pour ${args[i]}`);
    }
    if (args[i] === '--start') {
      options.startDate = args[++i];
    } else if (args[i] === '--end') {
      options.endDate = args[++i];
    } else {
      throw new Error(`Option inconnue : ${args[i]}`);
    }
  }

  if (options.startDate) validateDate(options.startDate, '--start');
  if (options.endDate) validateDate(options.endDate, '--end');
  if (options.startDate && options.endDate && options.startDate > options.endDate) {
    throw new Error('--start doit être antérieure ou égale à --end');
  }
  return options;
}

function isPennylaneEnabled(companyPath) {
  if (!fs.existsSync(companyPath)) return false;
  const company = JSON.parse(fs.readFileSync(companyPath, 'utf-8'));
  return Boolean(company.pennylane && company.pennylane.enabled === true);
}

function writeTransactionsFile(transactions, outputFile) {
  const transformed = transactions.map(transformTransaction);
  fs.mkdirSync(path.dirname(outputFile), { recursive: true });
  fs.writeFileSync(outputFile, JSON.stringify(transformed, null, 2));
  return transformed;
}

async function main() {
  const companyPath = path.join(__dirname, '../../company.json');
  if (!isPennylaneEnabled(companyPath)) {
    console.log('Pennylane n\'est pas activé dans company.json ("pennylane": {"enabled": true}). Ignoré.');
    return;
  }

  if (!process.env.PENNYLANE_API_TOKEN) {
    console.log('Variable PENNYLANE_API_TOKEN non définie. Pennylane ignoré.');
    console.log('Créez un token Company avec le scope transactions:readonly pour activer le connecteur.');
    return;
  }

  const options = parseArgs(process.argv.slice(2));
  console.log('Récupération des transactions Pennylane...');
  const transactions = await getAllTransactions(options);

  const outputFile = path.join(__dirname, '../../data/transactions/pennylane.json');
  const transformed = writeTransactionsFile(transactions, outputFile);

  console.log(`${transformed.length} transaction(s) enregistrée(s) dans ${outputFile}`);
}

module.exports = {
  buildTransactionsParams,
  getTransactionsPage,
  getAllTransactions,
  transformTransaction,
  parseArgs,
  isPennylaneEnabled,
  writeTransactionsFile
};

if (require.main === module) {
  main().catch(err => {
    console.error('Erreur :', err.message);
    process.exit(1);
  });
}
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall