Skip to content

Conversation

Copy link

Copilot AI commented Dec 28, 2025

The documentation lacked practical examples for common operations. Added concrete use cases with working code snippets for both library and CLI usage.

Changes

Main README (README.md)

  • Quick Start: Minimal client initialization with TypeScript and CLI examples
  • Common Use Cases: 5 production-ready patterns
    • Account balance queries
    • Transaction fetching (last 30 days)
    • SEPA credit transfers with TAN handling
    • SEPA direct debits with TAN handling
    • Multi-account operations
  • Tips & Troubleshooting: Authentication errors, TAN requirements, timeout handling, best practices

Library README (packages/fints/README.md)

  • Replaced minimal example with detailed Quick Start
  • Added 4 use cases with proper error handling and environment variable validation

CLI README (packages/fints-cli/README.md)

  • Practical Examples: 5 automation scripts
    • Environment variables setup
    • JSON export with jq integration
    • Monthly statement automation (Linux/macOS)
    • Multi-account checking
  • Tips: CLI best practices and tool recommendations

Example

import { PinTanClient } from "fints-lib";

const client = new PinTanClient({
    url: process.env.FINTS_URL,
    name: process.env.FINTS_USERNAME,
    pin: process.env.FINTS_PIN,
    blz: process.env.FINTS_BLZ,
});

// Fetch last 30 days
const endDate = new Date();
const startDate = new Date(endDate.getTime() - 30 * 24 * 60 * 60 * 1000);
const statements = await client.statements(accounts[0], startDate, endDate);

All examples use environment variables for credentials and include proper error handling.

Stats: +594 lines across 3 files

Original prompt

Es wäre gut, wenn wir die Dokumentation um ein paar direkte Use Cases erweitern.

• README: Beispiele für grundlegende Client-Initialisierung, typische Use‑Cases (Kontostand, Umsätze, SEPA), Short CLI‑Beispiele, Quickstart mit minimaler Konfiguration.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 5 commits December 28, 2025 23:30
Co-authored-by: larsdecker <1968186+larsdecker@users.noreply.github.com>
Co-authored-by: larsdecker <1968186+larsdecker@users.noreply.github.com>
Co-authored-by: larsdecker <1968186+larsdecker@users.noreply.github.com>
Co-authored-by: larsdecker <1968186+larsdecker@users.noreply.github.com>
Co-authored-by: larsdecker <1968186+larsdecker@users.noreply.github.com>
Copilot AI changed the title [WIP] Update documentation to include use cases and examples docs: Add comprehensive use cases and practical examples Dec 28, 2025
Copilot AI requested a review from larsdecker December 28, 2025 23:40
@larsdecker larsdecker marked this pull request as ready for review December 28, 2025 23:58
Copilot AI review requested due to automatic review settings December 28, 2025 23:58
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR significantly enhances the documentation by adding comprehensive practical examples and use cases for both library and CLI usage. The changes transform the documentation from minimal examples to production-ready code snippets that demonstrate common banking operations with proper error handling and best practices.

Key changes:

  • Added Quick Start section with minimal configuration examples for TypeScript and CLI
  • Introduced 5 detailed use cases covering account queries, transactions, SEPA transfers, direct debits, and multi-account operations
  • Added Tips & Troubleshooting section with authentication, TAN handling, timeout configuration, and best practices

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
README.md Enhanced with minimal configuration quick start, 5 comprehensive use cases with library and CLI examples, and extensive tips/troubleshooting section
packages/fints/README.md Replaced basic example with detailed Quick Start and added 4 common use cases with environment variable handling
packages/fints-cli/README.md Added 5 practical CLI automation scripts including environment setup, JSON export with jq, monthly statements, and multi-account checking

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +284 to +289
END_DATE=$(date -d "-1 day $(date +%Y-%m-01)" +%Y-%m-%d)

# For macOS (BSD date), install GNU coreutils and use 'gdate':
# brew install coreutils
# START_DATE=$(gdate -d "last month" +%Y-%m-01)
# END_DATE=$(gdate -d "-1 day $(gdate +%Y-%m-01)" +%Y-%m-%d)
Copy link

Copilot AI Dec 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bash script comment describes fetching "last month's transactions" but the date calculation logic appears inconsistent. The START_DATE correctly gets the first day of last month, but the END_DATE calculation date -d "-1 day $(date +%Y-%m-01)" will subtract one day from the first of the current month (giving the last day of last month), which is correct. However, this nested command substitution may not work as expected in all shells. Consider using a clearer approach like date -d "$(date +%Y-%m-01) -1 day" +%Y-%m-%d or calculating both dates relative to "last month".

