larpfetch 0.1.0__tar.gz

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 (36) hide show
  1. larpfetch-0.1.0/.gitignore +38 -0
  2. larpfetch-0.1.0/.python-version +1 -0
  3. larpfetch-0.1.0/AGENTS.md +294 -0
  4. larpfetch-0.1.0/IMPLEMENTATION.md +351 -0
  5. larpfetch-0.1.0/LICENSE +21 -0
  6. larpfetch-0.1.0/PKG-INFO +202 -0
  7. larpfetch-0.1.0/PRD.md +331 -0
  8. larpfetch-0.1.0/PROMPT.md +239 -0
  9. larpfetch-0.1.0/README.md +188 -0
  10. larpfetch-0.1.0/main.py +6 -0
  11. larpfetch-0.1.0/pyproject.toml +28 -0
  12. larpfetch-0.1.0/src/larpfetch/__init__.py +3 -0
  13. larpfetch-0.1.0/src/larpfetch/__main__.py +6 -0
  14. larpfetch-0.1.0/src/larpfetch/cli.py +172 -0
  15. larpfetch-0.1.0/src/larpfetch/collectors/__init__.py +1 -0
  16. larpfetch-0.1.0/src/larpfetch/collectors/common.py +327 -0
  17. larpfetch-0.1.0/src/larpfetch/collectors/linux.py +5 -0
  18. larpfetch-0.1.0/src/larpfetch/collectors/macos.py +5 -0
  19. larpfetch-0.1.0/src/larpfetch/collectors/windows.py +5 -0
  20. larpfetch-0.1.0/src/larpfetch/config.py +74 -0
  21. larpfetch-0.1.0/src/larpfetch/easter_eggs.py +92 -0
  22. larpfetch-0.1.0/src/larpfetch/logos.py +141 -0
  23. larpfetch-0.1.0/src/larpfetch/models.py +99 -0
  24. larpfetch-0.1.0/src/larpfetch/renderer.py +144 -0
  25. larpfetch-0.1.0/src/larpfetch/resolver.py +45 -0
  26. larpfetch-0.1.0/tests/__init__.py +0 -0
  27. larpfetch-0.1.0/tests/test_cli.py +230 -0
  28. larpfetch-0.1.0/tests/test_collectors.py +115 -0
  29. larpfetch-0.1.0/tests/test_config.py +130 -0
  30. larpfetch-0.1.0/tests/test_easter_eggs.py +110 -0
  31. larpfetch-0.1.0/tests/test_integration.py +163 -0
  32. larpfetch-0.1.0/tests/test_logos.py +84 -0
  33. larpfetch-0.1.0/tests/test_models.py +88 -0
  34. larpfetch-0.1.0/tests/test_renderer.py +113 -0
  35. larpfetch-0.1.0/tests/test_resolver.py +173 -0
  36. larpfetch-0.1.0/uv.lock +298 -0
