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
package/openapi.yaml CHANGED
@@ -492,10 +492,10 @@ paths:
492
492
  '201':
493
493
  description: Transaction created successfully.
494
494
  '400':
495
- description: Invalid input.
495
+ description: Invalid input. Use POST /transactions/credit for credit card transactions.
496
496
  security: &ref_9
497
497
  - bearer: []
498
- summary: Create a new transaction
498
+ summary: Create a new transaction (CASH, PIX, or DEBIT only)
499
499
  tags: &ref_10
500
500
  - transactions
501
501
  get:
@@ -633,7 +633,7 @@ paths:
633
633
  '404':
634
634
  description: Transaction not found.
635
635
  security: *ref_9
636
- summary: Update a transaction
636
+ summary: Update a transaction (CASH, PIX, or DEBIT only)
637
637
  tags: *ref_10
638
638
  delete:
639
639
  operationId: remove
@@ -709,6 +709,60 @@ paths:
709
709
  security: *ref_9
710
710
  summary: Mark a transaction as unpaid
711
711
  tags: *ref_10
712
+ /transactions/credit:
713
+ post:
714
+ operationId: createCreditCard
715
+ parameters:
716
+ - &ref_8
717
+ name: x-api-key
718
+ in: header
719
+ required: false
720
+ schema:
721
+ type: string
722
+ requestBody:
723
+ required: true
724
+ content:
725
+ application/json:
726
+ schema:
727
+ $ref: '#/components/schemas/CreateCreditCardTransactionDto'
728
+ responses:
729
+ '201':
730
+ description: Credit card transaction created successfully.
731
+ '400':
732
+ description: Invalid input.
733
+ security: *ref_9
734
+ summary: Create a new credit card transaction
735
+ description: Creates a credit card transaction. The due date is automatically calculated based on the purchase date and the card closing day. Use targetDueMonth to specify a particular billing month.
736
+ tags: *ref_10
737
+ /transactions/credit/{id}:
738
+ patch:
739
+ operationId: updateCreditCard
740
+ parameters:
741
+ - *ref_8
742
+ - name: id
743
+ required: true
744
+ in: path
745
+ schema:
746
+ type: string
747
+ requestBody:
748
+ required: true
749
+ content:
750
+ application/json:
751
+ schema:
752
+ $ref: '#/components/schemas/UpdateCreditCardTransactionDto'
753
+ responses:
754
+ '200':
755
+ description: Credit card transaction updated successfully.
756
+ content:
757
+ application/json:
758
+ schema:
759
+ $ref: '#/components/schemas/TransactionWithRelationsDto'
760
+ '404':
761
+ description: Transaction not found.
762
+ security: *ref_9
763
+ summary: Update a credit card transaction
764
+ description: Updates a credit card transaction. If purchaseDate or targetDueMonth is changed, the due date is recalculated.
765
+ tags: *ref_10
712
766
  /summary:
713
767
  get:
714
768
  description: >-
@@ -1918,7 +1972,7 @@ info:
1918
1972
 
1919
1973
  Todos os endpoints da API são relativos a: `http://localhost:3000/api`
1920
1974
 
1921
- version: 1.2.0
1975
+ version: 1.2.5
1922
1976
  contact:
1923
1977
  name: Quantix Support
1924
1978
  url: https://github.com/marcosnunesmbs/quantix
@@ -2144,19 +2198,17 @@ components:
2144
2198
  - EXPENSE
2145
2199
  example: EXPENSE
2146
2200
  name:
2147
- type: object
2201
+ type: string
2148
2202
  description: Name or description of the transaction
2149
2203
  example: Grocery shopping
2150
2204
  amount:
2151
- type: object
2205
+ type: number
2152
2206
  description: Amount of the transaction
2153
2207
  example: 125.75
2154
2208
  minimum: 0
2155
2209
  date:
2156
- type: object
2157
- description: >-
2158
- Date of the transaction (for credit cards, this will be overridden
2159
- by the due day of the card if targetDueMonth is provided)
2210
+ type: string
2211
+ description: Date of the transaction
2160
2212
  example: '2026-01-30'
