Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@

## Completed

- [x] Add search capability to miniinventory V2
- [x] Claude Code adapter (original implementation)
- [x] Gemini adapter (API integration, Flash-Lite/Pro)
- [x] OpenAI adapter (Responses API, cost accounting)
Expand Down
31 changes: 26 additions & 5 deletions problems/miniinventory/SPEC-v2.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PROJECT: mini-inventory
AUTHOR: Tunahan Caner YILDIZ (251478112)
VERSION: v2
DATE: 2026-03-29
DATE: 2026-04-19

========================================
OVERVIEW
Expand All @@ -10,7 +10,7 @@ OVERVIEW
mini-inventory is a command-line inventory manager.
It stores product records in a plain text file and supports
initializing the system, adding products, listing products,
updating stock quantities, and deleting products.
updating stock quantities, deleting products, and searching products.

All data is stored in a directory called .miniinventory/
in the current working directory.
Expand Down Expand Up @@ -107,6 +107,27 @@ Output:
- Error if system is not initialized:
"Not initialized. Run: miniinventory init"

--- search ---
Usage: miniinventory search "Pen"

Searches for products whose name contains the search query.

Validation and filtering rules:
- The search must be case-insensitive (e.g., searching "pEn" must find "Pencil").
- Products must be listed in ascending order by ID, matching the exact format of 'list'.
- The query can be a substring anywhere in the product name.

Output:
- Success matches:
[1] Pencil - Quantity: 50 (2026-03-15)
[3] Blue Pen - Quantity: 10 (2026-03-15)
- No matches found:
"No products match the search."
- Error if arguments are missing:
"Usage: miniinventory search <query>"
- Error if system is not initialized:
"Not initialized. Run: miniinventory init"

========================================
DATA FORMAT
========================================
Expand Down Expand Up @@ -162,14 +183,14 @@ Implemented commands:
- list
- update
- delete
- search

v2 TASKS COMPLETED:
1. Implemented the "list" command to display all stored products
2. Implemented the "update" command to modify product quantity
3. Implemented the "delete" command to remove a product
4. Implemented the "search" command to perform case-insensitive substring queries

v1 -> v2 SUMMARY:
- v1 supported only initialization and adding products
- v2 adds full inventory management through list, update, and delete
- validation rules were clarified to improve consistency and usability

- v2 adds full inventory management through list, update,, delete, and case-insensitive search logic.
2 changes: 1 addition & 1 deletion problems/miniinventory/problem.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"v1_prompt": "Implement {{binary_name}} as described in SPEC-v1.txt using {{language}}. The executable must be named '{{binary_name}}' and be runnable as ./{{binary_name}}. For compiled languages, include a Makefile or build script. For interpreted languages, ensure the {{binary_name}} file has a proper shebang line and is executable. Verify your implementation passes all tests by running: bash test-v1.sh",
"v2_spec": "SPEC-v2.txt",
"v2_test": "test-v2.sh",
"v2_prompt": "Read SPEC-v2.txt and extend the existing {{binary_name}} implementation. Update the code to implement list, update, and delete commands. Verify your implementation passes all tests by running: bash test-v2.sh"
"v2_prompt": "Read SPEC-v2.txt and extend the existing {{binary_name}} implementation. Update the code to implement list, update, delete, and search commands. Verify your implementation passes all tests by running: bash test-v2.sh"
}
38 changes: 37 additions & 1 deletion problems/miniinventory/test-v2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ if ../miniinventory add Pencil 50 2>&1 | grep -q "Not initialized"; then pass "a
if ../miniinventory list 2>&1 | grep -q "Not initialized"; then pass "list before init"; else fail "list before init"; fi
if ../miniinventory update 1 80 2>&1 | grep -q "Not initialized"; then pass "update before init"; else fail "update before init"; fi
if ../miniinventory delete 1 2>&1 | grep -q "Not initialized"; then pass "delete before init"; else fail "delete before init"; fi
if ../miniinventory search Pen 2>&1 | grep -q "Not initialized"; then pass "search before init"; else fail "search before init"; fi

######################################
# Test 3: add and duplicate check
Expand Down Expand Up @@ -164,7 +165,42 @@ else
fi

######################################
# Test 8: unknown/missing command
# Test 8: search product
######################################
rm -rf .miniinventory
../miniinventory init >/dev/null 2>&1
../miniinventory add Pencil 50 >/dev/null 2>&1
../miniinventory add Notebook 20 >/dev/null 2>&1
../miniinventory add "Blue Pen" 10 >/dev/null 2>&1

OUTPUT=$(../miniinventory search "Notebook" 2>&1)
if echo "$OUTPUT" | grep -q "\[2\] Notebook - Quantity: 20" && ! echo "$OUTPUT" | grep -q "Pencil"; then
pass "search finds exact match"
else
fail "search finds exact match"
fi

OUTPUT=$(../miniinventory search "pEn" 2>&1)
if echo "$OUTPUT" | grep -q "\[1\] Pencil" && echo "$OUTPUT" | grep -q "\[3\] Blue Pen" && ! echo "$OUTPUT" | grep -q "Notebook"; then
pass "search is case insensitive and finds multiple"
else
fail "search is case insensitive and finds multiple"
fi

if ../miniinventory search "NotExists" 2>&1 | grep -q "No products match the search."; then
pass "search no match"
else
fail "search no match"
fi

if ../miniinventory search 2>&1 | grep -q "Usage"; then
pass "search missing arguments"
else
fail "search missing arguments"
fi

######################################
# Test 9: unknown/missing command
######################################
if ../miniinventory fly 2>&1 | grep -q "Unknown command: fly"; then
pass "unknown command"
Expand Down
14 changes: 14 additions & 0 deletions walkthrough.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@

---

## 2026-04-21 — Upgrade miniinventory V2 with case-insensitive search

**Contributor**: AI agent (Antigravity)
**What was done**:
- Added case-insensitive product search functionality to `miniinventory` V2 problem specification.
- Updated `problems/miniinventory/SPEC-v2.txt` to define the search command requirements.
- Updated `problems/miniinventory/test-v2.sh` to include comprehensive search command tests (case insensitivity, exact match, empty results, parameter errors).
- Updated `problems/miniinventory/problem.json` to enforce the search requirement.
**Observations**: The search requirement successfully validates that agents can extend simple data structures with substring filtering and case normalization logic.
**Decisions made**: Search was designed as case-insensitive to reflect real-world user expectations for CLI tools.
**Next**: Open PR to merge the updated problem structure into the upstream repository.

---

## 2026-04-20 — V2 Evolution: Gemini Caching, MiniGit Status & Spec Hardening

**Contributor**: AI agent (Antigravity)
Expand Down
Loading