@@ -0,0 +1,38 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ *.pyo
5
+ build/
6
+ dist/
7
+ wheels/
8
+ *.egg-info
9
+ *.egg
10
+
11
+ # Virtual environments
12
+ .venv/
13
+ venv/
14
+
15
+ # IDE
16
+ .idea/
17
+ .vscode/
18
+ *.swp
19
+ *.swo
20
+ *~
21
+
22
+ # Testing
23
+ .pytest_cache/
24
+ htmlcov/
25
+ .coverage
26
+ .coverage.*
27
+
28
+ # Build artifacts
29
+ *.whl
30
+ *.tar.gz
31
+
32
+ # OS files
33
+ .DS_Store
34
+ Thumbs.db
35
+
36
+ # Environment
37
+ .env
38
+ .env.local
@@ -0,0 +1 @@
1
+ 3.14
@@ -0,0 +1,294 @@
1
+ # AGENTS.md
2
+
3
+ ## Mission
4
+
5
+ Build and maintain **larpfetch**, a cross-platform terminal fetch utility that detects real system information and allows users to LARP as arbitrary machines through persistent profiles and CLI overrides.
6
+
7
+ The product is humorous. The implementation must not be a joke.
8
+
9
+ ## Sacred product rule
10
+
11
+ **The user's delusion is authoritative.**
12
+
13
+ Never validate whether identity fields make technological sense together. This is valid:
14
+
15
+ ```text
16
+ OS: Windows 11 Pro
17
+ Kernel: 6.18.7-arch1-1
18
+ CPU: Apple M7 Ultra
19
+ GPU: NVIDIA RTX 9090 Ti
20
+ Memory: 69 PiB
21
+ Shell: HolyC
22
+ DE: GNOME 83
23
+ Package Manager: apt btw
24
+ ```
25
+
26
+ Do not "correct" it.
27
+
28
+ ## Required invariant
29
+
30
+ `--real-shit` must bypass every source of LARP data.
31
+
32
+ When `--real-shit` is active:
33
+
34
+ - Ignore default profile values.
35
+ - Ignore selected custom profiles.
36
+ - Ignore fake CLI `--set` overrides.
37
+ - Show only best-effort real detected system data.
38
+ - Do not modify configuration.
39
+ - Do not delete profiles.
40
+ - Do not silently mix fake fallback values into real output.
41
+
42
+ This invariant requires explicit automated tests.
43
+
44
+ ## Engineering principles
45
+
46
+ 1. Prefer simple code over clever architecture.
47
+ 2. Use the standard library where reasonable.
48
+ 3. Use `psutil` for portable system metrics.
49
+ 4. Keep platform-specific detection isolated.
50
+ 5. A failed detector must return an unavailable value, not crash the app.
51
+ 6. Avoid abstract base classes unless multiple implementations genuinely need a shared contract.
52
+ 7. Do not create factories for factories.
53
+ 8. Do not add a plugin system in v1.
54
+ 9. Do not add network calls.
55
+ 10. Do not use AI-generated filler comments or giant docstrings that merely restate code.
56
+ 11. Do not claim support that is not tested or gracefully implemented.
57
+ 12. Keep startup fast.
58
+
59
+ ## Data model
60
+
61
+ Use a normalized representation for system/display information. Known fields may include:
62
+
63
+ - username
64
+ - hostname
65
+ - os
66
+ - distro
67
+ - os_version
68
+ - kernel
69
+ - architecture
70
+ - uptime
71
+ - shell
72
+ - cpu
73
+ - gpu
74
+ - memory
75
+ - disk
76
+ - battery
77
+ - de
78
+ - package_manager
79
+ - package_count
80
+
81
+ Support arbitrary additional string fields from profiles and `--set`.
82
+
83
+ Known fields should have stable display ordering. Custom fields should follow deterministically.
84
+
85
+ ## Resolution algorithm
86
+
87
+ Normal mode:
88
+
89
+ ```text
90
+ real detected values
91
+ ← overridden by default profile
92
+ ← overridden by selected custom profile
93
+ ← overridden by CLI --set values
94
+ ```
95
+
96
+ Equivalent precedence:
97
+
98
+ ```text
99
+ CLI overrides > selected custom profile > default profile > real values
100
+ ```
101
+
102
+ Reality mode:
103
+
104
+ ```text
105
+ --real-shit > everything else
106
+ ```
107
+
108
+ Do not accidentally implement custom profiles as total replacements. Missing fields should inherit from the default profile, then real values.
109
+
110
+ ## Configuration
111
+
112
+ Use TOML and `tomllib`.
113
+
114
+ Expected sections:
115
+
116
+ ```toml
117
+ [default]
118
+
119
+ [profiles.NAME]
120
+
121
+ [appearance]
122
+ ```
123
+
124
+ Requirements:
125
+
126
+ - Helpful errors for invalid TOML.
127
+ - Helpful error when requested profile does not exist.
128
+ - Unknown profile fields are allowed.
129
+ - Values intended for display should be normalized to strings.
130
+ - Never execute values from config.
131
+ - Respect explicit `--config PATH`.
132
+
133
+ ## CLI
134
+
135
+ Required surface:
136
+
137
+ ```text
138
+ larpfetch
139
+ larpfetch -p NAME
140
+ larpfetch --profile NAME
141
+ larpfetch --real-shit
142
+ larpfetch --list-profiles
143
+ larpfetch --show-config
144
+ larpfetch --config PATH
145
+ larpfetch --set key=value
146
+ larpfetch --version
147
+ larpfetch --help
148
+ ```
149
+
150
+ `--set` must be repeatable.
151
+
152
+ Prefer `argparse` unless another dependency provides clear value. Avoid dependency inflation for cosmetic convenience.
153
+
154
+ ## Cross-platform behavior
155
+
156
+ Support Linux, Windows, and macOS.
157
+
158
+ Collectors:
159
+
160
+ - Common collector: username, hostname, architecture, uptime, memory, disk, battery where portable.
161
+ - Linux collector: distro from `/etc/os-release`, kernel, shell, DE, GPU best effort.
162
+ - Windows collector: Windows edition/version/build, kernel/version, shell, GPU best effort.
163
+ - macOS collector: macOS product version, Darwin kernel, shell, GPU best effort.
164
+
165
+ Rules:
166
+
167
+ - Avoid requiring root/admin.
168
+ - Use subprocess argument arrays.
169
+ - Use timeouts.
170
+ - Never use `shell=True` unless absolutely necessary and documented.
171
+ - Catch missing-command and timeout errors.
172
+ - Do not let optional probes crash startup.
173
+
174
+ ## Rendering
175
+
176
+ - Pair ASCII logo and aligned key/value rows.
177
+ - Select logo from displayed identity.
178
+ - In `--real-shit`, select from real identity.
179
+ - Respect `NO_COLOR`.
180
+ - Avoid broken alignment caused by ANSI codes.
181
+ - Handle Unicode carefully.
182
+ - Unknown distro/OS gets generic logo.
183
+ - Keep original ASCII artwork in-repo. Do not copy copyrighted ASCII art blindly from third-party projects.
184
+
185
+ ## Humor
186
+
187
+ The humor should be dry and sparse.
188
+
189
+ Good:
190
+
191
+ ```text
192
+ Authenticity: 3%
193
+ Source: trust me bro
194
+ Reality Leakage: 100.00%
195
+ ```
196
+
197
+ Bad:
198
+
199
+ - A joke on every line.
200
+ - Random meme spam that obscures system information.
201
+ - Offensive jokes.
202
+ - Humor that makes tests flaky.
203
+ - Pretending fake values are security facts.
204
+
205
+ Easter eggs must be deterministic under test and disableable.
206
+
207
+ ## Testing requirements
208
+
209
+ At minimum, test:
210
+
211
+ - no config
212
+ - default profile
213
+ - selected custom profile
214
+ - custom profile inheritance
215
+ - CLI overrides
216
+ - arbitrary unknown fields
217
+ - impossible field combinations accepted
218
+ - missing profile error
219
+ - malformed TOML error
220
+ - `--real-shit` ignores default profile
221
+ - `--real-shit` ignores selected profile
222
+ - `--real-shit` ignores CLI fake overrides
223
+ - collector failure degradation
224
+ - logo selection by displayed identity
225
+ - real logo selection in reality mode
226
+ - ANSI-safe alignment
227
+ - `NO_COLOR`
228
+ - CLI help/version
229
+ - installable console entry point where practical
230
+
231
+ Mock platform-specific system calls in unit tests.
232
+
233
+ ## Security
234
+
235
+ - No `eval` or `exec`.
236
+ - No arbitrary code execution from TOML.
237
+ - No network access.
238
+ - No unsafe shell interpolation.
239
+ - No secrets collection.
240
+ - Do not expose environment variables beyond explicitly needed values such as shell, config paths, desktop session, and color conventions.
241
+ - Do not persist real system information unless a future feature explicitly requires it and documents it.
242
+
243
+ ## Packaging
244
+
245
+ Use:
246
+
247
+ - Python 3.11+
248
+ - `pyproject.toml`
249
+ - `src/` layout
250
+ - console script `larpfetch`
251
+ - `psutil`
252
+ - `tomllib`
253
+
254
+ Recommended dev tooling:
255
+
256
+ - pytest
257
+ - pytest-cov
258
+ - ruff
259
+
260
+ Keep runtime dependencies minimal.
261
+
262
+ ## Workflow for coding agents
263
+
264
+ Before editing:
265
+
266
+ 1. Read `PRD.md`.
267
+ 2. Read this file.
268
+ 3. Read `IMPLEMENTATION.md`.
269
+ 4. Inspect existing code and tests.
270
+ 5. State a brief implementation plan internally, then execute.
271
+
272
+ During implementation:
273
+
274
+ 1. Work in small coherent changes.
275
+ 2. Run focused tests after each subsystem.
276
+ 3. Run the full suite before completion.
277
+ 4. Run linting.
278
+ 5. Test the CLI manually.
279
+ 6. Verify packaging metadata.
280
+ 7. Do not leave placeholders, TODO implementations, fake test passes, or commented-out broken code.
281
+
282
+ Before declaring completion:
283
+
284
+ - Ensure acceptance criteria in `PRD.md` are met.
285
+ - Ensure `--real-shit` invariant is covered by tests.
286
+ - Ensure the project installs locally.
287
+ - Ensure README commands match actual behavior.
288
+ - Ensure no generated artifacts or secrets are accidentally committed.
289
+
290
+ ## Final warning
291
+
292
+ Do not overengineer this.
293
+
294
+ It is a fetch tool that lies.
@@ -0,0 +1,351 @@
1
+ # larpfetch Implementation Blueprint
2
+
3
+ ## 1. Technical stack
4
+
5
+ - Python 3.11+
6
+ - `psutil`
7
+ - `tomllib`
8
+ - `argparse`
9
+ - `pathlib`
10
+ - `platform`
11
+ - `getpass`
12
+ - `socket`
13
+ - `subprocess`
14
+ - `shutil`
15
+ - `time`
16
+ - `os`
17
+
18
+ Development:
19
+
20
+ - `pytest`
21
+ - `pytest-cov`
22
+ - `ruff`
23
+
24
+ ## 2. Build order
25
+
26
+ ### Phase 1: Package skeleton
27
+
28
+ Create:
29
+
30
+ ```text
31
+ pyproject.toml
32
+ README.md
33
+ LICENSE
34
+ src/larpfetch/__init__.py
35
+ src/larpfetch/__main__.py
36
+ src/larpfetch/cli.py
37
+ tests/
38
+ ```
39
+
40
+ Expose:
41
+
42
+ ```toml
43
+ [project.scripts]
44
+ larpfetch = "larpfetch.cli:main"
45
+ ```
46
+
47
+ Confirm:
48
+
49
+ ```bash
50
+ python -m larpfetch --help
51
+ larpfetch --help
52
+ ```
53
+
54
+ ### Phase 2: Models and real detection
55
+
56
+ Create a normalized data structure that stores known fields plus custom fields.
57
+
58
+ Suggested approach:
59
+
60
+ ```python
61
+ @dataclass
62
+ class SystemInfo:
63
+ fields: OrderedDict[str, str]
64
+ ```
65
+
66
+ Or a similarly simple typed structure.
67
+
68
+ Implement a common collector using standard library and `psutil`.
69
+
70
+ Then implement platform-specific enrichment.
71
+
72
+ Every optional probe should fail gracefully.
73
+
74
+ ### Phase 3: Configuration
75
+
76
+ Implement platform-appropriate default config paths.
77
+
78
+ Load TOML:
79
+
80
+ ```text
81
+ [default]
82
+ [profiles.<name>]
83
+ [appearance]
84
+ ```
85
+
86
+ Return a clear config object containing:
87
+
88
+ - default profile
89
+ - named profiles
90
+ - appearance settings
91
+
92
+ Unknown fields are valid.
93
+
94
+ ### Phase 4: Resolver
95
+
96
+ Implement one pure resolution function.
97
+
98
+ Inputs:
99
+
100
+ - real system values
101
+ - default profile
102
+ - optional selected profile
103
+ - CLI overrides
104
+ - `real_shit: bool`
105
+
106
+ Output:
107
+
108
+ - resolved display identity
109
+ - mode metadata: `real` or `larp`
110
+
111
+ Pseudo-code:
112
+
113
+ ```python
114
+ if real_shit:
115
+ return real_values
116
+
117
+ resolved = real_values.copy()
118
+ resolved.update(default_profile)
119
+
120
+ if selected_profile:
121
+ resolved.update(selected_profile)
122
+
123
+ resolved.update(cli_overrides)
124
+ return resolved
125
+ ```
126
+
127
+ Test this aggressively.
128
+
129
+ ### Phase 5: CLI
130
+
131
+ Implement parsing for:
132
+
133
+ ```text
134
+ -p, --profile NAME
135
+ --real-shit
136
+ --list-profiles
137
+ --show-config
138
+ --config PATH
139
+ --set KEY=VALUE
140
+ --version
141
+ ```
142
+
143
+ Parsing requirements:
144
+
145
+ - Repeated `--set`.
146
+ - Split on first `=`.
147
+ - Reject empty keys.
148
+ - Permit arbitrary string values.
149
+ - `--real-shit` must dominate fake inputs.
150
+
151
+ ### Phase 6: Logos
152
+
153
+ Create original built-in ASCII logos.
154
+
155
+ Map normalized displayed identity names to logos.
156
+
157
+ Examples:
158
+
159
+ ```text
160
+ arch, arch linux -> arch
161
+ windows, windows 11, windows 10 -> windows
162
+ macos, mac os, darwin -> macos
163
+ ubuntu -> ubuntu
164
+ debian -> debian
165
+ fedora -> fedora
166
+ templeos -> templeos
167
+ unknown -> generic
168
+ ```
169
+
170
+ The displayed identity determines the logo in LARP mode.
171
+
172
+ ### Phase 7: Renderer
173
+
174
+ Render:
175
+
176
+ ```text
177
+ <logo> username@hostname
178
+ <logo> -----------------
179
+ <logo> OS: ...
180
+ <logo> Kernel: ...
181
+ <logo> CPU: ...
182
+ ```
183
+
184
+ Requirements:
185
+
186
+ - ANSI color.
187
+ - ANSI-stripping width calculation.
188
+ - Graceful logo/info height mismatch.
189
+ - `NO_COLOR`.
190
+ - Stable field ordering.
191
+ - Custom fields displayed deterministically.
192
+
193
+ ### Phase 8: Humor and easter eggs
194
+
195
+ Implement after core functionality is stable.
196
+
197
+ Suggested mode indicator:
198
+
199
+ - LARP mode: optional `Authenticity: N%`
200
+ - Real mode: optional `Authenticity: 100%`
201
+
202
+ Potential easter eggs:
203
+
204
+ - Extremely implausible memory string -> `Source: trust me bro`
205
+ - Windows + Arch kernel -> no warning; optionally rare hidden joke.
206
+ - Real system crossing conservative high-end thresholds -> `Reality has out-LARPed the LARP.`
207
+
208
+ Do not make output nondeterministic unless randomness is injectable and testable.
209
+
210
+ ### Phase 9: Tests
211
+
212
+ Recommended test modules:
213
+
214
+ ```text
215
+ tests/test_cli.py
216
+ tests/test_config.py
217
+ tests/test_resolver.py
218
+ tests/test_renderer.py
219
+ tests/test_logos.py
220
+ tests/test_collectors.py
221
+ tests/test_easter_eggs.py
222
+ ```
223
+
224
+ The resolver should receive the heaviest unit coverage.
225
+
226
+ ### Phase 10: Documentation and release readiness
227
+
228
+ README sections:
229
+
230
+ 1. Hero/title/tagline.
231
+ 2. Demo.
232
+ 3. Installation with `pipx`.
233
+ 4. Basic usage.
234
+ 5. `--real-shit`.
235
+ 6. Profiles.
236
+ 7. Configuration.
237
+ 8. CLI overrides.
238
+ 9. Cross-platform support.
239
+ 10. Easter eggs, without spoiling all of them.
240
+ 11. Development.
241
+ 12. Testing.
242
+ 13. Limitations.
243
+ 14. License.
244
+
245
+ ## 3. Suggested `pyproject.toml`
246
+
247
+ Use modern PEP 621 metadata. Example shape:
248
+
249
+ ```toml
250
+ [build-system]
251
+ requires = ["hatchling"]
252
+ build-backend = "hatchling.build"
253
+
254
+ [project]
255
+ name = "larpfetch"
256
+ version = "0.1.0"
257
+ description = "LARP as any distro, hardware, or machine you want."
258
+ readme = "README.md"
259
+ requires-python = ">=3.11"
260
+ dependencies = ["psutil>=5.9"]
261
+
262
+ [project.scripts]
263
+ larpfetch = "larpfetch.cli:main"
264
+ ```
265
+
266
+ Before publishing, verify current package-name availability and metadata requirements rather than assuming them.
267
+
268
+ ## 4. Real detection strategy
269
+
270
+ ### Common
271
+
272
+ Use:
273
+
274
+ - `getpass.getuser()`
275
+ - `socket.gethostname()`
276
+ - `platform.machine()`
277
+ - `psutil.boot_time()`
278
+ - `psutil.virtual_memory()`
279
+ - `psutil.disk_usage()`
280
+ - `psutil.sensors_battery()` where supported
281
+
282
+ ### Linux
283
+
284
+ Prefer:
285
+
286
+ - `/etc/os-release`
287
+ - `platform.release()`
288
+ - environment variables for shell/DE
289
+ - safe optional subprocess probes for GPU/package data
290
+
291
+ ### Windows
292
+
293
+ Prefer:
294
+
295
+ - `platform` APIs
296
+ - standard environment variables
297
+ - PowerShell/CIM only as optional best-effort probes with timeout and safe argument passing
298
+
299
+ ### macOS
300
+
301
+ Prefer:
302
+
303
+ - `platform.mac_ver()`
304
+ - `platform.release()`
305
+ - `system_profiler` only as an optional best-effort probe with timeout
306
+
307
+ ## 5. Error strategy
308
+
309
+ User-facing configuration errors should produce concise messages and nonzero exit codes.
310
+
311
+ Optional system-probe failures should degrade silently or to `Unknown`, depending on context.
312
+
313
+ Debug diagnostics may be added later behind a `--debug` flag, but are not required for v1.
314
+
315
+ ## 6. Performance target
316
+
317
+ Aim for sub-second startup on normal machines when optional external probes are absent or fast.
318
+
319
+ Slow probes should:
320
+
321
+ - have short timeouts
322
+ - be avoidable
323
+ - never block the entire application indefinitely
324
+
325
+ ## 7. Compatibility principle
326
+
327
+ Profiles are data, not simulations.
328
+
329
+ Do not infer compatibility.
330
+
331
+ Do not reject:
332
+
333
+ ```text
334
+ Windows + Arch kernel
335
+ macOS + RTX 9090
336
+ TempleOS + GNOME
337
+ Raspberry Pi + 69 PiB RAM
338
+ ```
339
+
340
+ Print what the user configured.
341
+
342
+ ## 8. Definition of done
343
+
344
+ - Full test suite passes.
345
+ - Lint passes.
346
+ - Local package build succeeds.
347
+ - `pipx install .` succeeds.
348
+ - CLI examples in README work.
349
+ - `--real-shit` is demonstrably immune to all fake inputs.
350
+ - Cross-platform collectors fail gracefully when platform-only facilities are unavailable.
351
+ - No needless architecture has metastasized into the codebase.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 larpfetch contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.