pifang 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 (74) hide show
  1. pifang-0.1.0/.gitignore +73 -0
  2. pifang-0.1.0/.out-of-scope/README.md +28 -0
  3. pifang-0.1.0/CHANGELOG.md +47 -0
  4. pifang-0.1.0/CODE_OF_CONDUCT.md +56 -0
  5. pifang-0.1.0/CONTRIBUTING.md +52 -0
  6. pifang-0.1.0/LICENSE +204 -0
  7. pifang-0.1.0/PKG-INFO +167 -0
  8. pifang-0.1.0/README.md +119 -0
  9. pifang-0.1.0/SECURITY.md +23 -0
  10. pifang-0.1.0/docs/agents-blurb.md +61 -0
  11. pifang-0.1.0/docs/api-design.md +202 -0
  12. pifang-0.1.0/docs/glossary.md +59 -0
  13. pifang-0.1.0/docs/out-of-scope.md +13 -0
  14. pifang-0.1.0/docs/pkg-classification.md +163 -0
  15. pifang-0.1.0/docs/project-brief.md +305 -0
  16. pifang-0.1.0/examples/fixtures/batch-in/copy.jpg +0 -0
  17. pifang-0.1.0/examples/fixtures/sample.jpg +0 -0
  18. pifang-0.1.0/examples/quickstart.py +42 -0
  19. pifang-0.1.0/pyproject.toml +89 -0
  20. pifang-0.1.0/skills/pifang/SKILL.md +140 -0
  21. pifang-0.1.0/src/pifang/__init__.py +5 -0
  22. pifang-0.1.0/src/pifang/cli/__init__.py +1 -0
  23. pifang-0.1.0/src/pifang/cli/main.py +1594 -0
  24. pifang-0.1.0/src/pifang/core/__init__.py +1 -0
  25. pifang-0.1.0/src/pifang/core/batch.py +221 -0
  26. pifang-0.1.0/src/pifang/core/doctor.py +189 -0
  27. pifang-0.1.0/src/pifang/core/manifest.py +46 -0
  28. pifang-0.1.0/src/pifang/core/output.py +38 -0
  29. pifang-0.1.0/src/pifang/core/pipe.py +214 -0
  30. pifang-0.1.0/src/pifang/core/recipe.py +301 -0
  31. pifang-0.1.0/src/pifang/core/result.py +53 -0
  32. pifang-0.1.0/src/pifang/core/setup_deps.py +158 -0
  33. pifang-0.1.0/src/pifang/core/video_pipe.py +156 -0
  34. pifang-0.1.0/src/pifang/domains/__init__.py +1 -0
  35. pifang-0.1.0/src/pifang/domains/doc/engines.py +317 -0
  36. pifang-0.1.0/src/pifang/domains/doc/info.py +47 -0
  37. pifang-0.1.0/src/pifang/domains/doc/ingest.py +201 -0
  38. pifang-0.1.0/src/pifang/domains/doc/ocr.py +71 -0
  39. pifang-0.1.0/src/pifang/domains/doc/pdf_ops.py +148 -0
  40. pifang-0.1.0/src/pifang/domains/doc/types.py +61 -0
  41. pifang-0.1.0/src/pifang/domains/image/__init__.py +3 -0
  42. pifang-0.1.0/src/pifang/domains/image/analyze.py +135 -0
  43. pifang-0.1.0/src/pifang/domains/image/bg.py +232 -0
  44. pifang-0.1.0/src/pifang/domains/image/ops.py +530 -0
  45. pifang-0.1.0/src/pifang/domains/image/packs.py +218 -0
  46. pifang-0.1.0/src/pifang/domains/image/platforms.py +161 -0
  47. pifang-0.1.0/src/pifang/domains/image/recolor.py +75 -0
  48. pifang-0.1.0/src/pifang/domains/meta/index.py +100 -0
  49. pifang-0.1.0/src/pifang/domains/text/chunk.py +83 -0
  50. pifang-0.1.0/src/pifang/domains/text/frontmatter.py +32 -0
  51. pifang-0.1.0/src/pifang/domains/transcribe/__init__.py +6 -0
  52. pifang-0.1.0/src/pifang/domains/transcribe/engine.py +71 -0
  53. pifang-0.1.0/src/pifang/domains/transcribe/formats.py +56 -0
  54. pifang-0.1.0/src/pifang/domains/transcribe/ops.py +205 -0
  55. pifang-0.1.0/src/pifang/domains/video/__init__.py +1 -0
  56. pifang-0.1.0/src/pifang/domains/video/ffmpeg.py +151 -0
  57. pifang-0.1.0/src/pifang/domains/video/info.py +56 -0
  58. pifang-0.1.0/src/pifang/domains/video/ops.py +328 -0
  59. pifang-0.1.0/src/pifang/errors.py +57 -0
  60. pifang-0.1.0/src/pifang/recipes/builtin/avatar.yaml +17 -0
  61. pifang-0.1.0/src/pifang/recipes/builtin/hero.yaml +21 -0
  62. pifang-0.1.0/src/pifang/recipes/builtin/podcast-audio.yaml +15 -0
  63. pifang-0.1.0/src/pifang/recipes/builtin/social-clip.yaml +19 -0
  64. pifang-0.1.0/src/pifang/recipes/builtin/social-square.yaml +20 -0
  65. pifang-0.1.0/tests/conftest.py +31 -0
  66. pifang-0.1.0/tests/test_bg.py +169 -0
  67. pifang-0.1.0/tests/test_cli.py +264 -0
  68. pifang-0.1.0/tests/test_doc.py +297 -0
  69. pifang-0.1.0/tests/test_docs_examples.py +200 -0
  70. pifang-0.1.0/tests/test_image.py +253 -0
  71. pifang-0.1.0/tests/test_packs.py +129 -0
  72. pifang-0.1.0/tests/test_setup.py +67 -0
  73. pifang-0.1.0/tests/test_transcribe.py +194 -0
  74. pifang-0.1.0/tests/test_video.py +173 -0
@@ -0,0 +1,73 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.py[cod]
4
+ .pytest_cache/
5
+ .coverage
6
+ htmlcov/
7
+ dist/
8
+ build/
9
+ *.egg-info/
10
+ .pifang-tmp-*
11
+ .pifang-*/
12
+
13
+ # secrets / local env
14
+ .env
15
+ .env.*
16
+ !.env.example
17
+
18
+ # tooling caches
19
+ .mypy_cache/
20
+ .ruff_cache/
21
+ .tox/
22
+
23
+ # agent / roster / Cursor — local only, not part of the OSS package
24
+ .claude/
25
+ .cursor/
26
+ .roster/
27
+ .roster-backup*/
28
+ .roster-manifest.json
29
+ handoff/
30
+
31
+ # OS / editor
32
+ .DS_Store
33
+ Thumbs.db
34
+ *.swp
35
+
36
+ # roster-generated (agent IP — regenerate with `roster deploy`, don't commit)
37
+ **/.claude/agents/
38
+ **/.claude/skills/
39
+ **/.claude/references/
40
+ **/.agents/skills/
41
+ **/.cursor/rules/pm.mdc
42
+ **/.cursor/rules/software-architect.mdc
43
+ **/.cursor/rules/pkg-architect.mdc
44
+ **/.cursor/rules/ai-architect.mdc
45
+ **/.cursor/rules/brand-strategist.mdc
46
+ **/.cursor/rules/copywriter.mdc
47
+ **/.cursor/rules/designer.mdc
48
+ **/.cursor/rules/developer.mdc
49
+ **/.cursor/rules/pkg-developer.mdc
50
+ **/.cursor/rules/devops.mdc
51
+ **/.cursor/rules/pkg-devops.mdc
52
+ **/.cursor/rules/server-admin.mdc
53
+ **/.cursor/rules/docs-writer.mdc
54
+ **/.cursor/rules/qa-reviewer.mdc
55
+ **/.cursor/rules/experience-reviewer.mdc
56
+ **/.cursor/rules/security-reviewer.mdc
57
+ **/.cursor/rules/art-director.mdc
58
+ **/.opencode/agents/
59
+ **/opencode.json
60
+ **/.hermes/agents/
61
+ **/.hermes/README.md
62
+ **/.codex/
63
+ **/.zcode/agents/
64
+ **/.grok/agents/
65
+ **/.pi/agents/
66
+ **/.kimi-code/agents/
67
+ **/.roster-manifest.json
68
+ **/.cadre-manifest.json
69
+
70
+ # quickstart.py outputs
71
+ examples/fixtures/avatar.webp
72
+ examples/fixtures/out.webp
73
+ examples/fixtures/batch-out/
@@ -0,0 +1,28 @@
1
+ ---
2
+ for_agent: |
3
+ Institutional memory for "no." Before proposing a feature, scope expansion, or approach,
4
+ check here first — if an idea was already rejected, do NOT re-litigate it; cite the entry and
5
+ move on, or surface a NEW reason the decision should be revisited. Record each rejected request
6
+ as its own dated file: out-of-scope/<slug>.md with the request, why it was declined, and what
7
+ (if anything) would change the answer. Append; never delete an entry — a reversal supersedes it
8
+ with a new entry that links back. This is project-scoped benign context, not agent IP.
9
+ for_human: |
10
+ The rejected-ideas log. When a feature, integration, or approach is deliberately ruled out, it
11
+ gets written here so the team stops re-proposing it across runs. Each entry says what was asked,
12
+ why it was declined, and what would have to change to reopen it. Read this before re-asking for
13
+ something that "feels missing" — it may be a settled "no" with a reason.
14
+ ---
15
+
16
+ # Out of scope
17
+
18
+ Documented rejected requests — institutional memory for "no."
19
+
20
+ Agents check this folder before proposing a feature or approach; a settled "no" is cited, not
21
+ re-litigated. Each rejected request is one dated file, `out-of-scope/<slug>.md`, capturing:
22
+
23
+ - **The request** — what was asked, in the asker's words.
24
+ - **Why declined** — the reason it's out of scope (cost, risk, strategy, sequencing).
25
+ - **What would reopen it** — the condition under which the decision should be revisited.
26
+
27
+ Entries are append-only: a reversal is a new entry that supersedes and links back to the old one,
28
+ never a deletion. This is benign project context — it is not committed agent IP.
@@ -0,0 +1,47 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.1.0] — 2026-09-23
9
+
10
+ First public-facing release line (git dogfood → OSS). Includes **v0.5 release hardening** before first PyPI upload.
11
+
12
+ ### Added
13
+
14
+ - Image domain: atoms, recipes (`avatar`, `hero`, `social-square`), pipe DSL, batch + JSONL manifests, social/blog/podcast/video-cover packs, remove-bg / flatten-bg / recolor
15
+ - Document domain: `doc convert` (markdown + images only), `doc ingest` (manifest + optional engine JSON), split/merge/extract-images/ocr, text chunk/frontmatter, meta index/validate
16
+ - Default doc engine `fast` (pymupdf4llm); optional OpenDataLoader via `pifang[doc-odl]` + JDK
17
+ - Video domain: ffmpeg-backed info/transcode/trim/extract-audio/concat/to-gif/extract-frames/resize/normalize-audio/captions + recipes; `pipe video` + `batch run video`
18
+ - Transcribe: Faster-Whisper via `pifang[transcribe]`; timeline JSON + SRT (+ optional VTT); `video`/`audio` aliases
19
+ - `pifang setup` for pip extras + printed system install hints (ffmpeg/Java)
20
+ - Agent consumer docs: `docs/agents-blurb.md`, `skills/pifang/SKILL.md`
21
+ - Root `--version` flag; leaf `--force` / `--dry-run` / `--verbose` on mutating commands
22
+ - Subprocess timeouts; structured `SUBPROCESS_TIMEOUT` errors
23
+
24
+ ### Changed
25
+
26
+ - **Plain text by default, `--json` for agents** — with `--json` (root or any subcommand) stdout is exactly one JSON object, success or failure; `--human` removed
27
+ - Closed-set CLI params are real enums; pipe DSL rejects stray tokens (no silent stage drop)
28
+ - Batch early-stop accounting: `total == succeeded + failed + skipped + not_attempted`; first error inlined; domain-correct `batch.{image|video}.*` labels
29
+ - Skip-if-unchanged metadata reports the existing **output** file’s dimensions/bytes
30
+ - sdist ships a curated docs list (no internal tasks/archive/publishing checklists)
31
+ - README links are absolute GitHub URLs for PyPI rendering
32
+ - Dropped redundant `License :: OSI Approved :: …` classifier (SPDX `license = "Apache-2.0"` is authoritative)
33
+
34
+ ### Fixed
35
+
36
+ - Doc ingest stem sanitization for filenames with spaces (fast engine)
37
+ - `ingest.jsonl` merge-by-input across runs; corrupt resume lines warn with line numbers
38
+ - WebM transcode codec defaults (VP9/Opus)
39
+ - Global exception fallback always emits the JSON error envelope (`INTERNAL`, exit 3)
40
+ - First-class validation/processing errors for bad dimensions, unknown formats, bad fit color, decompression bombs, corrupt PDFs, bad manifest lines, malformed custom recipes
41
+ - `image compress` crash when `--quality` ≤ 9 with `--max-kb`
42
+ - ffmpeg concat/subtitles escaping for filenames containing `'`
43
+ - Temp intermediates cleaned on failed multi-stage pipe/recipe runs
44
+ - `remove-bg` / `recolor` use Pillow C-level ops (no pure-Python pixel loops)
45
+ - Non-ASCII paths in JSON use `ensure_ascii=False`
46
+
47
+ [0.1.0]: https://github.com/StormForgeVentures/pifang/releases/tag/v0.1.0
@@ -0,0 +1,56 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual
10
+ identity and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment:
18
+
19
+ - Demonstrating empathy and kindness toward other people
20
+ - Being respectful of differing opinions, viewpoints, and experiences
21
+ - Giving and gracefully accepting constructive feedback
22
+ - Accepting responsibility and apologizing to those affected by our mistakes
23
+ - Focusing on what is best for the overall community
24
+
25
+ Examples of unacceptable behavior:
26
+
27
+ - The use of sexualized language or imagery, and sexual attention or advances of any kind
28
+ - Trolling, insulting or derogatory comments, and personal or political attacks
29
+ - Public or private harassment
30
+ - Publishing others’ private information without explicit permission
31
+ - Other conduct which could reasonably be considered inappropriate in a professional setting
32
+
33
+ ## Enforcement Responsibilities
34
+
35
+ Project maintainers are responsible for clarifying and enforcing standards of
36
+ acceptable behavior and will take appropriate and fair corrective action in
37
+ response to any behavior they deem inappropriate, threatening, offensive, or harmful.
38
+
39
+ ## Scope
40
+
41
+ This Code of Conduct applies within all community spaces and when an individual
42
+ is officially representing the community in public spaces.
43
+
44
+ ## Enforcement
45
+
46
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
47
+ reported to the project maintainers at **hello@stormforgeventures.com**. All complaints will
48
+ be reviewed and investigated promptly and fairly.
49
+
50
+ ## Attribution
51
+
52
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
53
+ version 2.1, available at
54
+ https://www.contributor-covenant.org/version/2/1/code_of_conduct.html.
55
+
56
+ [homepage]: https://www.contributor-covenant.org
@@ -0,0 +1,52 @@
1
+ # Contributing to Pifang
2
+
3
+ Thanks for helping improve an agent-first media CLI.
4
+
5
+ ## Development setup
6
+
7
+ ```bash
8
+ git clone https://github.com/StormForgeVentures/pifang.git
9
+ cd pifang
10
+ uv venv && source .venv/bin/activate
11
+ uv pip install -e ".[dev,doc,transcribe]"
12
+ # optional system tools — printed, not auto-installed:
13
+ pifang setup
14
+ ```
15
+
16
+ Requires Python 3.11+.
17
+
18
+ ## Checks
19
+
20
+ ```bash
21
+ pytest tests -q
22
+ pifang doctor --doc --video --transcribe
23
+ ```
24
+
25
+ Video/transcribe integration tests skip when `ffmpeg` or `faster-whisper` is missing.
26
+
27
+ ## Project layout
28
+
29
+ - `src/pifang/` — library + CLI
30
+ - `tests/` — pytest
31
+ - `docs/` — product docs, glossary, agent blurb
32
+ - `examples/` — quickstart + fixtures
33
+ - `skills/pifang/` — optional Agent Skill drop-in for consumer projects
34
+
35
+ ## Pull requests
36
+
37
+ 1. Prefer a focused branch (`fix/…`, `feature/…`).
38
+ 2. Add/adjust tests for behavior changes.
39
+ 3. Keep the public CLI stable; widen surfaces only with docs updates.
40
+ 4. Run `pytest` before opening the PR.
41
+ 5. Fill out the PR template checklist.
42
+
43
+ ## Coding notes
44
+
45
+ - Default stdout is plain text for terminals. With `--json`, stdout is exactly one JSON object — that is the agent contract and must stay stable.
46
+ - Exit codes: 0 success · 1 validation · 2 missing dep · 3 processing · 4 partial batch.
47
+ - Prefer extending atoms/recipes over one-off scripts in docs/examples.
48
+ - Doc default engine is `fast` (pure Python). OpenDataLoader is opt-in (`doc-odl` + JDK).
49
+
50
+ ## License
51
+
52
+ By contributing, you agree your contributions are licensed under the Apache License 2.0.
pifang-0.1.0/LICENSE ADDED
@@ -0,0 +1,204 @@
1
+ Copyright 2026 Tim Wolf
2
+
3
+
4
+ Apache License
5
+ Version 2.0, January 2004
6
+ http://www.apache.org/licenses/
7
+
8
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
9
+
10
+ 1. Definitions.
11
+
12
+ "License" shall mean the terms and conditions for use, reproduction,
13
+ and distribution as defined by Sections 1 through 9 of this document.
14
+
15
+ "Licensor" shall mean the copyright owner or entity authorized by
16
+ the copyright owner that is granting the License.
17
+
18
+ "Legal Entity" shall mean the union of the acting entity and all
19
+ other entities that control, are controlled by, or are under common
20
+ control with that entity. For the purposes of this definition,
21
+ "control" means (i) the power, direct or indirect, to cause the
22
+ direction or management of such entity, whether by contract or
23
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
24
+ outstanding shares, or (iii) beneficial ownership of such entity.
25
+
26
+ "You" (or "Your") shall mean an individual or Legal Entity
27
+ exercising permissions granted by this License.
28
+
29
+ "Source" form shall mean the preferred form for making modifications,
30
+ including but not limited to software source code, documentation
31
+ source, and configuration files.
32
+
33
+ "Object" form shall mean any form resulting from mechanical
34
+ transformation or translation of a Source form, including but
35
+ not limited to compiled object code, generated documentation,
36
+ and conversions to other media types.
37
+
38
+ "Work" shall mean the work of authorship, whether in Source or
39
+ Object form, made available under the License, as indicated by a
40
+ copyright notice that is included in or attached to the work
41
+ (an example is provided in the Appendix below).
42
+
43
+ "Derivative Works" shall mean any work, whether in Source or Object
44
+ form, that is based on (or derived from) the Work and for which the
45
+ editorial revisions, annotations, elaborations, or other modifications
46
+ represent, as a whole, an original work of authorship. For the purposes
47
+ of this License, Derivative Works shall not include works that remain
48
+ separable from, or merely link (or bind by name) to the interfaces of,
49
+ the Work and Derivative Works thereof.
50
+
51
+ "Contribution" shall mean any work of authorship, including
52
+ the original version of the Work and any modifications or additions
53
+ to that Work or Derivative Works thereof, that is intentionally
54
+ submitted to Licensor for inclusion in the Work by the copyright owner
55
+ or by an individual or Legal Entity authorized to submit on behalf of
56
+ the copyright owner. For the purposes of this definition, "submitted"
57
+ means any form of electronic, verbal, or written communication sent
58
+ to the Licensor or its representatives, including but not limited to
59
+ communication on electronic mailing lists, source code control systems,
60
+ and issue tracking systems that are managed by, or on behalf of, the
61
+ Licensor for the purpose of discussing and improving the Work, but
62
+ excluding communication that is conspicuously marked or otherwise
63
+ designated in writing by the copyright owner as "Not a Contribution."
64
+
65
+ "Contributor" shall mean Licensor and any individual or Legal Entity
66
+ on behalf of whom a Contribution has been received by Licensor and
67
+ subsequently incorporated within the Work.
68
+
69
+ 2. Grant of Copyright License. Subject to the terms and conditions of
70
+ this License, each Contributor hereby grants to You a perpetual,
71
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
72
+ copyright license to reproduce, prepare Derivative Works of,
73
+ publicly display, publicly perform, sublicense, and distribute the
74
+ Work and such Derivative Works in Source or Object form.
75
+
76
+ 3. Grant of Patent License. Subject to the terms and conditions of
77
+ this License, each Contributor hereby grants to You a perpetual,
78
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
79
+ (except as stated in this section) patent license to make, have made,
80
+ use, offer to sell, sell, import, and otherwise transfer the Work,
81
+ where such license applies only to those patent claims licensable
82
+ by such Contributor that are necessarily infringed by their
83
+ Contribution(s) alone or by combination of their Contribution(s)
84
+ with the Work to which such Contribution(s) was submitted. If You
85
+ institute patent litigation against any entity (including a
86
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
87
+ or a Contribution incorporated within the Work constitutes direct
88
+ or contributory patent infringement, then any patent licenses
89
+ granted to You under this License for that Work shall terminate
90
+ as of the date such litigation is filed.
91
+
92
+ 4. Redistribution. You may reproduce and distribute copies of the
93
+ Work or Derivative Works thereof in any medium, with or without
94
+ modifications, and in Source or Object form, provided that You
95
+ meet the following conditions:
96
+
97
+ (a) You must give any other recipients of the Work or
98
+ Derivative Works a copy of this License; and
99
+
100
+ (b) You must cause any modified files to carry prominent notices
101
+ stating that You changed the files; and
102
+
103
+ (c) You must retain, in the Source form of any Derivative Works
104
+ that You distribute, all copyright, patent, trademark, and
105
+ attribution notices from the Source form of the Work,
106
+ excluding those notices that do not pertain to any part of
107
+ the Derivative Works; and
108
+
109
+ (d) If the Work includes a "NOTICE" text file as part of its
110
+ distribution, then any Derivative Works that You distribute must
111
+ include a readable copy of the attribution notices contained
112
+ within such NOTICE file, excluding those notices that do not
113
+ pertain to any part of the Derivative Works, in at least one
114
+ of the following places: within a NOTICE text file distributed
115
+ as part of the Derivative Works; within the Source form or
116
+ documentation, if provided along with the Derivative Works; or,
117
+ within a display generated by the Derivative Works, if and
118
+ wherever such third-party notices normally appear. The contents
119
+ of the NOTICE file are for informational purposes only and
120
+ do not modify the License. You may add Your own attribution
121
+ notices within Derivative Works that You distribute, alongside
122
+ or as an addendum to the NOTICE text from the Work, provided
123
+ that such additional attribution notices cannot be construed
124
+ as modifying the License.
125
+
126
+ You may add Your own copyright statement to Your modifications and
127
+ may provide additional or different license terms and conditions
128
+ for use, reproduction, or distribution of Your modifications, or
129
+ for any such Derivative Works as a whole, provided Your use,
130
+ reproduction, and distribution of the Work otherwise complies with
131
+ the conditions stated in this License.
132
+
133
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
134
+ any Contribution intentionally submitted for inclusion in the Work
135
+ by You to the Licensor shall be under the terms and conditions of
136
+ this License, without any additional terms or conditions.
137
+ Notwithstanding the above, nothing herein shall supersede or modify
138
+ the terms of any separate license agreement you may have executed
139
+ with Licensor regarding such Contributions.
140
+
141
+ 6. Trademarks. This License does not grant permission to use the trade
142
+ names, trademarks, service marks, or product names of the Licensor,
143
+ except as required for reasonable and customary use in describing the
144
+ origin of the Work and reproducing the content of the NOTICE file.
145
+
146
+ 7. Disclaimer of Warranty. Unless required by applicable law or
147
+ agreed to in writing, Licensor provides the Work (and each
148
+ Contributor provides its Contributions) on an "AS IS" BASIS,
149
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
150
+ implied, including, without limitation, any warranties or conditions
151
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
152
+ PARTICULAR PURPOSE. You are solely responsible for determining the
153
+ appropriateness of using or redistributing the Work and assume any
154
+ risks associated with Your exercise of permissions under this License.
155
+
156
+ 8. Limitation of Liability. In no event and under no legal theory,
157
+ whether in tort (including negligence), contract, or otherwise,
158
+ unless required by applicable law (such as deliberate and grossly
159
+ negligent acts) or agreed to in writing, shall any Contributor be
160
+ liable to You for damages, including any direct, indirect, special,
161
+ incidental, or consequential damages of any character arising as a
162
+ result of this License or out of the use or inability to use the
163
+ Work (including but not limited to damages for loss of goodwill,
164
+ work stoppage, computer failure or malfunction, or any and all
165
+ other commercial damages or losses), even if such Contributor
166
+ has been advised of the possibility of such damages.
167
+
168
+ 9. Accepting Warranty or Additional Liability. While redistributing
169
+ the Work or Derivative Works thereof, You may choose to offer,
170
+ and charge a fee for, acceptance of support, warranty, indemnity,
171
+ or other liability obligations and/or rights consistent with this
172
+ License. However, in accepting such obligations, You may act only
173
+ on Your own behalf and on Your sole responsibility, not on behalf
174
+ of any other Contributor, and only if You agree to indemnify,
175
+ defend, and hold each Contributor harmless for any liability
176
+ incurred by, or claims asserted against, such Contributor by reason
177
+ of your accepting any such warranty or additional liability.
178
+
179
+ END OF TERMS AND CONDITIONS
180
+
181
+ APPENDIX: How to apply the Apache License to your work.
182
+
183
+ To apply the Apache License to your work, attach the following
184
+ boilerplate notice, with the fields enclosed by brackets "[]"
185
+ replaced with your own identifying information. (Don't include
186
+ the brackets!) The text should be enclosed in the appropriate
187
+ comment syntax for the file format. We also recommend that a
188
+ file or class name and description of purpose be included on the
189
+ same "printed page" as the copyright notice for easier
190
+ identification within third-party archives.
191
+
192
+ Copyright [yyyy] [name of copyright owner]
193
+
194
+ Licensed under the Apache License, Version 2.0 (the "License");
195
+ you may not use this file except in compliance with the License.
196
+ You may obtain a copy of the License at
197
+
198
+ http://www.apache.org/licenses/LICENSE-2.0
199
+
200
+ Unless required by applicable law or agreed to in writing, software
201
+ distributed under the License is distributed on an "AS IS" BASIS,
202
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
203
+ See the License for the specific language governing permissions and
204
+ limitations under the License.
pifang-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,167 @@
1
+ Metadata-Version: 2.5
2
+ Name: pifang
3
+ Version: 0.1.0
4
+ Summary: Agent-first CLI for deterministic image, document, and media processing
5
+ Project-URL: Homepage, https://github.com/StormForgeVentures/pifang
6
+ Project-URL: Repository, https://github.com/StormForgeVentures/pifang
7
+ Project-URL: Issues, https://github.com/StormForgeVentures/pifang/issues
8
+ Project-URL: Changelog, https://github.com/StormForgeVentures/pifang/blob/main/CHANGELOG.md
9
+ Author-email: StormForge Ventures <hello@stormforgeventures.com>
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ Keywords: agents,batch,cli,ffmpeg,image,pdf,transcription,whisper
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Multimedia :: Graphics :: Graphics Conversion
21
+ Classifier: Topic :: Multimedia :: Video
22
+ Requires-Python: >=3.11
23
+ Requires-Dist: click>=8.0.0
24
+ Requires-Dist: pillow>=10.4.0
25
+ Requires-Dist: pyyaml>=6.0.0
26
+ Requires-Dist: typer>=0.12.0
27
+ Provides-Extra: dev
28
+ Requires-Dist: build>=1.2.0; extra == 'dev'
29
+ Requires-Dist: pymupdf4llm>=0.0.20; extra == 'dev'
30
+ Requires-Dist: pypdf>=5.0.0; extra == 'dev'
31
+ Requires-Dist: pytest-cov>=5.0.0; extra == 'dev'
32
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
33
+ Requires-Dist: twine>=7.0.0; extra == 'dev'
34
+ Provides-Extra: doc
35
+ Requires-Dist: pymupdf4llm>=0.0.20; extra == 'doc'
36
+ Requires-Dist: pypdf>=5.0.0; extra == 'doc'
37
+ Provides-Extra: doc-heavy
38
+ Requires-Dist: docling>=2.0.0; extra == 'doc-heavy'
39
+ Requires-Dist: marker-pdf>=1.0.0; extra == 'doc-heavy'
40
+ Provides-Extra: doc-odl
41
+ Requires-Dist: opendataloader-pdf>=1.0.0; extra == 'doc-odl'
42
+ Provides-Extra: fast
43
+ Requires-Dist: pyvips>=2.2.0; extra == 'fast'
44
+ Provides-Extra: transcribe
45
+ Requires-Dist: faster-whisper>=1.0.0; extra == 'transcribe'
46
+ Provides-Extra: video
47
+ Description-Content-Type: text/markdown
48
+
49
+ # Pifang
50
+
51
+ [![CI](https://github.com/StormForgeVentures/pifang/actions/workflows/ci.yml/badge.svg)](https://github.com/StormForgeVentures/pifang/actions/workflows/ci.yml)
52
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/StormForgeVentures/pifang/blob/main/LICENSE)
53
+
54
+ One CLI for the media chores that usually end up as one-off scripts: resize and convert images, export every social/blog/podcast size from one photo, turn PDFs into markdown, trim and transcode video, transcribe audio. Plain Python, runs locally, no cloud.
55
+
56
+ Built so AI agents can drive it too: add `--json` and every command returns one JSON object with stable exit codes.
57
+
58
+ ## What it does
59
+
60
+ | Domain | Commands |
61
+ |---|---|
62
+ | **Image** (core, Pillow) | `resize` `crop` `crop-square` `fit` `convert` `compress` `thumbnail` `strip-exif` `info` `analyze` · `remove-bg` `flatten-bg` `recolor` · recipes `avatar` `hero` `social-square` |
63
+ | **Image packs** | `social-pack` (Instagram square/tall/story, Facebook, LinkedIn, X, YouTube…) · `blog-pack` (OG, hero, Medium, card) · `podcast-pack` (Apple/Spotify covers) · `video-cover-pack` · `custom-pack` (your own `WxH:slug` list) |
64
+ | **Document** (`[doc]`) | `doc convert` PDF → markdown + images · `doc ingest` a folder → markdown + `ingest.jsonl` for RAG · `split` `merge` `extract-images` `ocr` `info` · `text chunk` `text frontmatter` · `meta index` `meta validate` |
65
+ | **Video** (system ffmpeg) | `trim` `transcode` `resize` `concat` `to-gif` `extract-frames` `extract-audio` `normalize-audio` `captions` `info` · recipes `social-clip` `podcast-audio` |
66
+ | **Transcribe** (`[transcribe]`) | `transcribe` any audio/video → `.transcript.json` + `.srt` (+ `.vtt`) with Faster-Whisper, local |
67
+ | **Pipelines** | `pipe image "crop-square \| resize 512 \| to-webp q85"` · `pipe video "trim 0-30 \| resize 1080x1920 \| transcode"` · `batch run image\|video <command> ./folder/` with a JSONL manifest · custom YAML recipes |
68
+
69
+ Every mutating command supports `--dry-run` and skips unchanged work; `pifang doctor` tells you which optional pieces are installed.
70
+
71
+ ## Install
72
+
73
+ ```bash
74
+ uv tool install 'pifang[doc,transcribe]'
75
+ # or
76
+ pipx install 'pifang[doc,transcribe]'
77
+ # or
78
+ pip install 'pifang[doc,transcribe]'
79
+
80
+ # guided extras (pip) + printed system commands for ffmpeg/Java
81
+ pifang setup
82
+ pifang setup --extras doc,transcribe --install
83
+ ```
84
+
85
+ | Extra | What you get |
86
+ |---|---|
87
+ | *(core)* | Pillow image CLI |
88
+ | `doc` | Pure-Python PDF path (default engine `fast`) |
89
+ | `doc-odl` | Optional OpenDataLoader (needs JDK 11+) |
90
+ | `doc-heavy` | marker + docling |
91
+ | `transcribe` | Faster-Whisper |
92
+ | `video` | Marker only — install system ffmpeg/ffprobe |
93
+ | `fast` | optional pyvips |
94
+
95
+ Default doc engine is pure-Python `fast`. OpenDataLoader is opt-in: `--engine opendataloader`.
96
+
97
+ ## Quickstart
98
+
99
+ ```bash
100
+ # works on a bare install — no extras, no system deps
101
+ pifang image avatar photo.jpg -o out/photo.webp --size 512
102
+ pifang image social-pack photo.jpg -o ./social/
103
+ pifang pipe image "crop-square | resize 512 | to-webp q85" photo.jpg -o out/photo.webp
104
+ pifang batch run image convert ./photos/ -o ./photos-webp/ --format webp --manifest ingest.jsonl
105
+
106
+ # check what the optional surfaces need
107
+ pifang doctor --doc --video --transcribe
108
+
109
+ pifang doc convert paper.pdf -o ./out/ # md + _images/ only
110
+ pifang doc ingest ./corpus/ -o ./corpus-md/ # + ingest.jsonl
111
+
112
+ pifang video trim clip.mp4 -o trim.mp4 --start 5 --duration 10
113
+ pifang pipe video "trim start=0 duration=10 | transcode" clip.mp4 -o out.mp4
114
+ pifang batch run video transcode ./clips/ -o ./out/ --format mp4
115
+ pifang transcribe clip.mp4 -o ./out/ # .transcript.json + .srt
116
+ ```
117
+
118
+ Output is plain text by default; add `--json` (before or after the subcommand) for one JSON object on stdout — agents should always pass it. Exit codes: 0 ok · 1 validation · 2 missing dep · 3 processing · 4 partial batch.
119
+
120
+ ```console
121
+ $ pifang image avatar photo.jpg -o out/photo.webp --size 512
122
+ OK image.avatar -> out/photo.webp
123
+
124
+ $ pifang image avatar photo.jpg -o out/photo.webp --size 512 --json
125
+ {"ok": true, "command": "image.avatar", "input": "/abs/photo.jpg", "output": "/abs/out/photo.webp",
126
+ "result": {"width": 512, "height": 512, "format": "webp", "bytes": 550}, "duration_ms": 18}
127
+
128
+ $ pifang image avatar missing.jpg -o out/x.webp --json; echo "exit=$?"
129
+ {"ok": false, "error_code": "FILE_NOT_FOUND", "message": "Input file not found: missing.jpg",
130
+ "exit_code": 1, "recovery": {"hint": "Check input path"}}
131
+ exit=1
132
+ ```
133
+
134
+ ## For AI agents
135
+
136
+ Most CLIs tolerate automation; pifang is designed for it. With `--json`, stdout is exactly one JSON object, success or failure; errors carry a stable `error_code`, a plain message and a `recovery.hint` down to the exact `pip install` to run. Exit codes mean something (`0` ok · `1` validation · `2` missing dependency · `3` processing · `4` partial batch). Typos in flags, enum values and pipe stages fail loudly with the valid options listed. Same input gives the same output; unchanged work is reported as skipped. `--help` at every level is the API doc.
137
+
138
+ Paste **[docs/agents-blurb.md](https://github.com/StormForgeVentures/pifang/blob/main/docs/agents-blurb.md)** into your project’s `AGENTS.md` / `CLAUDE.md`.
139
+
140
+ Optional Agent Skill: copy or symlink [`skills/pifang/SKILL.md`](https://github.com/StormForgeVentures/pifang/blob/main/skills/pifang/SKILL.md) into your runtime’s skills directory.
141
+
142
+ ## Custom recipes
143
+
144
+ Drop YAML in `./.pifang/recipes/` or `~/.config/pifang/recipes/`.
145
+
146
+ ## Library use
147
+
148
+ ```python
149
+ from pathlib import Path
150
+ from pifang.core.recipe import run_recipe
151
+
152
+ run_recipe("avatar", Path("photo.jpg"), Path("out.webp"), {"size": 256})
153
+ ```
154
+
155
+ ## Non-goals
156
+
157
+ No GUI, no bundled Java/ffmpeg, no MCP server in 0.1.x, no generative/scene video engines. See [docs/out-of-scope.md](https://github.com/StormForgeVentures/pifang/blob/main/docs/out-of-scope.md).
158
+
159
+ ## Docs
160
+
161
+ - [Contributing](https://github.com/StormForgeVentures/pifang/blob/main/CONTRIBUTING.md) · [Code of Conduct](https://github.com/StormForgeVentures/pifang/blob/main/CODE_OF_CONDUCT.md) · [Security](https://github.com/StormForgeVentures/pifang/blob/main/SECURITY.md) · [Changelog](https://github.com/StormForgeVentures/pifang/blob/main/CHANGELOG.md)
162
+ - [Project brief](https://github.com/StormForgeVentures/pifang/blob/main/docs/project-brief.md) · [API design](https://github.com/StormForgeVentures/pifang/blob/main/docs/api-design.md) · [Glossary](https://github.com/StormForgeVentures/pifang/blob/main/docs/glossary.md)
163
+ - [Publishing (PyPI)](https://github.com/StormForgeVentures/pifang/blob/main/docs/publishing.md)
164
+
165
+ ## License
166
+
167
+ Apache-2.0 — see [LICENSE](https://github.com/StormForgeVentures/pifang/blob/main/LICENSE).