quantix-mcp 0.4.5 → 0.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/.claude/commands/opsx/apply.md +152 -0
  2. package/.claude/commands/opsx/archive.md +157 -0
  3. package/.claude/commands/opsx/bulk-archive.md +242 -0
  4. package/.claude/commands/opsx/continue.md +114 -0
  5. package/.claude/commands/opsx/explore.md +174 -0
  6. package/.claude/commands/opsx/ff.md +94 -0
  7. package/.claude/commands/opsx/new.md +69 -0
  8. package/.claude/commands/opsx/onboard.md +525 -0
  9. package/.claude/commands/opsx/sync.md +134 -0
  10. package/.claude/commands/opsx/verify.md +164 -0
  11. package/.claude/settings.local.json +2 -1
  12. package/.claude/skills/openspec-apply-change/SKILL.md +156 -0
  13. package/.claude/skills/openspec-archive-change/SKILL.md +114 -0
  14. package/.claude/skills/openspec-bulk-archive-change/SKILL.md +246 -0
  15. package/.claude/skills/openspec-continue-change/SKILL.md +118 -0
  16. package/.claude/skills/openspec-explore/SKILL.md +290 -0
  17. package/.claude/skills/openspec-ff-change/SKILL.md +101 -0
  18. package/.claude/skills/openspec-new-change/SKILL.md +74 -0
  19. package/.claude/skills/openspec-onboard/SKILL.md +529 -0
  20. package/.claude/skills/openspec-sync-specs/SKILL.md +138 -0
  21. package/.claude/skills/openspec-verify-change/SKILL.md +168 -0
  22. package/.dockerignore +8 -0
  23. package/.gemini/commands/opsx/apply.toml +149 -0
  24. package/.gemini/commands/opsx/archive.toml +154 -0
  25. package/.gemini/commands/opsx/bulk-archive.toml +239 -0
  26. package/.gemini/commands/opsx/continue.toml +111 -0
  27. package/.gemini/commands/opsx/explore.toml +171 -0
  28. package/.gemini/commands/opsx/ff.toml +91 -0
  29. package/.gemini/commands/opsx/new.toml +66 -0
  30. package/.gemini/commands/opsx/onboard.toml +522 -0
  31. package/.gemini/commands/opsx/sync.toml +131 -0
  32. package/.gemini/commands/opsx/verify.toml +161 -0
  33. package/.gemini/skills/openspec-apply-change/SKILL.md +156 -0
  34. package/.gemini/skills/openspec-archive-change/SKILL.md +114 -0
  35. package/.gemini/skills/openspec-bulk-archive-change/SKILL.md +246 -0
  36. package/.gemini/skills/openspec-continue-change/SKILL.md +118 -0
  37. package/.gemini/skills/openspec-explore/SKILL.md +290 -0
  38. package/.gemini/skills/openspec-ff-change/SKILL.md +101 -0
  39. package/.gemini/skills/openspec-new-change/SKILL.md +74 -0
  40. package/.gemini/skills/openspec-onboard/SKILL.md +529 -0
  41. package/.gemini/skills/openspec-sync-specs/SKILL.md +138 -0
  42. package/.gemini/skills/openspec-verify-change/SKILL.md +168 -0
  43. package/.qwen/commands/opsx-apply.toml +149 -0
  44. package/.qwen/commands/opsx-archive.toml +154 -0
  45. package/.qwen/commands/opsx-bulk-archive.toml +239 -0
  46. package/.qwen/commands/opsx-continue.toml +111 -0
  47. package/.qwen/commands/opsx-explore.toml +171 -0
  48. package/.qwen/commands/opsx-ff.toml +91 -0
  49. package/.qwen/commands/opsx-new.toml +66 -0
  50. package/.qwen/commands/opsx-onboard.toml +522 -0
  51. package/.qwen/commands/opsx-sync.toml +131 -0
  52. package/.qwen/commands/opsx-verify.toml +161 -0
  53. package/.qwen/skills/openspec-apply-change/SKILL.md +156 -0
  54. package/.qwen/skills/openspec-archive-change/SKILL.md +114 -0
  55. package/.qwen/skills/openspec-bulk-archive-change/SKILL.md +246 -0
  56. package/.qwen/skills/openspec-continue-change/SKILL.md +118 -0
  57. package/.qwen/skills/openspec-explore/SKILL.md +290 -0
  58. package/.qwen/skills/openspec-ff-change/SKILL.md +101 -0
  59. package/.qwen/skills/openspec-new-change/SKILL.md +74 -0
  60. package/.qwen/skills/openspec-onboard/SKILL.md +529 -0
  61. package/.qwen/skills/openspec-sync-specs/SKILL.md +138 -0
  62. package/.qwen/skills/openspec-verify-change/SKILL.md +168 -0
  63. package/AGENTS.md +117 -0
  64. package/Dockerfile +30 -0
  65. package/GEMINI.md +59 -0
  66. package/QWEN.md +117 -0
  67. package/dist/config.d.ts +1 -0
  68. package/dist/config.d.ts.map +1 -1
  69. package/dist/config.js +4 -1
  70. package/dist/config.js.map +1 -1
  71. package/dist/index.d.ts.map +1 -1
  72. package/dist/index.js +30 -4
  73. package/dist/index.js.map +1 -1
  74. package/dist/tools/transactions.d.ts.map +1 -1
  75. package/dist/tools/transactions.js +33 -3
  76. package/dist/tools/transactions.js.map +1 -1
  77. package/dist/types/schemas.d.ts +66 -7
  78. package/dist/types/schemas.d.ts.map +1 -1
  79. package/dist/types/schemas.js +36 -10
  80. package/dist/types/schemas.js.map +1 -1
  81. package/docker-compose.yml +9 -0
  82. package/openapi.yaml +212 -54
  83. package/openspec/README.md +33 -0
  84. package/openspec/changes/archive/2026-04-03-separate-credit-card-transaction-tools/.openspec.yaml +2 -0
  85. package/openspec/changes/archive/2026-04-03-separate-credit-card-transaction-tools/design.md +60 -0
  86. package/openspec/changes/archive/2026-04-03-separate-credit-card-transaction-tools/proposal.md +25 -0
  87. package/openspec/changes/archive/2026-04-03-separate-credit-card-transaction-tools/specs/credit-card-transactions/spec.md +46 -0
  88. package/openspec/changes/archive/2026-04-03-separate-credit-card-transaction-tools/specs/transactions/spec.md +42 -0
  89. package/openspec/changes/archive/2026-04-03-separate-credit-card-transaction-tools/tasks.md +22 -0
  90. package/openspec/config.yaml +20 -0
  91. package/openspec/specs/accounts/spec.md +86 -0
  92. package/openspec/specs/categories/spec.md +78 -0
  93. package/openspec/specs/credit-card-transactions/spec.md +64 -0
  94. package/openspec/specs/credit-cards/spec.md +109 -0
  95. package/openspec/specs/data/spec.md +49 -0
  96. package/openspec/specs/settings/spec.md +48 -0
  97. package/openspec/specs/subscriptions/spec.md +85 -0
  98. package/openspec/specs/summary/spec.md +49 -0
  99. package/openspec/specs/transactions/spec.md +113 -0
  100. package/openspec/specs/transfers/spec.md +74 -0
  101. package/package.json +1 -1
  102. package/src/config.ts +4 -1
  103. package/src/index.ts +35 -5
  104. package/src/tools/transactions.ts +47 -3
  105. package/src/types/schemas.ts +40 -10
  106. package/tests/tools/accounts.test.ts +1 -1
  107. package/tests/tools/credit-cards.test.ts +1 -1
  108. package/tests/tools/transactions.test.ts +1 -1
@@ -0,0 +1,86 @@
1
+ # Accounts Specification
2
+
3
+ ## Purpose
4
+ Gerenciamento de contas financeiras (contas bancárias, carteiras, poupanças, investimentos). Cada conta possui um saldo inicial e um saldo calculado baseado nas transações.
5
+
6
+ ## Scope
7
+ O que está **incluído** nesta spec:
8
+ - CRUD completo de contas financeiras
9
+ - Consulta de saldo individual por conta
10
+ - Tipos de conta: BANK_ACCOUNT, WALLET, SAVINGS_ACCOUNT, INVESTMENT_ACCOUNT, OTHER
11
+
12
+ O que está **fora do escopo**:
13
+ - Transferências entre contas (domínio: transfers)
14
+ - Cálculo de saldo agregado (domínio: summary)
15
+
16
+ ## Requirements
17
+
18
+ ### Requirement: Create account
19
+ The system SHALL allow creating a new financial account with a name, type, and optional initial balance. The system SHALL assign a unique ID and set `currentBalance` equal to `initialBalance` upon creation.
20
+
21
+ #### Scenario: Create account with initial balance
22
+ - **WHEN** the user provides `name`, `type`, and `initialBalance`
23
+ - **THEN** the system creates the account with `currentBalance` equal to `initialBalance` and returns the full account object
24
+
25
+ #### Scenario: Create account without initial balance
26
+ - **WHEN** the user provides `name` and `type` but no `initialBalance`
27
+ - **THEN** the system creates the account with `initialBalance` defaulting to 0
28
+
29
+ #### Scenario: Validation rejects invalid type
30
+ - **WHEN** the user provides a `type` not in the allowed enum
31
+ - **THEN** the input is rejected by the Zod schema
32
+
33
+ ### Requirement: List all accounts
34
+ The system SHALL return all financial accounts with their current balances.
35
+
36
+ #### Scenario: List accounts when some exist
37
+ - **WHEN** the user requests the account list
38
+ - **THEN** the system returns an array of all accounts with their `currentBalance`
39
+
40
+ #### Scenario: List accounts when none exist
41
+ - **WHEN** no accounts have been created
42
+ - **THEN** the system returns an empty array
43
+
44
+ ### Requirement: Get account by ID
45
+ The system SHALL return the details of a specific account by its ID.
46
+
47
+ #### Scenario: Account found
48
+ - **WHEN** the user requests an account with a valid ID
49
+ - **THEN** the system returns the account details
50
+
51
+ #### Scenario: Account not found
52
+ - **WHEN** the user requests an account with an ID that does not exist
53
+ - **THEN** the system returns a 404 error
54
+
55
+ ### Requirement: Update account
56
+ The system SHALL allow updating an existing account's name, type, and initial balance.
57
+
58
+ #### Scenario: Successful update
59
+ - **WHEN** the user provides a valid account ID and one or more updateable fields
60
+ - **THEN** the system updates the account and returns the updated object
61
+
62
+ #### Scenario: Account not found on update
63
+ - **WHEN** the user attempts to update a non-existent account
64
+ - **THEN** the system returns a 404 error
65
+
66
+ ### Requirement: Delete account
67
+ The system SHALL allow deleting an account by its ID.
68
+
69
+ #### Scenario: Successful deletion
70
+ - **WHEN** the user deletes an account with a valid ID
71
+ - **THEN** the system confirms the deletion
72
+
73
+ #### Scenario: Account not found on deletion
74
+ - **WHEN** the user attempts to delete a non-existent account
75
+ - **THEN** the system returns a 404 error
76
+
77
+ ### Requirement: Get account balance
78
+ The system SHALL return the current balance for a specific account.
79
+
80
+ #### Scenario: Balance retrieved successfully
81
+ - **WHEN** the user requests the balance of an existing account
82
+ - **THEN** the system returns the `accountId`, `currentBalance`, and `calculatedAt` timestamp
83
+
84
+ #### Scenario: Account not found for balance
85
+ - **WHEN** the user requests the balance of a non-existent account
86
+ - **THEN** the system returns a 404 error
@@ -0,0 +1,78 @@
1
+ # Categories Specification
2
+
3
+ ## Purpose
4
+ Gerenciamento de categorias de classificação para transações financeiras. Cada categoria é do tipo INCOME (receita) ou EXPENSE (despesa) e pode ter uma cor associada.
5
+
6
+ ## Scope
7
+ O que está **incluído** nesta spec:
8
+ - CRUD completo de categorias
9
+ - Validação de tipo (INCOME/EXPENSE) e cor hexadecimal
10
+
11
+ O que está **fora do escopo**:
12
+ - Atribuição de categorias a transações (domínio: transactions)
13
+ - Hierarquia ou subcategorias
14
+
15
+ ## Requirements
16
+
17
+ ### Requirement: Create category
18
+ The system SHALL allow creating a new category with a name, type (INCOME or EXPENSE), and optional hex color.
19
+
20
+ #### Scenario: Create category with color
21
+ - **WHEN** the user provides `name`, `type`, and a valid hex color (e.g., `#FF5733`)
22
+ - **THEN** the system creates the category and returns it with the assigned ID
23
+
24
+ #### Scenario: Create category without color
25
+ - **WHEN** the user provides `name` and `type` but no color
26
+ - **THEN** the system creates the category with `color` as undefined/null
27
+
28
+ #### Scenario: Validation rejects invalid color format
29
+ - **WHEN** the user provides a color that is not a valid 6-digit hex
30
+ - **THEN** the Zod schema rejects the input
31
+
32
+ #### Scenario: Validation rejects invalid type
33
+ - **WHEN** the user provides a `type` not in INCOME/EXPENSE
34
+ - **THEN** the Zod schema rejects the input
35
+
36
+ ### Requirement: List all categories
37
+ The system SHALL return all categories.
38
+
39
+ #### Scenario: Categories exist
40
+ - **WHEN** the user requests the category list
41
+ - **THEN** the system returns an array of all categories
42
+
43
+ #### Scenario: No categories exist
44
+ - **WHEN** no categories have been created
45
+ - **THEN** the system returns an empty array
46
+
47
+ ### Requirement: Get category by ID
48
+ The system SHALL return a specific category by its ID.
49
+
50
+ #### Scenario: Category found
51
+ - **WHEN** the user requests a category with a valid ID
52
+ - **THEN** the system returns the category details
53
+
54
+ #### Scenario: Category not found
55
+ - **WHEN** the user requests a category with a non-existent ID
56
+ - **THEN** the system returns a 404 error
57
+
58
+ ### Requirement: Update category
59
+ The system SHALL allow updating a category's name and/or color.
60
+
61
+ #### Scenario: Successful update
62
+ - **WHEN** the user provides a valid category ID and one or more fields to update
63
+ - **THEN** the system updates and returns the modified category
64
+
65
+ #### Scenario: Category not found on update
66
+ - **WHEN** the user attempts to update a non-existent category
67
+ - **THEN** the system returns a 404 error
68
+
69
+ ### Requirement: Delete category
70
+ The system SHALL allow deleting a category by its ID.
71
+
72
+ #### Scenario: Successful deletion
73
+ - **WHEN** the user deletes a category with a valid ID
74
+ - **THEN** the system confirms the deletion
75
+
76
+ #### Scenario: Category not found on deletion
77
+ - **WHEN** the user attempts to delete a non-existent category
78
+ - **THEN** the system returns a 404 error
@@ -0,0 +1,64 @@
1
+ # Credit Card Transactions Specification
2
+
3
+ ## Purpose
4
+ Gerenciamento de transações de cartão de crédito, incluindo compras à vista e parceladas, com cálculo automático de data de vencimento baseado no dia de fechamento do cartão.
5
+
6
+ ## Scope
7
+ O que está **incluído** nesta spec:
8
+ - Criação de transações de cartão via `POST /transactions/credit`
9
+ - Atualização de transações de cartão via `PATCH /transactions/credit/:id`
10
+ - Cálculo automático de data de vencimento
11
+ - Parcelamento com datas de vencimento distribuídas
12
+ - Recorrência com 7 frequências (WEEKLY, BIWEEKLY, MONTHLY, BIMONTHLY, QUARTERLY, SEMIANNUALLY, ANNUALLY)
13
+
14
+ O que está **fora do escopo**:
15
+ - Gestão de cartões de crédito em si (domínio: credit-cards)
16
+ - Extratos e pagamento de fatura (domínio: credit-cards)
17
+ - Transações diretas CASH/PIX/DEBIT (domínio: transactions)
18
+
19
+ ## Requirements
20
+
21
+ ### Requirement: Create credit card transaction
22
+ The system SHALL allow creating a credit card transaction via `POST /transactions/credit` with name, amount, purchaseDate, creditCardId, and optional fields (categoryId, installments, targetDueMonth, isPaid, recurrence).
23
+
24
+ #### Scenario: Successful creation
25
+ - **WHEN** the user provides `name`, `amount`, `purchaseDate`, and `creditCardId`
26
+ - **THEN** the system creates the transaction and the due date is calculated from the card's closing day
27
+
28
+ #### Scenario: Creation with installments
29
+ - **WHEN** the user provides `installments` > 1
30
+ - **THEN** the transaction is split into installments with due dates calculated from the card closing day
31
+
32
+ #### Scenario: Creation with target due month
33
+ - **WHEN** the user provides `targetDueMonth` in YYYY-MM format
34
+ - **THEN** the first installment's due date is set to the target month
35
+
36
+ #### Scenario: Creation with recurrence
37
+ - **WHEN** the user provides `recurrence` with one of the 7 supported frequencies (WEEKLY, BIWEEKLY, MONTHLY, BIMONTHLY, QUARTERLY, SEMIANNUALLY, ANNUALLY)
38
+ - **THEN** the system includes the recurrence object in the request body
39
+
40
+ ### Requirement: Update credit card transaction
41
+ The system SHALL allow updating a credit card transaction via `PATCH /transactions/credit/:id`. If `purchaseDate` or `targetDueMonth` is changed, the due date SHALL be recalculated.
42
+
43
+ #### Scenario: Successful update
44
+ - **WHEN** the user provides a valid transaction ID and one or more updateable fields
45
+ - **THEN** the system updates and returns the modified transaction
46
+
47
+ #### Scenario: Recalculation of due date
48
+ - **WHEN** the user changes `purchaseDate` or `targetDueMonth`
49
+ - **THEN** the due date is recalculated by the API
50
+
51
+ #### Scenario: Update with recurrence
52
+ - **WHEN** the user modifies the `recurrence` field
53
+ - **THEN** the recurrence object is updated with one of the 7 supported frequencies
54
+
55
+ ### Requirement: Credit card transaction input schema
56
+ The input schema for credit card transaction tools SHALL include: `name` (required), `amount` (required, min 0), `purchaseDate` (required, YYYY-MM-DD), `creditCardId` (required), `categoryId` (optional), `installments` (optional, min 1), `targetDueMonth` (optional, YYYY-MM), `isPaid` (optional, default false), `recurrence` (optional, CreditCardRecurrenceDto with 7 frequencies).
57
+
58
+ #### Scenario: Validation rejects missing required fields
59
+ - **WHEN** any of `name`, `amount`, `purchaseDate`, or `creditCardId` is missing
60
+ - **THEN** the MCP SDK rejects the input with a validation error
61
+
62
+ #### Scenario: Validation rejects invalid frequency
63
+ - **WHEN** the user provides a recurrence frequency not in the 7 supported values
64
+ - **THEN** the input is rejected by the Zod schema
@@ -0,0 +1,109 @@
1
+ # Credit Cards Specification
2
+
3
+ ## Purpose
4
+ Gerenciamento de cartões de crédito, incluindo CRUD, consultas de extrato (statement), pagamento de fatura, reabertura de fatura e antecipação de parcelas.
5
+
6
+ ## Scope
7
+ O que está **incluído** nesta spec:
8
+ - CRUD de cartões de crédito (nome, bandeira, limite, dia de fechamento, dia de vencimento)
9
+ - Consulta de extrato mensal (`/credit-cards/{id}/statement`)
10
+ - Pagamento de fatura (`pay-statement`)
11
+ - Reabertura de fatura (`reopen-statement`)
12
+ - Status de pagamento da fatura (`statement-status`)
13
+ - Antecipação de parcelas (`anticipations`)
14
+
15
+ O que está **fora do escopo**:
16
+ - Transações de cartão de crédito (domínio: credit-card-transactions)
17
+ - Criação de parcelamento manual (domínio: credit-card-transactions)
18
+
19
+ ## Requirements
20
+
21
+ ### Requirement: Create credit card
22
+ The system SHALL allow creating a new credit card with name, optional brand, limit amount, closing day (1-31), and due day (1-31).
23
+
24
+ #### Scenario: Create credit card with all fields
25
+ - **WHEN** the user provides `name`, `brand`, `limitAmount`, `closingDay`, and `dueDay`
26
+ - **THEN** the system creates the card with an `availableLimit` equal to `limitAmount`
27
+
28
+ #### Scenario: Validation rejects closing day outside range
29
+ - **WHEN** the user provides a `closingDay` less than 1 or greater than 31
30
+ - **THEN** the Zod schema rejects the input
31
+
32
+ #### Scenario: Validation rejects due day outside range
33
+ - **WHEN** the user provides a `dueDay` less than 1 or greater than 31
34
+ - **THEN** the Zod schema rejects the input
35
+
36
+ ### Requirement: List all credit cards
37
+ The system SHALL return all credit cards with their available limits.
38
+
39
+ #### Scenario: Cards exist
40
+ - **WHEN** the user requests the credit card list
41
+ - **THEN** the system returns an array of all cards with `availableLimit`
42
+
43
+ ### Requirement: Get credit card by ID
44
+ The system SHALL return a specific credit card by its ID.
45
+
46
+ #### Scenario: Card found
47
+ - **WHEN** the user requests a card with a valid ID
48
+ - **THEN** the system returns the card details including `availableLimit`
49
+
50
+ #### Scenario: Card not found
51
+ - **WHEN** the user requests a card with a non-existent ID
52
+ - **THEN** the system returns a 404 error
53
+
54
+ ### Requirement: Update credit card
55
+ The system SHALL allow updating a credit card's name, brand, limit, closing day, and/or due day.
56
+
57
+ #### Scenario: Successful update
58
+ - **WHEN** the user provides a valid card ID and one or more updateable fields
59
+ - **THEN** the system updates and returns the modified card
60
+
61
+ ### Requirement: Delete credit card
62
+ The system SHALL allow deleting a credit card by its ID.
63
+
64
+ #### Scenario: Successful deletion
65
+ - **WHEN** the user deletes a card with a valid ID
66
+ - **THEN** the system confirms the deletion
67
+
68
+ ### Requirement: Get statement
69
+ The system SHALL return the credit card statement for a specific month, including all transactions, total amount, and available limit.
70
+
71
+ #### Scenario: Statement retrieved
72
+ - **WHEN** the user provides a valid card ID and a month in YYYY-MM format
73
+ - **THEN** the system returns the statement with transactions, total, and available limit
74
+
75
+ #### Scenario: Card not found for statement
76
+ - **WHEN** the user requests a statement for a non-existent card
77
+ - **THEN** the system returns a 404 error
78
+
79
+ ### Requirement: Pay statement
80
+ The system SHALL mark all transactions in a credit card statement as paid, debiting from a specified payment account.
81
+
82
+ #### Scenario: Statement paid successfully
83
+ - **WHEN** the user provides `cardId`, `month`, and `paymentAccountId`
84
+ - **THEN** all transactions in the statement are marked as paid and the system confirms the payment
85
+
86
+ ### Requirement: Reopen statement
87
+ The system SHALL reopen a credit card statement by marking all transactions as unpaid.
88
+
89
+ #### Scenario: Statement reopened
90
+ - **WHEN** the user provides `cardId` and `month`
91
+ - **THEN** all transactions in the statement are marked as unpaid
92
+
93
+ ### Requirement: Get statement status
94
+ The system SHALL return the payment status of a credit card statement for a specific month.
95
+
96
+ #### Scenario: Status retrieved
97
+ - **WHEN** the user provides `cardId` and `month`
98
+ - **THEN** the system returns the `isPaid` status for that month
99
+
100
+ ### Requirement: Create anticipation
101
+ The system SHALL allow creating a credit card anticipation (advance payment toward a future statement). The system SHALL create a linked pair: an INCOME transaction on the credit card side and an EXPENSE transaction on the account side.
102
+
103
+ #### Scenario: Anticipation created
104
+ - **WHEN** the user provides `cardId`, `name`, `amount`, `purchaseDate`, `targetDueMonth`, `accountId`, and optional `categoryId`
105
+ - **THEN** the system creates the linked INCOME/EXPENSE transaction pair and returns the result
106
+
107
+ #### Scenario: Validation rejects amount below minimum
108
+ - **WHEN** the user provides an `amount` less than 0.01
109
+ - **THEN** the Zod schema rejects the input
@@ -0,0 +1,49 @@
1
+ # Data Import/Export Specification
2
+
3
+ ## Purpose
4
+ Backup e restauração de todos os dados do usuário (configurações, categorias, contas, cartões de crédito, regras de recorrência, transações) via exportação e importação JSON.
5
+
6
+ ## Scope
7
+ O que está **incluído** nesta spec:
8
+ - Exportação completa de todos os dados (`GET /export`)
9
+ - Importação em modo `reset` (limpa dados existentes) ou `increment` (adiciona sem duplicar)
10
+ - Validação de formato e versão do export
11
+
12
+ O que está **fora do escopo**:
13
+ - Exportação parcial por domínio ou data
14
+ - Migração entre versões de formato de export
15
+
16
+ ## Requirements
17
+
18
+ ### Requirement: Export all data
19
+ The system SHALL return all user data as a complete backup in JSON format, including settings, categories, accounts, credit cards, recurrence rules, and transactions.
20
+
21
+ #### Scenario: Successful export
22
+ - **WHEN** the user requests an export
23
+ - **THEN** the system returns a JSON object with `version`, `exportedAt`, and a `data` object containing all domains
24
+
25
+ #### Scenario: Export includes version metadata
26
+ - **WHEN** the user receives the export
27
+ - **THEN** the response includes `version` (e.g., "1.0") and `exportedAt` (ISO timestamp)
28
+
29
+ ### Requirement: Import data in reset mode
30
+ The system SHALL allow importing a previously exported backup in `reset` mode, which clears all existing data before importing.
31
+
32
+ #### Scenario: Reset import clears and replaces data
33
+ - **WHEN** the user imports with `mode: "reset"` and valid export data
34
+ - **THEN** the system clears existing records and imports all data from the backup
35
+
36
+ #### Scenario: Validation rejects wrong version
37
+ - **WHEN** the user provides a `version` that does not match "1.0"
38
+ - **THEN** the input is rejected
39
+
40
+ ### Requirement: Import data in increment mode
41
+ The system SHALL allow importing a backup in `increment` mode, which adds new records and skips any IDs that already exist.
42
+
43
+ #### Scenario: Increment import skips duplicates
44
+ - **WHEN** the user imports with `mode: "increment"` and the backup contains IDs that already exist
45
+ - **THEN** the system skips existing IDs and only imports new records
46
+
47
+ #### Scenario: Increment import adds new records
48
+ - **WHEN** the user imports with `mode: "increment"` and the backup contains new IDs
49
+ - **THEN** the system adds all new records to the existing data
@@ -0,0 +1,48 @@
1
+ # Settings Specification
2
+
3
+ ## Purpose
4
+ Configurações globais do sistema, incluindo nome do usuário, idioma e moeda padrão. Existe apenas um registro de configurações por usuário.
5
+
6
+ ## Scope
7
+ O que está **incluído** nesta spec:
8
+ - Criação (apenas se não existir), leitura e atualização de configurações
9
+ - Validação de idioma (pt-BR, en-US) e moeda (BRL, USD, EUR, GBP, JPY, CAD, AUD, CHF)
10
+
11
+ O que está **fora do escopo**:
12
+ - Preferências por feature ou módulo
13
+ - Configurações de notificação ou autenticação
14
+
15
+ ## Requirements
16
+
17
+ ### Requirement: Create settings
18
+ The system SHALL allow creating global settings with user name, language, and currency. Creation SHALL fail if settings already exist.
19
+
20
+ #### Scenario: Settings created successfully
21
+ - **WHEN** the user provides `userName`, `language` (pt-BR or en-US), and `currency` (e.g., BRL)
22
+ - **THEN** the system creates the settings with `createdAt` and returns them
23
+
24
+ #### Scenario: Validation rejects invalid language
25
+ - **WHEN** the user provides a `language` not in [pt-BR, en-US]
26
+ - **THEN** the Zod schema rejects the input
27
+
28
+ #### Scenario: Validation rejects invalid currency
29
+ - **WHEN** the user provides a `currency` not in [BRL, USD, EUR, GBP, JPY, CAD, AUD, CHF]
30
+ - **THEN** the Zod schema rejects the input
31
+
32
+ ### Requirement: Get settings
33
+ The system SHALL return the current global settings.
34
+
35
+ #### Scenario: Settings exist
36
+ - **WHEN** the user requests the settings
37
+ - **THEN** the system returns the settings object
38
+
39
+ #### Scenario: Settings do not exist
40
+ - **WHEN** no settings have been created
41
+ - **THEN** the system returns an empty or null response (or 404)
42
+
43
+ ### Requirement: Update settings
44
+ The system SHALL allow updating existing settings fields (userName, language, currency). The update SHALL use PUT (full replace).
45
+
46
+ #### Scenario: Successful update
47
+ - **WHEN** the user provides one or more settings fields to update
48
+ - **THEN** the system updates the settings and returns the modified object with updated `updatedAt` timestamp
@@ -0,0 +1,85 @@
1
+ # Subscriptions Specification
2
+
3
+ ## Purpose
4
+ Gerenciamento de assinaturas e pagamentos recorrentes vinculados a cartões de crédito (ex: Netflix, Spotify). Cada assinatura gera transações automáticas no cartão no dia de faturamento configurado.
5
+
6
+ ## Scope
7
+ O que está **incluído** nesta spec:
8
+ - CRUD de assinaturas (nome, valor, dia de faturamento, cartão, categoria)
9
+ - Ativação/desativação (soft delete) e reativação
10
+ - Exclusão permanente (hard delete)
11
+ - Listagem de assinaturas ativas
12
+
13
+ O que está **fora do escopo**:
14
+ - Geração automática de transações (comportamento do backend da API)
15
+ - Transações de cartão avulsas (domínio: credit-card-transactions)
16
+
17
+ ## Requirements
18
+
19
+ ### Requirement: Create subscription
20
+ The system SHALL allow creating a new subscription with a name, amount, billing day (1-31), credit card ID, and optional category ID.
21
+
22
+ #### Scenario: Create subscription with all fields
23
+ - **WHEN** the user provides `name`, `amount`, `billingDay`, `creditCardId`, and `categoryId`
24
+ - **THEN** the system creates the subscription as active and returns it with assigned ID
25
+
26
+ #### Scenario: Validation rejects billing day outside range
27
+ - **WHEN** the user provides a `billingDay` less than 1 or greater than 31
28
+ - **THEN** the Zod schema rejects the input
29
+
30
+ ### Requirement: List all subscriptions
31
+ The system SHALL return all subscriptions regardless of active status.
32
+
33
+ #### Scenario: Subscriptions exist
34
+ - **WHEN** the user requests the subscription list
35
+ - **THEN** the system returns an array of all subscriptions
36
+
37
+ ### Requirement: List active subscriptions
38
+ The system SHALL return only active subscriptions.
39
+
40
+ #### Scenario: Active subscriptions exist
41
+ - **WHEN** the user requests active subscriptions
42
+ - **THEN** the system returns only subscriptions where `active` is true
43
+
44
+ ### Requirement: Get subscription by ID
45
+ The system SHALL return a specific subscription by its ID.
46
+
47
+ #### Scenario: Subscription found
48
+ - **WHEN** the user requests a subscription with a valid ID
49
+ - **THEN** the system returns the subscription details
50
+
51
+ #### Scenario: Subscription not found
52
+ - **WHEN** the user requests a subscription with a non-existent ID
53
+ - **THEN** the system returns a 404 error
54
+
55
+ ### Requirement: Update subscription
56
+ The system SHALL allow updating a subscription's name, amount, billing day, credit card ID, category ID, and/or active status.
57
+
58
+ #### Scenario: Successful update
59
+ - **WHEN** the user provides a valid subscription ID and one or more updateable fields
60
+ - **THEN** the system updates and returns the modified subscription
61
+
62
+ ### Requirement: Deactivate subscription
63
+ The system SHALL allow deactivating (soft delete) a subscription by its ID.
64
+
65
+ #### Scenario: Successful deactivation
66
+ - **WHEN** the user deactivates a subscription with a valid ID
67
+ - **THEN** the subscription's `active` field is set to false
68
+
69
+ #### Scenario: Subscription not found on deactivation
70
+ - **WHEN** the user attempts to deactivate a non-existent subscription
71
+ - **THEN** the system returns a 404 error
72
+
73
+ ### Requirement: Permanently delete subscription
74
+ The system SHALL allow permanently deleting (hard delete) a subscription by its ID.
75
+
76
+ #### Scenario: Successful permanent deletion
77
+ - **WHEN** the user permanently deletes a subscription with a valid ID
78
+ - **THEN** the subscription is removed from the database
79
+
80
+ ### Requirement: Reactivate subscription
81
+ The system SHALL allow reactivating a previously deactivated subscription.
82
+
83
+ #### Scenario: Successful reactivation
84
+ - **WHEN** the user reactivates a deactivated subscription
85
+ - **THEN** the subscription's `active` field is set to true
@@ -0,0 +1,49 @@
1
+ # Summary Specification
2
+
3
+ ## Purpose
4
+ Resumo financeiro consolidado de um período, incluindo receitas, despesas, saldos de contas, totais de cartão de crédito e detalhamento por categoria.
5
+
6
+ ## Scope
7
+ O que está **incluído** nesta spec:
8
+ - Resumo por mês (YYYY-MM) ou intervalo customizado (startDate + endDate em YYYY-MM-DD)
9
+ - Totais de receita e despesa (pagos e pendentes)
10
+ - Saldo total e por conta
11
+ - Despesas de cartão de crédito e detalhamento por categoria
12
+
13
+ O que está **fora do escopo**:
14
+ - Geração de extratos individuais de cartão (domínio: credit-cards)
15
+ - Listagem de transações individuais (domínio: transactions)
16
+
17
+ ## Requirements
18
+
19
+ ### Requirement: Get summary by month
20
+ The system SHALL return a financial summary for a given month in YYYY-MM format, including income, expenses, balance, credit card totals, and category breakdowns.
21
+
22
+ #### Scenario: Monthly summary retrieved
23
+ - **WHEN** the user provides `month` in YYYY-MM format
24
+ - **THEN** the system returns income, expenses, balance, credit card expenses, expenses/income by category, and account balances for that month
25
+
26
+ #### Scenario: Monthly summary for month with no data
27
+ - **WHEN** the user requests a summary for a month with no transactions
28
+ - **THEN** the system returns zeros for all numeric fields
29
+
30
+ ### Requirement: Get summary by date range
31
+ The system SHALL return a financial summary for a custom date range defined by `startDate` and `endDate` (both in YYYY-MM-DD format).
32
+
33
+ #### Scenario: Range summary retrieved
34
+ - **WHEN** the user provides both `startDate` and `endDate`
35
+ - **THEN** the system returns the aggregated financial data for that period
36
+
37
+ ### Requirement: Validation requires period parameters
38
+ The system SHALL require either `month` OR both `startDate` and `endDate`.
39
+
40
+ #### Scenario: No parameters provided
41
+ - **WHEN** the user provides neither `month` nor `startDate`+`endDate`
42
+ - **THEN** the API returns a 400 error
43
+
44
+ ### Requirement: Pending income and expenses included
45
+ The summary SHALL include both paid and pending amounts separately.
46
+
47
+ #### Scenario: Pending transactions exist
48
+ - **WHEN** the period contains unpaid income or expense transactions
49
+ - **THEN** the summary includes `pendingIncome` and `pendingExpenses` fields