2161
2213
  categoryId:
2162
2214
  type: string
@@ -2164,28 +2216,21 @@ components:
2164
2216
  example: cat_123456789
2165
2217
  paymentMethod:
2166
2218
  type: string
2167
- description: Method of payment
2219
+ description: Method of payment (CASH, PIX, or DEBIT only)
2168
2220
  enum: &ref_35
2169
2221
  - CASH
2170
2222
  - PIX
2171
2223
  - DEBIT
2172
- - CREDIT
2173
- example: CREDIT
2174
- creditCardId:
2175
- type: string
2176
- description: >-
2177
- ID of the associated credit card (required if paymentMethod is
2178
- CREDIT)
2179
- example: cc_123456789
2224
+ example: CASH
2180
2225
  installments:
2181
2226
  type: number
2182
2227
  description: Number of installments (optional)
2183
2228
  example: 3
2184
2229
  minimum: 1
2185
- targetDueMonth:
2230
+ accountId:
2186
2231
  type: string
2187
- description: Target month for due date in YYYY-MM format (optional)
2188
- example: 2026-03
2232
+ description: ID of the associated account (required for direct payments)
2233
+ example: acc_123456789
2189
2234
  isRecurring:
2190
2235
  type: boolean
2191
2236
  description: Whether the transaction is recurring
@@ -2195,26 +2240,18 @@ components:
2195
2240
  description: Recurrence information (optional)
2196
2241
  allOf:
2197
2242
  - $ref: '#/components/schemas/RecurrenceDto'
2198
- accountId:
2199
- type: string
2200
- description: >-
2201
- ID of the associated account (required if paymentMethod is not
2202
- CREDIT)
2203
- example: acc_123456789
2204
2243
  isPaid:
2205
2244
  type: boolean
2206
2245
  description: Whether the transaction has been paid
2207
2246
  example: false
2208
2247
  default: false
2209
- purchaseDate:
2210
- type: string
2211
- description: Actual purchase date (credit card only)
2212
- example: '2026-02-10'
2213
2248
  required:
2214
2249
  - type
2215
2250
  - name
2216
2251
  - amount
2217
2252
  - date
2253
+ - paymentMethod
2254
+ - accountId
2218
2255
  CategoryDto:
2219
2256
  type: object
2220
2257
  properties:
@@ -2406,19 +2443,17 @@ components:
2406
2443
  enum: *ref_34
2407
2444
  example: EXPENSE
2408
2445
  name:
2409
- type: object
2446
+ type: string
2410
2447
  description: Name or description of the transaction
2411
2448
  example: Grocery shopping
2412
2449
  amount:
2413
- type: object
2450
+ type: number
2414
2451
  description: Amount of the transaction
2415
2452
  example: 125.75
2416
2453
  minimum: 0
2417
2454
  date:
2418
- type: object
2419
- description: >-
2420
- Date of the transaction (for credit cards, this will be overridden
2421
- by the due day of the card if targetDueMonth is provided)
2455
+ type: string
2456
+ description: Date of the transaction
2422
2457
  example: '2026-01-30'
2423
2458
  categoryId:
2424
2459
  type: string
@@ -2426,15 +2461,9 @@ components:
2426
2461
  example: cat_123456789
2427
2462
  paymentMethod:
2428
2463
  type: string
2429
- description: Method of payment
2464
+ description: Method of payment (CASH, PIX, or DEBIT only)
2430
2465
  enum: *ref_35
2431
- example: CREDIT
2432
- creditCardId:
2433
- type: string
2434
- description: >-
2435
- ID of the associated credit card (required if paymentMethod is
2436
- CREDIT)
2437
- example: cc_123456789
2466
+ example: CASH
2438
2467
  installments:
2439
2468
  type: number
2440
2469
  description: Number of installments (optional)
@@ -2442,11 +2471,9 @@ components:
2442
2471
  minimum: 1
2443
2472
  targetDueMonth:
2444
2473
  type: string
2445
- description: >-
2446
- Target month for due date in YYYY-MM format (optional). When
2447
- provided for CREDIT payments, the transaction date will be set to
2448
- the credit card's due day in the specified month.
2474
+ description: Target month for due date in YYYY-MM format.
2449
2475
  example: 2026-03
2476
+ pattern: '^\d{4}-\d{2}$'
2450
2477
  isRecurring:
2451
2478
  type: boolean
2452
2479
  description: Whether the transaction is recurring
@@ -2458,19 +2485,150 @@ components:
2458
2485
  - $ref: '#/components/schemas/RecurrenceDto'
2459
2486
  accountId:
2460
2487
  type: string
2461
- description: >-
2462
- ID of the associated account (required if paymentMethod is not
2463
- CREDIT)
2488
+ description: ID of the associated account
2464
2489
  example: acc_123456789
2465
2490
  isPaid:
2466
2491
  type: boolean
2467
2492
  description: Whether the transaction has been paid
2468
2493
  example: false
2469
2494
  default: false
2495
+ CreditCardRecurrenceDto:
2496
+ type: object
2497
+ properties:
2498
+ frequency:
2499
+ type: string
2500
+ description: Frequency of recurrence
2501
+ enum:
2502
+ - WEEKLY
2503
+ - BIWEEKLY
2504
+ - MONTHLY
2505
+ - BIMONTHLY
2506
+ - QUARTERLY
2507
+ - SEMIANNUALLY
2508
+ - ANNUALLY
2509
+ example: MONTHLY
2510
+ interval:
2511
+ type: number
2512
+ description: Interval between recurrences
2513
+ example: 1
2514
+ minimum: 1
2515
+ default: 1
2516
+ startDate:
2517
+ type: string
2518
+ description: Start date for recurrence (defaults to purchase date)
2519
+ example: '2026-01-30'
2520
+ endDate:
2521
+ type: string
2522
+ description: End date for recurrence (optional)
2523
+ example: '2026-12-31'
2524
+ occurrences:
2525
+ type: number
2526
+ description: Number of occurrences (optional)
2527
+ example: 12
2528
+ minimum: 2
2529
+ required:
2530
+ - frequency
2531
+ - interval
2532
+ CreateCreditCardTransactionDto:
2533
+ type: object
2534
+ properties:
2535
+ name:
2536
+ type: string
2537
+ description: Name or description of the transaction
2538
+ example: Eletrônicos na loja X
2539
+ amount:
2540
+ type: number
2541
+ description: Amount of the transaction (total for installments)
2542
+ example: 1250
2543
+ minimum: 0
2544
+ purchaseDate:
2545
+ type: string
2546
+ description: Actual purchase date (the day you bought the item)
2547
+ example: '2026-02-10'
2548
+ creditCardId:
2549
+ type: string
2550
+ description: ID of the credit card to charge
2551
+ example: cc_123456789
2552
+ categoryId:
2553
+ type: string
2554
+ description: ID of the associated category
2555
+ example: cat_123456789
2556
+ installments:
2557
+ type: number
2558
+ description: Number of installments (optional)
2559
+ example: 3
2560
+ minimum: 1
2561
+ targetDueMonth:
2562
+ type: string
2563
+ description: Target month for due date in YYYY-MM format
2564
+ example: '2026-03'
2565
+ isRecurring:
2566
+ type: boolean
2567
+ description: Whether the transaction is recurring
2568
+ example: false
2569
+ default: false
2570
+ recurrence:
2571
+ description: Recurrence information (optional)
2572
+ allOf:
2573
+ - $ref: '#/components/schemas/CreditCardRecurrenceDto'
2574
+ isPaid:
2575
+ type: boolean
2576
+ description: Whether the transaction has been paid
2577
+ example: false
2578
+ default: false
2579
+ required:
2580
+ - name
2581
+ - amount
2582
+ - purchaseDate
2583
+ - creditCardId
2584
+ UpdateCreditCardTransactionDto:
2585
+ type: object
2586
+ properties:
2587
+ name:
2588
+ type: string
2589
+ description: Name or description of the transaction
2590
+ example: Eletrônicos na loja X
2591
+ amount:
2592
+ type: number
2593
+ description: Amount of the transaction
2594
+ example: 1250
2595
+ minimum: 0
2470
2596
  purchaseDate:
2471
2597
  type: string
2472
- description: Actual purchase date (credit card only)
2598
+ description: Actual purchase date
2473
2599
  example: '2026-02-10'
2600
+ creditCardId:
2601
+ type: string
2602
+ description: ID of the credit card
2603
+ example: cc_123456789
2604
+ categoryId:
2605
+ type: string
2606
+ description: ID of the associated category
2607
+ example: cat_123456789
2608
+ installments:
2609
+ type: number
2610
+ description: Number of installments
2611
+ example: 3
2612
+ minimum: 1
2613
+ targetDueMonth:
2614
+ type: string
2615
+ description: Target month for due date in YYYY-MM format
2616
+ example: '2026-03'
2617
+ pattern: '^\d{4}-\d{2}$'
2618
+ isRecurring:
2619
+ type: boolean
2620
+ description: Whether the transaction is recurring
2621
+ example: false
2622
+ default: false
2623
+ recurrence:
2624
+ description: Recurrence information (optional)
2625
+ allOf:
2626
+ - $ref: '#/components/schemas/CreditCardRecurrenceDto'
2627
+ isPaid:
2628
+ type: boolean
2629
+ description: Whether the transaction has been paid
2630
+ example: false
2631
+ default: false
2474
2632
  CreateCreditCardDto:
2475
2633
  type: object
2476
2634
  properties:
@@ -0,0 +1,33 @@
1
+ # OpenSpec — Quantix MCP Server
2
+
3
+ Especificações comportamentais do sistema, organizadas por domínio.
4
+
5
+ ## Estrutura
6
+
7
+ ### specs/
8
+ Source of truth — como o sistema atualmente se comporta.
9
+
10
+ | Domínio | Descrição | # Requirements |
11
+ |---------|-----------|:-:|
12
+ | [accounts](specs/accounts/spec.md) | Contas financeiras (CRUD + saldo) | 6 |
13
+ | [categories](specs/categories/spec.md) | Categorias de classificação (CRUD) | 5 |
14
+ | [credit-cards](specs/credit-cards/spec.md) | Cartões de crédito (CRUD + extratos + antecipação) | 10 |
15
+ | [credit-card-transactions](specs/credit-card-transactions/spec.md) | Transações de cartão de crédito (criar/atualizar) | 3 |
16
+ | [data](specs/data/spec.md) | Exportação e importação de backup | 3 |
17
+ | [settings](specs/settings/spec.md) | Configurações globais (usuário, idioma, moeda) | 3 |
18
+ | [subscriptions](specs/subscriptions/spec.md) | Assinaturas e pagamentos recorrentes | 8 |
19
+ | [summary](specs/summary/spec.md) | Resumo financeiro consolidado | 4 |
20
+ | [transactions](specs/transactions/spec.md) | Transações diretas (CASH, PIX, DEBIT) | 8 |
21
+ | [transfers](specs/transfers/spec.md) | Transferências entre contas | 5 |
22
+
23
+ **Total: 10 domínios, ~55 requirements**
24
+
25
+ ### changes/
26
+ Modificações propostas. Cada change vive em sua própria pasta até ser mergeada.
27
+
28
+ ## Convenções
29
+
30
+ - Requisitos usam keywords RFC 2119 (SHALL, MUST, SHOULD, MAY)
31
+ - Cenários seguem formato **WHEN**/**THEN**
32
+ - Specs descrevem **comportamento**, não implementação
33
+ - Delta specs vivem em `changes/<name>/specs/` e são syncadas para `specs/` ao arquivar
@@ -0,0 +1,2 @@
1
+ schema: spec-driven
2
+ created: 2026-04-03
@@ -0,0 +1,60 @@
1
+ ## Context
2
+
3
+ O MCP server `quantix-mcp` expõe ferramentas de transação para um LLM via Model Context Protocol. Atualmente existem duas tools genéricas:
4
+ - `create_transaction`: envia tudo para `POST /transactions`
5
+ - `update_transaction`: envia tudo para `PATCH /transactions/:id`
6
+
7
+ A API Quantix evoluiu e agora rejeita transações de cartão na rota genérica (HTTP 400 com mensagem "Use POST /transactions/credit for credit card transactions"). As rotas dedicadas são:
8
+ - `POST /transactions/credit` → cria transações de cartão
9
+ - `PATCH /transactions/credit/:id` → atualiza transações de cartão
10
+
11
+ Os schemas de input também divergem: o recurrence de cartão suporta 7 frequências (BIWEEKLY, BIMONTHLY, QUARTERLY, SEMIANNUALLY, ANNUALLY além de WEEKLY/MONTHLY/YEARLY), enquanto o genérico suporta apenas 3.
12
+
13
+ ## Goals / Non-Goals
14
+
15
+ **Goals:**
16
+ - Separar tools de cartão em `create_credit_transaction` e `update_credit_transaction` com schemas próprios
17
+ - Restringir `create_transaction` e `update_transaction` a métodos diretos (CASH, PIX, DEBIT)
18
+ - Alinhar schemas do MCP aos DTOs da API (RecurrenceDto vs CreditCardRecurrenceDto)
19
+ - Manter `delete_transaction`, `get_transactions`, `get_transaction`, `pay_transaction`, `unpay_transaction` inalteradas
20
+
21
+ **Non-Goals:**
22
+ - Não alterar a lógica de outras domains (accounts, categories, credit-cards, subscriptions)
23
+ - Não modificar o schema de entidade `TransactionSchema` (representa a resposta da API, que é unificada via `TransactionWithRelationsDto`)
24
+ - Não adicionar novas funcionalidades além da separação de rotas
25
+
26
+ ## Decisions
27
+
28
+ ### 1. Tools separadas vs roteamento interno
29
+
30
+ **Decisão:** Tools separadas (`create_credit_transaction`, `update_credit_transaction`).
31
+
32
+ **Razão:** Os schemas de input são diferentes (campos obrigatórios diferentes, recurrence com enums diferentes). Tools separadas dão descrições mais precisas ao LLM, melhorando a qualidade das escolhas de tool. A API já trata como domínios distintos.
33
+
34
+ **Alternativa considerada:** Roteamento interno baseado em `paymentMethod`. Rejeitada porque esconde complexidade, torna descrições ambíguas, e o `UpdateTransactionDto` não tem `paymentMethod` como campo obrigatório — não haveria como detectar reliably.
35
+
36
+ ### 2. Schema de recurrence
37
+
38
+ **Decisão:** Manter dois schemas de recurrence distintos no MCP:
39
+ - `TransactionRecurrenceSchema`: 3 frequências (WEEKLY, MONTHLY, YEARLY) — para transações diretas
40
+ - `CreditCardRecurrenceSchema`: 7 frequências — para transações de cartão
41
+
42
+ **Razão:** Espelha exatamente os DTOs da API (`RecurrenceDto` vs `CreditCardRecurrenceDto`). Evita que o LLM tente usar `BIWEEKLY` em transações diretas.
43
+
44
+ ### 3. Tratamento de campos removidos
45
+
46
+ **Decisão:** Remover silenciosamente `paymentMethod: "CREDIT"`, `creditCardId`, `targetDueMonth`, `purchaseDate` dos schemas de transação direta. Se o LLM tentar usar, a validação Zod rejeitará o campo.
47
+
48
+ **Razão:** Zod valida estritamente — campos não declarados serão rejeitados pelo SDK do MCP antes mesmo de chegar na API. Não é necessário tratamento especial.
49
+
50
+ ### 4. Estrutura de arquivos
51
+
52
+ **Decisão:** Manter tudo em `src/tools/transactions.ts`. São 4 tools no mesmo domínio, não justifica separação de arquivo.
53
+
54
+ ## Risks / Trade-offs
55
+
56
+ | Risco | Mitigação |
57
+ |-------|-----------|
58
+ | LLM tenta usar `create_transaction` com cartão e recebe erro de validação | Descrições claras nas tools indicando "não use para cartão" |
59
+ | Quebra de compatibilidade para clientes existentes | É intencional — o comportamento antigo já retornava 400 da API |
60
+ | Dois schemas de recurrence aumentam complexidade | Nomes claros (`TransactionRecurrenceSchema` vs `CreditCardRecurrenceSchema`) + descrições |
@@ -0,0 +1,25 @@
1
+ ## Why
2
+
3
+ A API Quantix separou as rotas de transações: `POST /transactions` agora aceita apenas `CASH|PIX|DEBIT`, enquanto `POST /transactions/credit` é a rota dedicada para transações de cartão. O MCP server ainda possui uma única tool `create_transaction` genérica que envia tudo para `/transactions`, resultando em erro 400 quando `paymentMethod` é `CREDIT`. O mesmo problema ocorre no `update_transaction`.
4
+
5
+ ## What Changes
6
+
7
+ - **`create_transaction`**: Removidos os campos exclusivos de cartão (`paymentMethod: "CREDIT"`, `creditCardId`, `targetDueMonth`). Agora envia apenas para `POST /transactions`.
8
+ - **`update_transaction`**: Removidos os campos exclusivos de cartão (`paymentMethod: "CREDIT"`, `creditCardId`, `targetDueMonth`, `purchaseDate`). Agora envia apenas para `PATCH /transactions/:id`.
9
+ - **Nova tool `create_credit_transaction`**: Tool dedicada para criar transações de cartão via `POST /transactions/credit`, com schema próprio (`purchaseDate`, `creditCardId`, `installments`, `targetDueMonth`, recurrence com 7 frequências).
10
+ - **Nova tool `update_credit_transaction`**: Tool dedicada para atualizar transações de cartão via `PATCH /transactions/credit/:id`, com schema próprio.
11
+ - **`delete_transaction`**: Permanece inalterada (a rota de delete é compartilhada).
12
+
13
+ ## Capabilities
14
+
15
+ ### New Capabilities
16
+ - `credit-card-transactions`: Criação e atualização de transações de cartão de crédito com schema próprio (purchaseDate, targetDueMonth, installments, recurrence estendida).
17
+
18
+ ### Modified Capabilities
19
+ - `transactions`: Requisitos de criação e atualização agora restritos a métodos diretos (CASH, PIX, DEBIT). Campos de cartão removidos do schema de input.
20
+
21
+ ## Impact
22
+
23
+ - `src/types/schemas.ts`: Reorganização dos schemas de input; adição de schemas específicos para cartão.
24
+ - `src/tools/transactions.ts`: Separação em 4 tools distintas; remoção de campos de cartão das tools genéricas.
25
+ - Clients MCP que usavam `create_transaction` com `paymentMethod: "CREDIT"` precisarão migrar para `create_credit_transaction`.
@@ -0,0 +1,46 @@
1
+ ## ADDED Requirements
2
+
3
+ ### Requirement: Create credit card transaction
4
+ The system SHALL provide a `create_credit_transaction` tool that sends a POST request to `/transactions/credit` with a schema specific to credit card transactions.
5
+
6
+ #### Scenario: Successful creation
7
+ - **WHEN** the user provides `name`, `amount`, `purchaseDate`, and `creditCardId`
8
+ - **THEN** the system calls `POST /transactions/credit` and returns the created transaction
9
+
10
+ #### Scenario: Creation with installments
11
+ - **WHEN** the user provides `installments` > 1
12
+ - **THEN** the transaction is split into installments with the due date calculated from the card closing day
13
+
14
+ #### Scenario: Creation with target due month
15
+ - **WHEN** the user provides `targetDueMonth` in YYYY-MM format
16
+ - **THEN** the first installment's due date is set to the target month
17
+
18
+ #### Scenario: Creation with recurrence
19
+ - **WHEN** the user provides `recurrence` with one of the 7 supported frequencies (WEEKLY, BIWEEKLY, MONTHLY, BIMONTHLY, QUARTERLY, SEMIANNUALLY, ANNUALLY)
20
+ - **THEN** the system includes the recurrence object in the request body
21
+
22
+ ### Requirement: Update credit card transaction
23
+ The system SHALL provide an `update_credit_transaction` tool that sends a PATCH request to `/transactions/credit/:id` with a schema specific to credit card transactions.
24
+
25
+ #### Scenario: Successful update
26
+ - **WHEN** the user provides a valid transaction ID and one or more updateable fields
27
+ - **THEN** the system calls `PATCH /transactions/credit/:id` and returns the updated transaction
28
+
29
+ #### Scenario: Recalculation of due date
30
+ - **WHEN** the user changes `purchaseDate` or `targetDueMonth`
31
+ - **THEN** the due date is recalculated by the API
32
+
33
+ #### Scenario: Update with recurrence
34
+ - **WHEN** the user modifies the `recurrence` field
35
+ - **THEN** the recurrence object is updated with one of the 7 supported frequencies
36
+
37
+ ### Requirement: Credit card transaction input schema
38
+ The input schema for credit card transaction tools SHALL include the following fields: `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).
39
+
40
+ #### Scenario: Validation rejects missing required fields
41
+ - **WHEN** any of `name`, `amount`, `purchaseDate`, or `creditCardId` is missing
42
+ - **THEN** the MCP SDK rejects the input with a validation error
43
+
44
+ #### Scenario: Validation rejects invalid frequency
45
+ - **WHEN** the user provides a recurrence frequency not in the 7 supported values
46
+ - **THEN** the input is rejected by the Zod schema
@@ -0,0 +1,42 @@
1
+ ## ADDED Requirements
2
+
3
+ ### Requirement: Create direct transaction only
4
+ The `create_transaction` tool SHALL only support direct payment methods: CASH, PIX, and DEBIT. It SHALL send a POST request to `/transactions` and SHALL NOT accept credit-card-specific fields.
5
+
6
+ #### Scenario: Successful direct transaction creation
7
+ - **WHEN** the user provides `type`, `name`, `amount`, `date`, `paymentMethod` (CASH, PIX, or DEBIT), and `accountId`
8
+ - **THEN** the system calls `POST /transactions` and returns the created transaction
9
+
10
+ #### Scenario: Validation rejects credit card fields
11
+ - **WHEN** the user attempts to provide `creditCardId`, `targetDueMonth`, or `purchaseDate`
12
+ - **THEN** the Zod schema rejects the input as those fields are not part of the direct transaction schema
13
+
14
+ #### Scenario: Validation rejects CREDIT payment method
15
+ - **WHEN** the user provides `paymentMethod` as "CREDIT"
16
+ - **THEN** the Zod schema rejects the input as the enum only allows CASH, PIX, DEBIT
17
+
18
+ ### Requirement: Update direct transaction only
19
+ The `update_transaction` tool SHALL only support updating direct payment method transactions. It SHALL send a PATCH request to `/transactions/:id` and SHALL NOT accept credit-card-specific fields.
20
+
21
+ #### Scenario: Successful direct transaction update
22
+ - **WHEN** the user provides a valid transaction ID and one or more updateable fields (type, name, amount, date, categoryId, paymentMethod, accountId, isPaid)
23
+ - **THEN** the system calls `PATCH /transactions/:id` and returns the updated transaction
24
+
25
+ #### Scenario: Recurring transaction update mode
26
+ - **WHEN** the user provides `mode` as SINGLE, PENDING, or ALL
27
+ - **THEN** the update is applied according to the mode (only this transaction, this and future pending, or all in the series)
28
+
29
+ #### Scenario: Validation rejects credit card fields
30
+ - **WHEN** the user attempts to provide `creditCardId`, `targetDueMonth`, or `purchaseDate`
31
+ - **THEN** the Zod schema rejects the input as those fields are not part of the direct transaction schema
32
+
33
+ ### Requirement: Direct transaction recurrence
34
+ The recurrence for direct transactions SHALL support only 3 frequencies: WEEKLY, MONTHLY, YEARLY.
35
+
36
+ #### Scenario: Valid recurrence frequencies
37
+ - **WHEN** the user provides a recurrence with WEEKLY, MONTHLY, or YEARLY
38
+ - **THEN** the request is accepted
39
+
40
+ #### Scenario: Invalid recurrence frequency
41
+ - **WHEN** the user provides BIWEEKLY, BIMONTHLY, QUARTERLY, SEMIANNUALLY, or ANNUALLY
42
+ - **THEN** the Zod schema rejects the input
@@ -0,0 +1,22 @@
1
+ ## 1. Schema definitions
2
+
3
+ - [x] 1.1 Create `CreditCardRecurrenceSchema` in `src/types/schemas.ts` with 7 frequencies (WEEKLY, BIWEEKLY, MONTHLY, BIMONTHLY, QUARTERLY, SEMIANNUALLY, ANNUALLY)
4
+ - [x] 1.2 Create `CreateCreditCardTransactionInput` schema with required fields (name, amount, purchaseDate, creditCardId) and optional fields (categoryId, installments, targetDueMonth, isPaid, recurrence)
5
+ - [x] 1.3 Create `UpdateCreditCardTransactionInput` schema with all fields optional
6
+ - [x] 1.4 Remove `paymentMethod: "CREDIT"`, `creditCardId`, `targetDueMonth` from `CreateTransactionInput`; keep `installments`
7
+ - [x] 1.5 Remove `paymentMethod: "CREDIT"`, `creditCardId`, `targetDueMonth`, `purchaseDate` from `UpdateTransactionInput`; keep `installments`
8
+
9
+ ## 2. Transaction tools (direct payments)
10
+
11
+ - [x] 2.1 Update `create_transaction` tool to POST to `/transactions` with cleaned schema; update description to clarify "CASH, PIX, or DEBIT only"
12
+ - [x] 2.2 Update `update_transaction` tool to PATCH `/transactions/:id` with cleaned schema; update description to clarify "CASH, PIX, or DEBIT only"
13
+
14
+ ## 3. Credit card transaction tools (new)
15
+
16
+ - [x] 3.1 Register `create_credit_transaction` tool that POSTs to `/transactions/credit` with `CreateCreditCardTransactionInput` schema
17
+ - [x] 3.2 Register `update_credit_transaction` tool that PATCHes `/transactions/credit/:id` with `UpdateCreditCardTransactionInput` schema
18
+
19
+ ## 4. Verification
20
+
21
+ - [x] 4.1 Run `npm run build` and confirm no TypeScript errors
22
+ - [x] 4.2 Run `npm test` and confirm all tests pass
@@ -0,0 +1,20 @@
1
+ schema: spec-driven
2
+
3
+ # Project context (optional)
4
+ # This is shown to AI when creating artifacts.
5
+ # Add your tech stack, conventions, style guides, domain knowledge, etc.
6
+ # Example:
7
+ # context: |
8
+ # Tech stack: TypeScript, React, Node.js
9
+ # We use conventional commits
10
+ # Domain: e-commerce platform
11
+
12
+ # Per-artifact rules (optional)
13
+ # Add custom rules for specific artifacts.
14
+ # Example:
15
+ # rules:
16
+ # proposal:
17
+ # - Keep proposals under 500 words
18
+ # - Always include a "Non-goals" section
19
+ # tasks:
20
+ # - Break tasks into chunks of max 2 hours