Suggested change
END_DATE=$(date -d "-1 day $(date +%Y-%m-01)" +%Y-%m-%d)
# For macOS (BSD date), install GNU coreutils and use 'gdate':
# brew install coreutils
# START_DATE=$(gdate -d "last month" +%Y-%m-01)
# END_DATE=$(gdate -d "-1 day $(gdate +%Y-%m-01)" +%Y-%m-%d)
END_DATE=$(date -d "$(date +%Y-%m-01) -1 day" +%Y-%m-%d)
# For macOS (BSD date), install GNU coreutils and use 'gdate':
# brew install coreutils
# START_DATE=$(gdate -d "last month" +%Y-%m-01)
# END_DATE=$(gdate -d "$(gdate +%Y-%m-01) -1 day" +%Y-%m-%d)

Copilot uses AI. Check for mistakes.
Comment on lines +83 to +87
fints-lib list-accounts \
--url https://banking.example.com/fints \
-n username \
-p 12345 \
-b 12345678
Copy link

Copilot AI Dec 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All CLI examples in this README (starting with this snippet) pass the banking PIN via the -p command-line option, which exposes credentials in process listings (ps, system monitors) and often in shell history, allowing other local users or system tooling to capture the PIN. An attacker on the same host could read the full command line and reuse the stolen username/PIN against the bank’s FinTS endpoint. Consider adjusting the examples (and ideally the CLI UX) to avoid passing the PIN on the command line (e.g., reading from a secure prompt or protected store) and at minimum document the risk of using -p with real credentials.

Copilot uses AI. Check for mistakes.
Comment on lines +241 to +321
# Get account list in JSON format for processing
fints-lib list-accounts \
--url https://banking.example.com/fints \
-n username -p 12345 -b 12345678 \
--json | jq '.'

# Check balance for a specific account
fints-lib get-balance \
--url https://banking.example.com/fints \
-n username -p 12345 -b 12345678 \
-i DE89370400440532013000 \
--json | jq '.value'
```

### Export Transactions to File

```bash
# Fetch and save transactions as JSON
fints-lib fetch-transactions \
--url https://banking.example.com/fints \
-n username -p 12345 -b 12345678 \
-i DE89370400440532013000 \
-s 2024-01-01 -e 2024-12-31 \
--json > transactions-2024.json

# Or save verbose output to text file
fints-lib fetch-transactions \
--url https://banking.example.com/fints \
-n username -p 12345 -b 12345678 \
-i DE89370400440532013000 \
-s 2024-01-01 -e 2024-12-31 \
--verbose > transactions-2024.txt
```

### Monthly Statement Automation

```bash
#!/bin/bash
# monthly-statement.sh - Fetch last month's transactions

# Calculate date range for last month
# For Linux (GNU date):
START_DATE=$(date -d "last month" +%Y-%m-01)
END_DATE=$(date -d "-1 day $(date +%Y-%m-01)" +%Y-%m-%d)

# For macOS (BSD date), install GNU coreutils and use 'gdate':
# brew install coreutils
# START_DATE=$(gdate -d "last month" +%Y-%m-01)
# END_DATE=$(gdate -d "-1 day $(gdate +%Y-%m-01)" +%Y-%m-%d)

# Fetch transactions
fints-lib fetch-transactions \
--url "$FINTS_URL" \
-n "$FINTS_USER" \
-p "$FINTS_PIN" \
-b "$FINTS_BLZ" \
-i "$ACCOUNT_IBAN" \
-s "$START_DATE" \
-e "$END_DATE" \
--json > "statement-$(date +%Y-%m).json"

echo "Statement saved for period: $START_DATE to $END_DATE"
```

### Check Multiple Accounts

```bash
#!/bin/bash
# check-all-accounts.sh

ACCOUNTS=("DE89370400440532013000" "DE89370400440532013001")

for IBAN in "${ACCOUNTS[@]}"; do
echo "Checking account: $IBAN"
fints-lib get-balance \
--url "$FINTS_URL" \
-n "$FINTS_USER" \
-p "$FINTS_PIN" \
-b "$FINTS_BLZ" \
-i "$IBAN" \
--json | jq -r '" Balance: \(.value.value) \(.value.currency)"'
Copy link

Copilot AI Dec 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These CLI usage examples consistently pass the banking PIN using the -p flag (including the commented fints-env.sh usage and the automation scripts), which can leak credentials via process listings (ps, system monitors) and shell history on multi-user systems. A local attacker or monitoring tool could capture the full command line and reuse the PIN to access the victim’s bank account. It’s safer to avoid putting the PIN on the command line at all (e.g., have the CLI prompt for it or read it from a secure store) and to explicitly warn users in the docs about the risks of --pin/-p.

Copilot uses AI. Check for mistakes.
@larsdecker larsdecker merged commit 2c4cf95 into master Dec 29, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants