Skip to content
Merged

1.8.0 #203

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
c9aee8e
initial era selection screen (#201)
digitalghost-dev Nov 9, 2025
44e6ea9
sorting imports
digitalghost-dev Nov 9, 2025
ee1e7e9
switching to list for expansions instead of table (#201)
digitalghost-dev Nov 9, 2025
2c98e6c
standardizing key handling patterns (#202)
digitalghost-dev Nov 9, 2025
cc57ad8
fixing key navigation issues
digitalghost-dev Nov 9, 2025
80be6c1
updating version numbers
digitalghost-dev Nov 9, 2025
988f42a
renaming model name (#201)
digitalghost-dev Nov 9, 2025
2e7d22d
renaming file (#201)
digitalghost-dev Nov 9, 2025
7336deb
renaming file (#201)
digitalghost-dev Nov 9, 2025
06c650b
adding test file
digitalghost-dev Nov 10, 2025
fb77b44
removing `tea.WithAltScreen()` and editing settings (#201)
digitalghost-dev Nov 10, 2025
fdc9984
capture series ID for set filtering, adding list function (#201)
digitalghost-dev Nov 10, 2025
5415478
moving list design into own file (#201)
digitalghost-dev Nov 10, 2025
7b50c3b
updating paths to ignore
digitalghost-dev Nov 10, 2025
878b6ab
updating dependencies with critical/high CVE warnings
digitalghost-dev Nov 10, 2025
90e6991
updating testing data
digitalghost-dev Nov 10, 2025
6629cd5
editing RLS ruling
digitalghost-dev Nov 10, 2025
69bc312
initial commit
digitalghost-dev Nov 12, 2025
3dabd58
removing unneeded tests (#201)
digitalghost-dev Nov 12, 2025
464db35
renaming files (#201)
digitalghost-dev Nov 12, 2025
af8538d
removing comment
digitalghost-dev Nov 12, 2025
378b9f0
adding first function for card details (#201)
digitalghost-dev Nov 12, 2025
bd1b977
successfully chaining all three BubbleTea programs (#201)
digitalghost-dev Nov 12, 2025
5319d2a
updating paths to ignore
digitalghost-dev Nov 12, 2025
bf414d1
first working version (#201)
digitalghost-dev Nov 13, 2025
fba59ac
first working version (#201)
digitalghost-dev Nov 13, 2025
2744e5b
updating dependencies
digitalghost-dev Nov 13, 2025
e256be3
adding card command reference (#201)
digitalghost-dev Nov 13, 2025
5eec505
correctly calling card price data (#201)
digitalghost-dev Nov 13, 2025
c70f046
adding pricing data to table (#201)
digitalghost-dev Nov 15, 2025
6070182
adding priceMap for fewer API calls and smoother rendering (#201)
digitalghost-dev Nov 15, 2025
c97724d
initial commit (#201)
digitalghost-dev Nov 15, 2025
8f958fe
adding `create_view()` post hook (#201)
digitalghost-dev Nov 16, 2025
5e0ca16
initial test file (#201)
digitalghost-dev Nov 16, 2025
c90d340
validating card command args (#201)
digitalghost-dev Nov 16, 2025
1d043e1
creating image BubbleTea program (#201)
digitalghost-dev Nov 17, 2025
fea7348
adding new tests (#201)
digitalghost-dev Nov 18, 2025
d6a9a72
adding image column (#201)
digitalghost-dev Nov 18, 2025
392e03e
removing comments
digitalghost-dev Nov 18, 2025
d2155a4
adding all sets from SV and ME
digitalghost-dev Nov 18, 2025
80c1679
adding leading 0 to sets that have fewer than 100 cards to make `JOIN…
digitalghost-dev Nov 18, 2025
4164fc5
disabling telemetry
digitalghost-dev Nov 18, 2025
4716e3e
removing `CardPrice` function, adding `Cardimage` in its replacement …
digitalghost-dev Nov 18, 2025
125824b
initial cardinfo test file (#201)
digitalghost-dev Nov 18, 2025
b9617dc
adding `ImageMap` to `CardsModel` struct (#201)
digitalghost-dev Nov 18, 2025
11d43de
adding illustrator column
digitalghost-dev Nov 19, 2025
f263182
adjusting width (#201)
digitalghost-dev Nov 19, 2025
77b3820
updating text (#201)
digitalghost-dev Nov 19, 2025
a89a07f
adding blank identifier
digitalghost-dev Nov 19, 2025
957686f
returning an error rather than using `os.Exit(1)` (#201)
digitalghost-dev Nov 19, 2025
1c9a47c
opening card image in separate window (#201)
digitalghost-dev Nov 19, 2025
c04988f
adding timeout and limiting image body size (#201)
digitalghost-dev Nov 19, 2025
6333096
adding illustrator to right panel (#201)
digitalghost-dev Nov 19, 2025
e48c1fb
updating tests
digitalghost-dev Nov 19, 2025
77833ab
returning error instead of crashing the program with `log.Fatal()` (#…
digitalghost-dev Nov 19, 2025
2efbcb8
updating tests
digitalghost-dev Nov 19, 2025
67a8d36
fixing linting issues
digitalghost-dev Nov 19, 2025
91c91ab
fixing linting issues
digitalghost-dev Nov 19, 2025
76c2df9
adding `ansi` and `image` libraries (#201)
digitalghost-dev Nov 21, 2025
40fc057
updating layout, adding card cmd reference
digitalghost-dev Nov 22, 2025
474275b
adding data infra diagram
digitalghost-dev Nov 25, 2025
4e4ede4
removing Sword & Shield option for now
digitalghost-dev Nov 25, 2025
b603977
adding soda data quality checks to pricing data pipeline
digitalghost-dev Nov 25, 2025
63ced12
updating tested terminals section
digitalghost-dev Nov 25, 2025
7c10ba0
updating line location
digitalghost-dev Nov 25, 2025
9ee532e
removing unused test (#201)
digitalghost-dev Nov 25, 2025
fdf24b2
returning an error instead of calling `os.Exit(1)` (#201)
digitalghost-dev Nov 25, 2025
bbe6cac
adding timeout to `http` call (#201)
digitalghost-dev Nov 25, 2025
c94c979
adding timeout to `http` call, replacing `log.Fatalf()` by returning …
digitalghost-dev Nov 25, 2025
47266b8
updating help menu (#201)
digitalghost-dev Nov 25, 2025
3b307f2
replacing `log.Fatalf()` by returning an error (#201)
digitalghost-dev Nov 25, 2025
bbc6f48
adding error handling to image rendering (#201)
digitalghost-dev Nov 25, 2025
f5a3282
adding error handling to set list loading (#201)
digitalghost-dev Nov 25, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ on:
- main

env:
VERSION_NUMBER: 'v1.7.4'
VERSION_NUMBER: 'v1.8.0'
DOCKERHUB_REGISTRY_NAME: 'digitalghostdev/poke-cli'
AWS_REGION: 'us-west-2'

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ dbt_packages/
logs/

target/
dbt_packages/

card_data/infrastructure/supabase/access-token
/card_data/infrastructure/supabase/access-token
Expand All @@ -61,5 +60,6 @@ card_data/.tmp*/**

card_data/pipelines/poke_cli_dbt/.user.yml
/card_data/supabase/
/card_data/sample_scripts/

card_data/~/
3 changes: 3 additions & 0 deletions .gitleaksignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cmd/card/setslist.go:generic-api-key:116
cmd/card/cardlist.go:generic-api-key:157
codecov.yml:generic-api-key:2
Comment thread
digitalghost-dev marked this conversation as resolved.
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ builds:
- windows
- darwin
ldflags:
- -s -w -X main.version=v1.7.4
- -s -w -X main.version=v1.8.0

archives:
- formats: [ 'zip' ]
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RUN go mod download

COPY . .

RUN go build -ldflags "-X main.version=v1.7.4" -o poke-cli .
RUN go build -ldflags "-X main.version=v1.8.0" -o poke-cli .

# build 2
FROM --platform=$BUILDPLATFORM alpine:3.22
Expand Down
59 changes: 34 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@
<img height="250" width="350" src="pokemon.svg" alt="pokemon-logo"/>
<h1>Pokémon CLI</h1>
<img src="https://img.shields.io/github/v/release/digitalghost-dev/poke-cli?style=flat-square&logo=git&logoColor=FFCC00&label=Release%20Version&labelColor=EEE&color=FFCC00" alt="version-label">
<img src="https://img.shields.io/docker/image-size/digitalghostdev/poke-cli/v1.7.4?arch=arm64&style=flat-square&logo=docker&logoColor=FFCC00&labelColor=EEE&color=FFCC00" alt="docker-image-size">
<img src="https://img.shields.io/docker/image-size/digitalghostdev/poke-cli/v1.8.0?arch=arm64&style=flat-square&logo=docker&logoColor=FFCC00&labelColor=EEE&color=FFCC00" alt="docker-image-size">
<img src="https://img.shields.io/github/actions/workflow/status/digitalghost-dev/poke-cli/ci.yml?branch=main&style=flat-square&logo=github&logoColor=FFCC00&label=CI&labelColor=EEE&color=FFCC00" alt="ci-status-badge">
</div>
<div align="center">
<img src="https://img.shields.io/coderabbit/prs/github/digitalghost-dev/poke-cli?style=flat-square&logo=coderabbit&logoColor=FF570A&labelColor=F6F6F1&color=FF570A" alt="coderabbit-review-count-badge">
</div>
<div align="center">
<img src="https://img.shields.io/github/actions/workflow/status/digitalghost-dev/poke-cli/go_test.yml?style=flat-square&logo=go&logoColor=00ADD8&label=Tests&labelColor=EEE&color=00ADD8" alt="tests-label">
<img src="https://img.shields.io/github/go-mod/go-version/digitalghost-dev/poke-cli?style=flat-square&logo=Go&labelColor=EEE&color=00ADD8" alt="go-version"/>
Expand All @@ -18,17 +15,21 @@
`poke-cli` is a hybrid of a classic CLI and a modern TUI tool for viewing data about Pokémon! This is my first Go project.
View the [documentation](https://docs.poke-cli.com)!

The architecture behind how the tool works is straight forward:
1. Each command indicates which [API](https://pokeapi.co/) endpoint to use.
2. Flags provide more information and can be stacked together or used individually.
3. Each command has a `-h | --help` flag that is built-in with Golang's `flag` package.

View future plans in the [Roadmap](#roadmap) section.
* [Demo](#demo)
* [Installation](#installation)
* [Usage](#usage)
* [Roadmap](#roadmap)
* [Tested Terminals](#tested-terminals)

---
## Demo
![demo](https://poke-cli-s3-bucket.s3.us-west-2.amazonaws.com/demo-v1.6.0.gif)
### Video Game Data

![demo-vg](https://poke-cli-s3-bucket.s3.us-west-2.amazonaws.com/demo-v1.6.0.gif)

### Trading Card Game Data

![demo-tcg](https://poke-cli-s3-bucket.s3.us-west-2.amazonaws.com/poke-cli-v1.8.0.gif)
---
## Installation

Expand Down Expand Up @@ -94,11 +95,11 @@ Cloudsmith is a fully cloud-based service that lets you easily create, store, an
3. Choose how to interact with the container:
* Run a single command and exit:
```bash
docker run --rm -it digitalghostdev/poke-cli:v1.7.4 <command> [subcommand] flag]
docker run --rm -it digitalghostdev/poke-cli:v1.8.0 <command> [subcommand] flag]
```
* Enter the container and use its shell:
```bash
docker run --rm -it --name poke-cli --entrypoint /bin/sh digitalghostdev/poke-cli:v1.7.4 -c "cd /app && exec sh"
docker run --rm -it --name poke-cli --entrypoint /bin/sh digitalghostdev/poke-cli:v1.8.0 -c "cd /app && exec sh"
# placed into the /app directory, run the program with './poke-cli'
# example: ./poke-cli ability swift-swim
```
Expand Down Expand Up @@ -162,6 +163,7 @@ By running `poke-cli [-h | --help]`, it'll display information on how to use the
│ COMMANDS: │
│ ability Get details about an ability │
│ berry Get details about a berry │
│ card Get details about a TCG card │
│ item Get details about an item │
│ move Get details about a move │
│ natures Get details about all natures │
Expand All @@ -187,6 +189,12 @@ Below is a list of the planned/completed commands and flags:
- [x] `ability`: get data about an ability.
- [x] `-p | --pokemon`: display Pokémon that learn this ability.
- [x] `berry`: get data about a berry.
- [ ] `card`: get data about a TCG card.
- [x] add mega evolution data
- [x] add scarlet & violet data
- [ ] add sword & shield data
- [ ] add sun & moon data
- [ ] add x & y data
Comment thread
digitalghost-dev marked this conversation as resolved.
- [x] `item`: get data about an item.
- [x] `move`: get data about a move.
- [ ] `-p | --pokemon`: display Pokémon that learn this move.
Expand All @@ -208,15 +216,16 @@ Below is a list of the planned/completed commands and flags:

---
## Tested Terminals
| Terminal | OS | Status | Issues |
|-------------------|:-------------------------:|:------:|---------------------------------------------------------------------------------|
| Alacritty | macOS, Ubuntu,<br>Windows | ✅ | None |
| Ghostty | macOS | ✅ | None |
| HyperJS | macOS | ✅ | None |
| iTerm2 | macOS | ✅ | None |
| Built-in Terminal | Ubuntu, Debian,<br>Fedora | ✅ | None |
| Built-in Terminal | Alpine | ⚠️ | Some colors aren't supported.<br>`pokemon <name> --image=xx` flag pixel issues. |
| Built-in Terminal | macOS | ⚠️ | `pokemon <name> --image=xx` flag pixel issues. |
| Tabby | Ubuntu | ✅ | None |
| WezTerm | macOS, Windows | ✅ | None |
| Built-in Terminal | Windows | ✅ | None |
| Terminal | OS | Status | Issues |
|-------------------|:-------------------------:|:------:|----------------------------------------------------------------------------------------------|
| Alacritty | macOS, Ubuntu,<br>Windows | 🟡 | - Does not support sixel for TCG images. |
| Ghostty | macOS | 🟡 | - Does not support sixel for TCG images. |
| HyperJS | macOS | 🟡 | - Does not support sixel for TCG images. |
| iTerm2 | macOS | 🟢 | - None |
| Built-in Terminal | Ubuntu, Debian,<br>Fedora | 🟡 | - Does not support sixel for TCG images. |
| Built-in Terminal | Alpine | 🟡 | - Some colors aren't supported.<br>- `pokemon <name> --image=xx` flag pixel issues. |
| Built-in Terminal | macOS | 🟠 | - Does not support sixel for TCG images.<br>- `pokemon <name> --image=xx` flag pixel issues. |
| Foot | Ubuntu | 🟢 | - None |
| Tabby | Ubuntu | 🟢 | - None |
| WezTerm | macOS, Windows | 🟡 | - Windows version has issues with displaying TCG images. |
| Built-in Terminal | Windows | 🟢 | - None |
5 changes: 4 additions & 1 deletion card_data/dagster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ storage:
db_name: postgres
port: 5432
params:
sslmode: require
sslmode: require

telemetry:
enabled: false
6 changes: 3 additions & 3 deletions card_data/pipelines/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import dagster as dg

from .defs.extract.extract_pricing_data import build_dataframe
from .defs.load.load_pricing_data import load_pricing_data
from .defs.load.load_pricing_data import load_pricing_data, data_quality_checks_on_pricing


@definitions
Expand All @@ -17,7 +17,7 @@ def defs():
# Define the pricing pipeline job that materializes the assets and downstream dbt model
pricing_pipeline_job = dg.define_asset_job(
name="pricing_pipeline_job",
selection=dg.AssetSelection.assets(build_dataframe, load_pricing_data).downstream(include_self=True),
selection=dg.AssetSelection.assets(build_dataframe).downstream(include_self=True),
)

price_schedule = dg.ScheduleDefinition(
Expand All @@ -28,7 +28,7 @@ def defs():
)

defs_pricing = dg.Definitions(
assets=[build_dataframe, load_pricing_data],
assets=[build_dataframe, load_pricing_data, data_quality_checks_on_pricing],
jobs=[pricing_pipeline_job],
schedules=[price_schedule],
)
6 changes: 3 additions & 3 deletions card_data/pipelines/defs/extract/extract_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ def extract_set_data() -> pl.DataFrame:
@dg.asset(kinds={"API"}, name="extract_card_url_from_set_data")
def extract_card_url_from_set() -> list:
urls = [
"https://api.tcgdex.net/v2/en/sets/swsh3"
"https://api.tcgdex.net/v2/en/sets/me02"
]

all_card_urls = [] # Initialize empty list to collect all URLs
all_card_urls = []

for url in urls:
try:
Expand All @@ -103,7 +103,7 @@ def extract_card_url_from_set() -> list:
data = r.json()["cards"]

set_card_urls = [f"https://api.tcgdex.net/v2/en/cards/{card['id']}" for card in data]
all_card_urls.extend(set_card_urls) # Add all URLs from this set
all_card_urls.extend(set_card_urls)

time.sleep(0.1)

Expand Down
21 changes: 19 additions & 2 deletions card_data/pipelines/defs/extract/extract_pricing_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,22 @@
SET_PRODUCT_MATCHING = {
"sv01": "22873",
"sv02": "23120",
"sv03": "23228",
"sv03.5": "23237",
"sv04": "23286",
"sv04.5": "23353",
"sv05": "23381",
"sv06": "23473",
"sv06.5": "23529",
"sv07": "23537",
"sv08": "23651",
"sv08.5": "23821",
"sv09": "24073",
"sv10": "24269",
"sv10.5b": "24325",
"sv10.5w": "24326",
"me01": "24380",
"me02": "24448"
}


Expand Down Expand Up @@ -49,16 +65,17 @@ def pull_product_information(set_number: str) -> pl.DataFrame:
product_id = SET_PRODUCT_MATCHING[set_number]

# Fetch product data
products_url = (f"https://tcgcsv.com/tcgplayer/3/{product_id}/products")
products_url = f"https://tcgcsv.com/tcgplayer/3/{product_id}/products"
products_data = requests.get(products_url, timeout=30).json()

# Fetch pricing data
prices_url = (f"https://tcgcsv.com/tcgplayer/3/{product_id}/prices")
prices_url = f"https://tcgcsv.com/tcgplayer/3/{product_id}/prices"
prices_data = requests.get(prices_url, timeout=30).json()

price_dict = {
price["productId"]: price.get("marketPrice")
for price in prices_data.get("results", [])
if price.get("subTypeName") != "Reverse Holofoil"
}

cards_data = []
Expand Down
36 changes: 36 additions & 0 deletions card_data/pipelines/defs/load/load_pricing_data.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import subprocess
from pathlib import Path

import dagster as dg
import polars as pl
from dagster import RetryPolicy, Backoff
Expand All @@ -23,3 +26,36 @@ def load_pricing_data(build_pricing_dataframe: pl.DataFrame) -> None:
except OperationalError as e:
print(colored(" ✖", "red"), "Connection error in load_pricing_data():", e)
raise


@dg.asset(
deps=[load_pricing_data],
kinds={"Soda"},
name="data_quality_checks_on_pricing",
)
def data_quality_checks_on_pricing() -> None:
current_file_dir = Path(__file__).parent
print(f"Setting cwd to: {current_file_dir}")

result = subprocess.run(
[
"soda",
"scan",
"-d",
"supabase",
"-c",
"../../soda/configuration.yml",
"../../soda/checks_pricing.yml",
],
capture_output=True,
text=True,
cwd=current_file_dir,
)

if result.stdout:
print(result.stdout)
if result.stderr:
print(result.stderr)

if result.returncode != 0:
raise Exception(f"Soda data quality checks failed with return code {result.returncode}")
2 changes: 1 addition & 1 deletion card_data/pipelines/defs/transformation/transform_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def get_asset_key(self, dbt_resource_props):
"series": "quality_checks_series",
"sets": "load_set_data",
"cards": "load_card_data",
"pricing_data": "load_pricing_data",
"pricing_data": "data_quality_checks_on_pricing",
}
if name in source_mapping:
return dg.AssetKey([source_mapping[name]])
Expand Down
2 changes: 1 addition & 1 deletion card_data/pipelines/poke_cli_dbt/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'poke_cli_dbt'
version: '1.7.4'
version: '1.8.0'

profile: 'poke_cli_dbt'

Expand Down
7 changes: 6 additions & 1 deletion card_data/pipelines/poke_cli_dbt/macros/create_rls.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{% macro enable_rls() %}
ALTER TABLE {{ this }} ENABLE ROW LEVEL SECURITY;
CREATE POLICY "Enable read access for all users" ON {{ this }} TO PUBLIC USING (true);
CREATE POLICY "Enable Read Access for All Users"
ON {{ this }}
AS PERMISSIVE
FOR SELECT
TO PUBLIC
USING (true);
{% endmacro %}
40 changes: 40 additions & 0 deletions card_data/pipelines/poke_cli_dbt/macros/create_view.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{% macro create_view() %}
CREATE OR REPLACE VIEW public.card_pricing_view
WITH (security_invoker = true) AS
WITH cards_cte AS (
SELECT
set_id,
image,
name,
"localId",
"set_cardCount_official",
CONCAT(name, ' - ', "localId", '/', LPAD("set_cardCount_official"::text, 3, '0')) AS card_combined_name,
Comment thread
digitalghost-dev marked this conversation as resolved.
set_name
FROM public.cards
),

cards_pricing_cte AS (
SELECT
product_id,
market_price,
CONCAT(name, ' - ', card_number) AS card_combined_name,
card_number
FROM public.pricing_data
)

SELECT
c.set_id,
c.name,
CONCAT(p.card_number, ' - ', c.name) AS number_plus_name,
CONCAT(c.image, '/high.png') AS image_url,
c.set_name,
c."localId",
p."market_price",
p."card_number"
FROM
cards_cte AS c
INNER JOIN
cards_pricing_cte AS p
ON c.card_combined_name = p.card_combined_name
ORDER BY c."localId"
{% endmacro %}
2 changes: 1 addition & 1 deletion card_data/pipelines/poke_cli_dbt/models/cards.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
post_hook="{{ enable_rls() }}"
) }}

SELECT id, set_id, image, name, "localId", category, hp, "set_cardCount_official", set_name
SELECT id, set_id, image, name, "localId", category, hp, "set_cardCount_official", set_name, illustrator
FROM {{ source('staging', 'cards') }}
5 changes: 4 additions & 1 deletion card_data/pipelines/poke_cli_dbt/models/pricing_data.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{{ config(
materialized='table',
post_hook="{{ enable_rls() }}"
post_hook=[
"{{ enable_rls() }}",
"{{ create_view() }}"
]
) }}

SELECT product_id, name, card_number, market_price
Expand Down
Loading
Loading