pi-codex-image-gen 0.1.2 → 0.1.5
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.
- package/CHANGELOG.md +61 -0
- package/CODE_OF_CONDUCT.md +35 -0
- package/CONTRIBUTING.md +61 -0
- package/SECURITY.md +24 -0
- package/index.ts +2 -2
- package/package.json +46 -8
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
This project follows the spirit of [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and uses semantic versioning for releases.
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.1.5] - 2026-05-07
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- CI workflow running type-check and `pack:dry-run` on every push and PR.
|
|
14
|
+
- `CHANGELOG.md`, `CONTRIBUTING.md`, `CODE_OF_CONDUCT.md`, `SECURITY.md`.
|
|
15
|
+
- GitHub PR template and issue templates (bug report, feature request).
|
|
16
|
+
- `.editorconfig` for consistent editor settings.
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- `peerDependencies` relaxed to `"*"`; pinned versions moved to `devDependencies`.
|
|
21
|
+
- `tsconfig.json` module resolution updated from `Node16` to `NodeNext`.
|
|
22
|
+
- `package.json`: added `author`, `bugs`, `homepage`, `publishConfig.access`, `engines`, `pi-extension` keyword; community docs included in published `files`.
|
|
23
|
+
|
|
24
|
+
## [0.1.4] - 2026-05-07
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
|
|
28
|
+
- Added `repository.url` to `package.json`, required by npm provenance (sigstore) verification.
|
|
29
|
+
|
|
30
|
+
## [0.1.3] - 2026-05-07
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
|
|
34
|
+
- Migrated peer dependencies from `@mariozechner` to `@earendil-works` scope (`@earendil-works/pi-ai`, `@earendil-works/pi-coding-agent` v0.74.0).
|
|
35
|
+
|
|
36
|
+
### Added
|
|
37
|
+
|
|
38
|
+
- `.github/workflows/publish.yml`: OIDC-based npm publish triggered on GitHub release.
|
|
39
|
+
- `scripts.check` and `scripts.pack:dry-run` in `package.json`.
|
|
40
|
+
|
|
41
|
+
## [0.1.2] - 2025
|
|
42
|
+
|
|
43
|
+
### Changed
|
|
44
|
+
|
|
45
|
+
- Moved extension entry point to `index.ts` at the package root for a cleaner npm package name display in Pi.
|
|
46
|
+
|
|
47
|
+
## [0.1.1] - 2025
|
|
48
|
+
|
|
49
|
+
### Fixed
|
|
50
|
+
|
|
51
|
+
- Fixed extension identifier to use the package name instead of `package:file`.
|
|
52
|
+
|
|
53
|
+
## [0.1.0] - 2025
|
|
54
|
+
|
|
55
|
+
### Added
|
|
56
|
+
|
|
57
|
+
- Initial release.
|
|
58
|
+
- `codex_generate_image` Pi extension using the OpenAI Codex ChatGPT backend (`gpt-image-2`). Piggybacks on Pi's `openai-codex` login — no `OPENAI_API_KEY` required.
|
|
59
|
+
- `skills/imagegen` Pi skill with prompting playbook, chroma-key transparency workflow, and Python CLI fallback (`image_gen.py`).
|
|
60
|
+
- Save-mode configuration (`none`, `project`, `global`, `custom`) with env and config-file overrides.
|
|
61
|
+
- SSE stream parsing with exponential backoff retry on transient errors.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Code of Conduct
|
|
2
|
+
|
|
3
|
+
This project follows the Contributor Covenant Code of Conduct, version 2.1.
|
|
4
|
+
|
|
5
|
+
## Our pledge
|
|
6
|
+
|
|
7
|
+
We pledge to make participation in this project a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
|
|
8
|
+
|
|
9
|
+
## Our standards
|
|
10
|
+
|
|
11
|
+
Examples of behavior that contributes to a positive environment include:
|
|
12
|
+
|
|
13
|
+
- demonstrating empathy and kindness toward other people;
|
|
14
|
+
- being respectful of differing opinions, viewpoints, and experiences;
|
|
15
|
+
- giving and gracefully accepting constructive feedback;
|
|
16
|
+
- accepting responsibility and apologizing to those affected by mistakes;
|
|
17
|
+
- focusing on what is best for the overall community.
|
|
18
|
+
|
|
19
|
+
Examples of unacceptable behavior include:
|
|
20
|
+
|
|
21
|
+
- sexualized language or imagery, and sexual attention or advances;
|
|
22
|
+
- trolling, insulting or derogatory comments, and personal or political attacks;
|
|
23
|
+
- public or private harassment;
|
|
24
|
+
- publishing others' private information without explicit permission;
|
|
25
|
+
- other conduct that could reasonably be considered inappropriate in a professional setting.
|
|
26
|
+
|
|
27
|
+
## Enforcement
|
|
28
|
+
|
|
29
|
+
Project maintainers are responsible for clarifying and enforcing standards of acceptable behavior and may remove, edit, or reject comments, commits, code, issues, and other contributions that are not aligned with this Code of Conduct.
|
|
30
|
+
|
|
31
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the project maintainer through GitHub. All reports will be reviewed and investigated promptly and fairly.
|
|
32
|
+
|
|
33
|
+
## Attribution
|
|
34
|
+
|
|
35
|
+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/), version 2.1.
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Thanks for your interest in contributing to `pi-codex-image-gen`.
|
|
4
|
+
|
|
5
|
+
## Development setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bun install
|
|
9
|
+
bun run check
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
The package is source-distributed: Pi loads the TypeScript extension file directly. There is no build step for runtime use.
|
|
13
|
+
|
|
14
|
+
## Local testing
|
|
15
|
+
|
|
16
|
+
Install this checkout into a temporary Pi project:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
mkdir -p <test-project>
|
|
20
|
+
cd <test-project>
|
|
21
|
+
pi package add -l /path/to/pi-codex-image-gen
|
|
22
|
+
pi
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Then run `/login` for `openai-codex` and ask Pi to generate an image.
|
|
26
|
+
|
|
27
|
+
For a one-off run without changing settings:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pi -e /path/to/pi-codex-image-gen/index.ts
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
To validate the Python CLI fallback without an API key:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
python3 skills/imagegen/scripts/image_gen.py generate --prompt "Test" --out /tmp/test.png --dry-run
|
|
37
|
+
python3 skills/imagegen/scripts/remove_chroma_key.py --help
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Pull request checklist
|
|
41
|
+
|
|
42
|
+
Before opening a pull request:
|
|
43
|
+
|
|
44
|
+
- Run `bun run check`.
|
|
45
|
+
- Run `bun run pack:dry-run` and confirm the package contents are intentional.
|
|
46
|
+
- Update `README.md` if user-facing behavior changes.
|
|
47
|
+
- Update `CHANGELOG.md` for notable changes.
|
|
48
|
+
- Keep examples and paths generic; do not commit machine-specific paths or credentials.
|
|
49
|
+
|
|
50
|
+
## Coding guidelines
|
|
51
|
+
|
|
52
|
+
- Keep extension logic in `index.ts` unless there is a clear reason to split.
|
|
53
|
+
- When changing tool parameters, update both the Typebox `TOOL_PARAMS` schema and the `promptGuidelines` strings — Pi surfaces both to the model.
|
|
54
|
+
- Treat save-mode names, config file keys, and auth flow as public interface; changes to defaults or precedence are breaking changes.
|
|
55
|
+
- Do not modify `skills/imagegen/scripts/image_gen.py` without a documented reason; it is a vendored fallback.
|
|
56
|
+
- The Codex Responses SSE contract is undocumented and may change. If generation breaks, log raw events before assuming a code bug.
|
|
57
|
+
- Avoid requiring `OPENAI_API_KEY` for the normal Pi tool path; auth piggybacks on Pi's `openai-codex` login.
|
|
58
|
+
|
|
59
|
+
## Code of conduct
|
|
60
|
+
|
|
61
|
+
This project follows the [Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.md).
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported versions
|
|
4
|
+
|
|
5
|
+
Security fixes are provided for the latest released version of `pi-codex-image-gen`.
|
|
6
|
+
|
|
7
|
+
## Reporting a vulnerability
|
|
8
|
+
|
|
9
|
+
Please do not open a public issue for suspected security vulnerabilities.
|
|
10
|
+
|
|
11
|
+
Report privately by contacting the repository maintainer through GitHub. Include:
|
|
12
|
+
|
|
13
|
+
- a description of the issue;
|
|
14
|
+
- steps to reproduce;
|
|
15
|
+
- affected versions or commits, if known;
|
|
16
|
+
- any suggested mitigation.
|
|
17
|
+
|
|
18
|
+
The maintainer will acknowledge reports as soon as practical and coordinate disclosure once a fix or mitigation is available.
|
|
19
|
+
|
|
20
|
+
## Security model
|
|
21
|
+
|
|
22
|
+
`pi-codex-image-gen` is a Pi package. Pi extensions execute with the same permissions as the local user running Pi. Users should review installed Pi packages and only install packages from sources they trust.
|
|
23
|
+
|
|
24
|
+
The extension uses Pi's existing `openai-codex` login to obtain a short-lived JWT. The token is used only for requests to the Codex Responses API and is never written to disk or logged. Do not commit API keys, tokens, or decoded JWT payloads.
|
package/index.ts
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
import { readFileSync } from "node:fs";
|
|
10
10
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
11
11
|
import { isAbsolute, join, resolve } from "node:path";
|
|
12
|
-
import { StringEnum } from "@
|
|
13
|
-
import { type ExtensionAPI, getAgentDir, withFileMutationQueue } from "@
|
|
12
|
+
import { StringEnum } from "@earendil-works/pi-ai";
|
|
13
|
+
import { type ExtensionAPI, getAgentDir, withFileMutationQueue } from "@earendil-works/pi-coding-agent";
|
|
14
14
|
import { type Static, Type } from "typebox";
|
|
15
15
|
|
|
16
16
|
const PROVIDER = "openai-codex";
|
package/package.json
CHANGED
|
@@ -1,22 +1,60 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-codex-image-gen",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Image generation for Pi using the ChatGPT Images 2.0 model.",
|
|
5
|
-
"license": "Apache-2.0",
|
|
6
|
-
"files": ["index.ts", "skills", "README.md", "LICENSE"],
|
|
7
|
-
"keywords": ["pi-package", "pi", "codex", "image-generation", "gpt-image-2"],
|
|
8
5
|
"type": "module",
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"author": "jvm",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/jvm/pi-codex-image-gen.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/jvm/pi-codex-image-gen/issues"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://github.com/jvm/pi-codex-image-gen#readme",
|
|
16
|
+
"keywords": [
|
|
17
|
+
"pi-package",
|
|
18
|
+
"pi-extension",
|
|
19
|
+
"pi",
|
|
20
|
+
"codex",
|
|
21
|
+
"image-generation",
|
|
22
|
+
"gpt-image-2"
|
|
23
|
+
],
|
|
24
|
+
"files": [
|
|
25
|
+
"index.ts",
|
|
26
|
+
"skills",
|
|
27
|
+
"README.md",
|
|
28
|
+
"LICENSE",
|
|
29
|
+
"CHANGELOG.md",
|
|
30
|
+
"SECURITY.md",
|
|
31
|
+
"CONTRIBUTING.md",
|
|
32
|
+
"CODE_OF_CONDUCT.md"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"check": "tsc --noEmit",
|
|
36
|
+
"pack:dry-run": "npm pack --dry-run"
|
|
13
37
|
},
|
|
14
38
|
"pi": {
|
|
15
39
|
"extensions": ["./index.ts"],
|
|
16
40
|
"skills": ["./skills"]
|
|
17
41
|
},
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"@earendil-works/pi-ai": "*",
|
|
44
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
45
|
+
"typebox": "*"
|
|
46
|
+
},
|
|
18
47
|
"devDependencies": {
|
|
48
|
+
"@earendil-works/pi-ai": "^0.74.0",
|
|
49
|
+
"@earendil-works/pi-coding-agent": "^0.74.0",
|
|
50
|
+
"typebox": "^1.1.33",
|
|
19
51
|
"@types/node": "^25.6.0",
|
|
20
52
|
"typescript": "^6.0.3"
|
|
53
|
+
},
|
|
54
|
+
"publishConfig": {
|
|
55
|
+
"access": "public"
|
|
56
|
+
},
|
|
57
|
+
"engines": {
|
|
58
|
+
"node": ">=20.6.0"
|
|
21
59
|
}
|
|
22
60
|
}
|