codex-arsenal 0.1.0 → 0.2.1

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/CODEX.md CHANGED
@@ -1,121 +1,121 @@
1
- # CODEX.md
2
-
3
- > Behavioral guidelines to reduce common LLM coding mistakes.
4
- > Merge with project-specific instructions as needed.
5
- > **Tradeoff:** These guidelines bias toward caution over speed. For trivial tasks, use judgment.
6
-
7
- ---
8
-
9
- ## 1. Think Before Coding
10
-
11
- **Don't assume. Don't hide confusion. Surface tradeoffs.**
12
-
13
- Before implementing:
14
-
15
- - State your assumptions explicitly. If uncertain, ask.
16
- - If multiple interpretations exist, present them — don't pick silently.
17
- - If a simpler approach exists, say so. Push back when warranted.
18
- - If something is unclear, **stop**. Name what's confusing. Ask.
19
-
20
- ---
21
-
22
- ## 2. Simplicity First
23
-
24
- **Minimum code that solves the problem. Nothing speculative.**
25
-
26
- - No features beyond what was asked.
27
- - No abstractions for single-use code.
28
- - No "flexibility" or "configurability" that wasn't requested.
29
- - No error handling for impossible scenarios.
30
- - If you write 200 lines and it could be 50, rewrite it.
31
-
32
- > Ask yourself: *"Would a senior engineer say this is overcomplicated?"*
33
- > If yes — simplify.
34
-
35
- ---
36
-
37
- ## 3. Surgical Changes
38
-
39
- **Touch only what you must. Clean up only your own mess.**
40
-
41
- When editing existing code:
42
-
43
- - Don't "improve" adjacent code, comments, or formatting.
44
- - Don't refactor things that aren't broken.
45
- - Match existing style, even if you'd do it differently.
46
- - If you notice unrelated dead code, **mention it — don't delete it**.
47
-
48
- When your changes create orphans:
49
-
50
- - Remove imports / variables / functions that **YOUR changes** made unused.
51
- - Don't remove pre-existing dead code unless asked.
52
-
53
- > **The test:** Every changed line should trace directly to the user's request.
54
-
55
- ---
56
-
57
- ## 4. Goal-Driven Execution
58
-
59
- **Define success criteria. Loop until verified.**
60
-
61
- Transform tasks into verifiable goals:
62
-
63
- | Vague | Verifiable |
64
- |-------|------------|
65
- | "Add validation" | "Write tests for invalid inputs, then make them pass" |
66
- | "Fix the bug" | "Write a test that reproduces it, then make it pass" |
67
- | "Refactor X" | "Ensure tests pass before and after" |
68
-
69
- For multi-step tasks, state a brief plan:
70
-
71
- ```
72
- 1. [Step] → verify: [check]
73
- 2. [Step] → verify: [check]
74
- 3. [Step] → verify: [check]
75
- ```
76
-
77
- Strong success criteria let you loop independently.
78
- Weak criteria ("make it work") require constant clarification.
79
-
80
- ---
81
-
82
- ## 5. Agentic Execution (Codex-specific)
83
-
84
- **Codex runs with more autonomy — so guardrails matter more.**
85
-
86
- - **Sandbox first:** Never run destructive commands (`rm -rf`, DB migrations, deploys) without explicit confirmation.
87
- - **Read before write:** Understand the existing codebase structure before modifying it. Use `find`, `grep`, `cat` to build context.
88
- - **One action at a time:** In agentic loops, complete and verify each step before proceeding to the next.
89
- - **Fail loudly:** If a step fails, surface the error immediately. Don't try to work around it silently.
90
- - **Scope your shell:** Prefer relative paths over absolute. Never assume a working directory without confirming it.
91
-
92
- ---
93
-
94
- ## 6. Context Awareness
95
-
96
- **Codex has a limited context window — use it wisely.**
97
-
98
- - Don't re-read files you've already loaded. Reference prior output instead.
99
- - When summarizing large codebases, compress systematically: directory tree → key files → function signatures.
100
- - If context is filling up, state it: *"I'm approaching context limits. Summarizing and continuing."*
101
- - Prefer targeted grep/search over reading entire files when looking for a specific symbol.
102
-
103
- ---
104
-
105
- ## 7. Tool Use Discipline
106
-
107
- **Every tool call has a cost. Make them count.**
108
-
109
- - Batch related reads into a single operation where possible.
110
- - Don't run the same command twice to "verify" — if you need to verify, define the assertion first.
111
- - Avoid speculative exploration ("let me just check...") — know what you're looking for before you look.
112
- - If a tool fails, diagnose before retrying. Don't brute-force.
113
-
114
- ---
115
-
116
- ## ✅ These guidelines are working if:
117
-
118
- - Diffs contain fewer unnecessary changes
119
- - Fewer rewrites due to overcomplication
120
- - Clarifying questions come **before** implementation, not after mistakes
1
+ # CODEX.md
2
+
3
+ > Behavioral guidelines to reduce common LLM coding mistakes.
4
+ > Merge with project-specific instructions as needed.
5
+ > **Tradeoff:** These guidelines bias toward caution over speed. For trivial tasks, use judgment.
6
+
7
+ ---
8
+
9
+ ## 1. Think Before Coding
10
+
11
+ **Don't assume. Don't hide confusion. Surface tradeoffs.**
12
+
13
+ Before implementing:
14
+
15
+ - State your assumptions explicitly. If uncertain, ask.
16
+ - If multiple interpretations exist, present them — don't pick silently.
17
+ - If a simpler approach exists, say so. Push back when warranted.
18
+ - If something is unclear, **stop**. Name what's confusing. Ask.
19
+
20
+ ---
21
+
22
+ ## 2. Simplicity First
23
+
24
+ **Minimum code that solves the problem. Nothing speculative.**
25
+
26
+ - No features beyond what was asked.
27
+ - No abstractions for single-use code.
28
+ - No "flexibility" or "configurability" that wasn't requested.
29
+ - No error handling for impossible scenarios.
30
+ - If you write 200 lines and it could be 50, rewrite it.
31
+
32
+ > Ask yourself: *"Would a senior engineer say this is overcomplicated?"*
33
+ > If yes — simplify.
34
+
35
+ ---
36
+
37
+ ## 3. Surgical Changes
38
+
39
+ **Touch only what you must. Clean up only your own mess.**
40
+
41
+ When editing existing code:
42
+
43
+ - Don't "improve" adjacent code, comments, or formatting.
44
+ - Don't refactor things that aren't broken.
45
+ - Match existing style, even if you'd do it differently.
46
+ - If you notice unrelated dead code, **mention it — don't delete it**.
47
+
48
+ When your changes create orphans:
49
+
50
+ - Remove imports / variables / functions that **YOUR changes** made unused.
51
+ - Don't remove pre-existing dead code unless asked.
52
+
53
+ > **The test:** Every changed line should trace directly to the user's request.
54
+
55
+ ---
56
+
57
+ ## 4. Goal-Driven Execution
58
+
59
+ **Define success criteria. Loop until verified.**
60
+
61
+ Transform tasks into verifiable goals:
62
+
63
+ | Vague | Verifiable |
64
+ |-------|------------|
65
+ | "Add validation" | "Write tests for invalid inputs, then make them pass" |
66
+ | "Fix the bug" | "Write a test that reproduces it, then make it pass" |
67
+ | "Refactor X" | "Ensure tests pass before and after" |
68
+
69
+ For multi-step tasks, state a brief plan:
70
+
71
+ ```
72
+ 1. [Step] → verify: [check]
73
+ 2. [Step] → verify: [check]
74
+ 3. [Step] → verify: [check]
75
+ ```
76
+
77
+ Strong success criteria let you loop independently.
78
+ Weak criteria ("make it work") require constant clarification.
79
+
80
+ ---
81
+
82
+ ## 5. Agentic Execution (Codex-specific)
83
+
84
+ **Codex runs with more autonomy — so guardrails matter more.**
85
+
86
+ - **Sandbox first:** Never run destructive commands (`rm -rf`, DB migrations, deploys) without explicit confirmation.
87
+ - **Read before write:** Understand the existing codebase structure before modifying it. Use `find`, `grep`, `cat` to build context.
88
+ - **One action at a time:** In agentic loops, complete and verify each step before proceeding to the next.
89
+ - **Fail loudly:** If a step fails, surface the error immediately. Don't try to work around it silently.
90
+ - **Scope your shell:** Prefer relative paths over absolute. Never assume a working directory without confirming it.
91
+
92
+ ---
93
+
94
+ ## 6. Context Awareness
95
+
96
+ **Codex has a limited context window — use it wisely.**
97
+
98
+ - Don't re-read files you've already loaded. Reference prior output instead.
99
+ - When summarizing large codebases, compress systematically: directory tree → key files → function signatures.
100
+ - If context is filling up, state it: *"I'm approaching context limits. Summarizing and continuing."*
101
+ - Prefer targeted grep/search over reading entire files when looking for a specific symbol.
102
+
103
+ ---
104
+
105
+ ## 7. Tool Use Discipline
106
+
107
+ **Every tool call has a cost. Make them count.**
108
+
109
+ - Batch related reads into a single operation where possible.
110
+ - Don't run the same command twice to "verify" — if you need to verify, define the assertion first.
111
+ - Avoid speculative exploration ("let me just check...") — know what you're looking for before you look.
112
+ - If a tool fails, diagnose before retrying. Don't brute-force.
113
+
114
+ ---
115
+
116
+ ## ✅ These guidelines are working if:
117
+
118
+ - Diffs contain fewer unnecessary changes
119
+ - Fewer rewrites due to overcomplication
120
+ - Clarifying questions come **before** implementation, not after mistakes
121
121
  - Agentic runs complete tasks end-to-end without silent failures or scope creep
package/README.md CHANGED
@@ -1,173 +1,176 @@
1
1
  # Codex-Arsenal
2
2
 
3
- > OpenAI Codex / Claude Code 기반 개발 경험을 극대화하기 위한
4
- > 플러그인 · 스킬 · 워크플로 · 설정 · 프롬프트 큐레이션 레포지토리.
3
+ Practical building blocks for working with OpenAI Codex, Claude Code, and other coding agents.
5
4
 
6
- ---
5
+ Codex-Arsenal is not an awesome list. It is a small, installable collection of agent guidelines, skills, prompts, workflows, configs, and plugin sketches that can be copied into real projects.
7
6
 
8
- ## 🧭 이 레포는 무엇인가?
7
+ ## Install
9
8
 
10
- **Codex-Arsenal**은 AI 코딩 에이전트(OpenAI Codex, Claude Code 등)를 실무에 적용하면서
11
- "vanilla setup만으로는 부족하다"고 느낀 개발자들을 위한 실용 자료 모음입니다.
9
+ Run the CLI without installing it globally:
12
10
 
13
- 단순한 awesome list와 다른 점:
14
-
15
- - 실제로 써봤거나, 체감 생산성이 검증된 것만 수록
16
- - setup → 사용법 → 주의사항까지 한 곳에서 해결
17
- - 개인 개발자 / 소규모 팀 모두를 대상으로 함
18
- - Claude Code 스타일의 agentic workflow에 최적화
11
+ ```bash
12
+ npx codex-arsenal list
13
+ ```
19
14
 
20
- > **대상 독자:** 이미 Codex 또는 Claude Code를 써본 개발자.
21
- > AI 코딩 도구가 처음이라면 [공식 문서](https://platform.openai.com/docs/guides/code)부터 시작하세요.
15
+ Install the default item set into the current project:
22
16
 
23
- ---
17
+ ```bash
18
+ npx codex-arsenal init --yes
19
+ ```
24
20
 
25
- ## 📂 레포지토리 구조
21
+ Install specific items:
26
22
 
27
- ```
28
- codex-arsenal/
29
- ├── plugins/ # 에이전트 기능을 확장하는 플러그인 모음
30
- ├── skills/ # 재사용 가능한 에이전트 스킬 패키지
31
- ├── prompts/ # 프롬프트 템플릿 및 system prompt 예제
32
- ├── workflows/ # 워크플로 정의 및 실행 스크립트
33
- ├── configs/ # .codex, VSCode, zsh, tmux 등 설정 파일
34
- ├── references/ # 논문 · 블로그 · 주목할 GitHub 레포 링크
35
- ├── examples/ # 실전 데모 및 before/after 예제
36
- └── README.md
23
+ ```bash
24
+ npx codex-arsenal get codex-md skill-publishing-npm-packages
37
25
  ```
38
26
 
39
- ---
27
+ Install into another directory:
40
28
 
41
- ## ✨ 수록 콘텐츠 카테고리
29
+ ```bash
30
+ npx codex-arsenal get codex-md --dir ./my-project
31
+ ```
42
32
 
43
- ### 🔌 Plugins
33
+ On Windows or when running from a package directory with the same name, this form is the most reliable:
44
34
 
45
- 에이전트 자체 기능을 보강하는 플러그인.
35
+ ```bash
36
+ npm exec --yes --package=codex-arsenal -- codex-arsenal list
37
+ ```
46
38
 
47
- 현재 수록 중 / 예정:
39
+ ## CLI
48
40
 
49
- | 이름 | 설명 | 상태 |
50
- |------|------|------|
51
- | context-window-compressor | 긴 대화 컨텍스트를 압축해 토큰 절약 | 준비 중 |
52
- | git-diff-helper | PR diff 요약 및 리뷰 요청 자동화 | 준비 중 |
53
- | multi-agent-router | 여러 에이전트에 작업을 분배하는 라우터 | 계획 중 |
54
- | repo-memory | 프로젝트 구조를 기억하는 메모리 레이어 | 계획 중 |
41
+ ```bash
42
+ codex-arsenal init [--yes] [--dir <path>]
43
+ codex-arsenal list
44
+ codex-arsenal get <id...> [--dir <path>]
45
+ ```
55
46
 
56
- ---
47
+ - `init` opens a small selector. With `--yes`, it installs default items without prompting.
48
+ - `list` prints all installable manifest entries grouped by category.
49
+ - `get` installs one or more manifest entries by id.
57
50
 
58
- ### 🧠 Skills
51
+ The package is published on npm as [`codex-arsenal`](https://www.npmjs.com/package/codex-arsenal).
59
52
 
60
- 반복 작업에서 즉시 꺼내 쓸 수 있는 스킬셋.
53
+ ## What Is Included
61
54
 
62
- | 스킬 | 설명 |
63
- |------|------|
64
- | `debug-workflow` | 에러 로그 → 원인 분석 → 수정 → 재현 테스트까지 파이프라인화 |
65
- | `pr-reviewer` | PR diff를 받아 리뷰 코멘트를 자동 생성 |
66
- | `test-gen` | 함수 시그니처와 코드를 보고 유닛 테스트 자동 생성 |
67
- | `refactor-pipeline` | 코드 품질 분석 → 리팩터링 제안 → 적용까지 단계 처리 |
68
- | `doc-gen` | 코드베이스에서 README, API 문서 자동 작성 |
69
- | `arch-analysis` | 레포 전체 구조를 분석해 의존성 맵 생성 |
55
+ ### Behavior Guidelines
70
56
 
71
- ---
57
+ | ID | Installs | Purpose |
58
+ | --- | --- | --- |
59
+ | `codex-md` | `CODEX.md` | Project-local behavioral guardrails for Codex-style agents. |
60
+ | `claude-md` | `CLAUDE.md` | Project-local behavioral guardrails for Claude Code. |
72
61
 
73
- ### ⚙️ Configs
62
+ ### Configs
74
63
 
75
- 실제 사용 중인 설정 파일 모음. 복붙 후 바로 사용 가능한 형태로 제공.
64
+ | ID | Installs | Purpose |
65
+ | --- | --- | --- |
66
+ | `config-codex` | `.codex/config.json` | Starter Codex config. |
67
+ | `config-vscode` | `.vscode/settings.json` | VS Code settings for agent-assisted development. |
76
68
 
77
- - `.codex/config.json` — Codex 에이전트 기본 설정 프리셋
78
- - `settings.json` — VSCode + Codex 통합 설정
79
- - `system-prompts/` — 역할별 system prompt 템플릿 (solo dev / 팀 / 레거시 분석)
80
- - `.zshrc` 스니펫 — Codex CLI alias 및 단축키 모음
81
- - `tmux.conf` — AI 세션을 병렬로 띄우기 위한 tmux 레이아웃
69
+ ### Prompts
82
70
 
83
- ---
71
+ | ID | Installs | Purpose |
72
+ | --- | --- | --- |
73
+ | `prompt-solo-dev` | `prompts/system-prompts/solo-dev.md` | Solo developer system prompt template. |
84
74
 
85
- ### 🧩 Workflows
75
+ ### Skills
86
76
 
87
- "어떻게 써야 쓰는가"에 대한 실전 운영 방식.
77
+ | ID | Installs | Purpose |
78
+ | --- | --- | --- |
79
+ | `skill-debug-workflow` | `skills/debug-workflow/` | Reproduce, diagnose, test, and fix bugs systematically. |
80
+ | `skill-test-gen` | `skills/test-gen/` | Generate focused tests from behavior notes and function signatures. |
81
+ | `skill-publishing-npm-packages` | `skills/publishing-npm-packages/SKILL.md` | Prepare, troubleshoot, and automate npm releases with Trusted Publishing. |
88
82
 
89
- | 워크플로 | 대상 | 핵심 아이디어 |
90
- |----------|------|---------------|
91
- | `solo-dev-loop` | 혼자 개발하는 개발자 | 계획 → 코딩 → 테스트 → 커밋을 에이전트와 함께 |
92
- | `startup-mvp` | 빠른 프로토타입이 필요한 팀 | 스펙 → 구현 → 배포 최단 경로 |
93
- | `legacy-onboarding` | 오래된 코드베이스 합류 | 에이전트로 구조 파악 → 코드 맵 생성 |
94
- | `ai-pair-programming` | 주니어/미드 개발자 | 에이전트를 시니어처럼 활용하는 패턴 |
95
- | `multi-agent-orch` | 복잡한 대형 태스크 | 여러 에이전트에게 역할 분배 후 결과 통합 |
83
+ ### Plugins
96
84
 
97
- ---
85
+ | ID | Installs | Purpose |
86
+ | --- | --- | --- |
87
+ | `plugin-context-window-compressor` | `plugins/context-window-compressor/` | Plugin sketch for compressing long agent context into concise handoff notes. |
98
88
 
99
- ### 📚 References
89
+ ### Workflows
100
90
 
101
- 읽어볼 가치 있는 자료 큐레이션. 링크만 나열하지 않고, **왜 읽어야 하는지** 한 줄 설명 포함.
91
+ | ID | Installs | Purpose |
92
+ | --- | --- | --- |
93
+ | `workflow-solo-dev-loop` | `workflows/solo-dev-loop/` | A plan, code, test, commit loop for solo developers using agents. |
102
94
 
103
- - 논문 · 연구 자료
104
- - 주목할 GitHub 레포 (with star 기준 및 실용성 코멘트)
105
- - 블로그 · 튜토리얼 (검증된 것만)
106
- - 프롬프트 엔지니어링 컬렉션
95
+ ## Repository Layout
107
96
 
108
- ---
97
+ ```text
98
+ codex-arsenal/
99
+ bin/ CLI entrypoint
100
+ lib/ manifest, installer, and fetcher
101
+ configs/ reusable editor and agent configs
102
+ plugins/ plugin sketches
103
+ prompts/ system prompt templates
104
+ skills/ reusable agent skills
105
+ workflows/ repeatable agentic workflows
106
+ references/ curated references and notes
107
+ examples/ before/after examples
108
+ test/ Node test suite
109
+ ```
109
110
 
110
- ## 수록 기준
111
+ `lib/manifest.js` is the source of truth for installable items. Add new content there when you want it to appear in `codex-arsenal list` or be installable through `codex-arsenal get`.
111
112
 
112
- 모든 콘텐츠는 아래 기준을 만족해야 합니다:
113
+ ## Development
113
114
 
114
- | 기준 | 설명 |
115
- |------|------|
116
- | ✅ 실사용 검증 | 실제로 사용해봤거나, 커뮤니티에서 반복 검증된 것 |
117
- | ✅ 실무 적용 가능 | 장난감 예제가 아닌 실제 코드베이스에 적용 가능 |
118
- | ✅ 반복 사용성 | 한 번만 쓰고 마는 것이 아닌, 루틴으로 쓸 수 있는 것 |
119
- | ✅ setup 대비 효율 | 설치/설정 비용보다 얻는 생산성이 명확히 큰 것 |
120
- | ✅ 한계 보완 | Codex/Claude Code의 알려진 약점을 보완하는 것 |
115
+ Run tests:
121
116
 
122
- ---
117
+ ```bash
118
+ npm test
119
+ ```
123
120
 
124
- ## 🛠 빠른 시작
121
+ Preview the npm package contents:
125
122
 
126
123
  ```bash
127
- # 레포 클론
128
- git clone https://github.com/your-username/codex-arsenal.git
129
- cd codex-arsenal
124
+ npm pack --dry-run
125
+ ```
130
126
 
131
- # 설정 파일 적용 (예시: VSCode 설정)
132
- cp configs/vscode/settings.json ~/.vscode/settings.json
127
+ Try the local CLI:
133
128
 
134
- # 워크플로 스크립트 실행 (예시: solo-dev-loop)
135
- ./workflows/solo-dev-loop/setup.sh
129
+ ```bash
130
+ node bin/cli.js list
131
+ node bin/cli.js get codex-md --dir ./tmp-install
136
132
  ```
137
133
 
138
- > 각 폴더에는 독립적인 `README.md`가 있어 개별 설치 및 사용법을 안내합니다.
134
+ ## Publishing
139
135
 
140
- ---
136
+ This repository is configured for npm Trusted Publishing through GitHub Actions.
141
137
 
142
- ## 🤝 기여 방법
138
+ Release flow:
143
139
 
144
- 좋은 자료가 있다면 PR로 기여해주세요. 특히 환영하는 기여:
140
+ ```bash
141
+ npm test
142
+ npm pack --dry-run
143
+ npm version patch
144
+ git push --follow-tags
145
+ ```
145
146
 
146
- - 실제로 오래 써서 검증된
147
- - before / after 생산성 차이가 명확한 것
148
- - setup 과정이 step-by-step으로 정리된 것
149
- - 특정 상황(레거시, 대형 레포, 팀 협업 등)에서 효과적인 것
147
+ Use `minor` instead of `patch` when adding new installable content or CLI behavior:
150
148
 
151
- **기여 절차:**
149
+ ```bash
150
+ npm version minor
151
+ git push --follow-tags
152
+ ```
152
153
 
153
- 1. `fork` feature 브랜치 생성 (`feat/plugin-이름` 또는 `feat/workflow-이름`)
154
- 2. 해당 카테고리 폴더에 파일 추가 (각 폴더의 `TEMPLATE.md` 참고)
155
- 3. PR 제목에 카테고리 명시: `[plugin] context-window-compressor 추가`
156
- 4. PR 본문에 **사용 배경 / 실제 효과 / 주의사항** 포함
154
+ The publish workflow runs on `v*` tags and publishes with OIDC, so it does not require a long-lived `NPM_TOKEN`.
157
155
 
158
- ---
156
+ ## Contribution Guidelines
159
157
 
160
- ## 🌌 방향성
158
+ Good additions should be:
161
159
 
162
- 가까운 미래의 개발 환경은 "IDE + 자동완성 AI" 수준을 넘어,
163
- 개발자가 **여러 AI 에이전트를 orchestration하며 일하는 구조**에 가까워질 것입니다.
160
+ - useful in real projects, not just demos;
161
+ - small enough to understand quickly;
162
+ - documented with setup and usage notes;
163
+ - installable through the manifest when appropriate;
164
+ - verified with tests or a concrete manual check.
164
165
 
165
- 레포는 방향으로의 전환을 실험하고,
166
- 실제로 쓸 수 있는 도구와 패턴을 기록하는 공간입니다.
166
+ When adding a new installable item:
167
167
 
168
- ---
168
+ 1. Add the files under the appropriate top-level directory.
169
+ 2. Add a manifest entry in `lib/manifest.js`.
170
+ 3. Run `npm test`.
171
+ 4. Run `node bin/cli.js list` and confirm the item appears.
172
+ 5. Run `npm pack --dry-run` and confirm the intended files are included.
169
173
 
170
- ## 📌 태그
174
+ ## License
171
175
 
172
- `codex` `claude-code` `ai-agent` `developer-tools` `prompt-engineering`
173
- `llm-workflow` `productivity` `automation` `vscode` `terminal`
176
+ MIT
package/lib/installer.js CHANGED
@@ -16,28 +16,31 @@ async function readSourceFile(src) {
16
16
  }
17
17
  }
18
18
 
19
- export async function installItems(items, targetDir) {
19
+ export async function installItems(items, targetDir, opts = {}) {
20
20
  const resolvedTarget = path.resolve(targetDir);
21
21
  let installed = 0;
22
22
  let failed = 0;
23
+ const successes = [];
23
24
  const failures = [];
25
+ const readSource = opts.readSourceFile || readSourceFile;
24
26
 
25
27
  for (const item of items) {
26
28
  for (const file of item.files) {
27
29
  const destination = path.join(resolvedTarget, file.dest);
28
30
  try {
29
- const content = await readSourceFile(file.src);
31
+ const content = await readSource(file.src);
30
32
  await mkdir(path.dirname(destination), { recursive: true });
31
33
  await writeFile(destination, content, "utf8");
32
34
  installed += 1;
35
+ successes.push(file.dest);
33
36
  } catch (error) {
34
37
  failed += 1;
35
- failures.push({ item: item.id, file: file.src, error: error.message });
38
+ failures.push({ item: item.id, file: file.src, dest: file.dest, error: error.message });
36
39
  }
37
40
  }
38
41
  }
39
42
 
40
- return { installed, failed, failures, targetDir: resolvedTarget };
43
+ return { installed, failed, successes, failures, targetDir: resolvedTarget };
41
44
  }
42
45
 
43
46
  function defaultItems() {
@@ -75,14 +78,17 @@ export async function runInit(opts = {}) {
75
78
 
76
79
  if (!selected.length) {
77
80
  console.log("No items selected.");
78
- return { installed: 0, failed: 0, failures: [], targetDir: path.resolve(opts.dir || ".") };
81
+ return { installed: 0, failed: 0, successes: [], failures: [], targetDir: path.resolve(opts.dir || ".") };
79
82
  }
80
83
 
81
- const result = await installItems(selected, opts.dir || process.cwd());
82
- for (const item of selected) {
83
- for (const file of item.files) {
84
- console.log(`installed ${file.dest}`);
85
- }
84
+ const result = await installItems(selected, opts.dir || process.cwd(), {
85
+ readSourceFile: opts.readSourceFile
86
+ });
87
+ for (const file of result.successes) {
88
+ console.log(`installed ${file}`);
89
+ }
90
+ for (const failure of result.failures) {
91
+ console.log(`failed ${failure.dest} (${failure.error})`);
86
92
  }
87
93
  console.log(`\nDone: ${result.installed} installed${result.failed ? `, ${result.failed} failed` : ""}.`);
88
94
  return result;
package/lib/manifest.js CHANGED
@@ -1,4 +1,4 @@
1
- export const REPO = "your-username/codex-arsenal";
1
+ export const REPO = "citron03/Codex-Arsenal";
2
2
  export const BRANCH = "main";
3
3
  export const BASE_URL = `https://raw.githubusercontent.com/${REPO}/${BRANCH}`;
4
4
 
@@ -60,6 +60,15 @@ export const MANIFEST = [
60
60
  { src: "skills/test-gen/prompt.md", dest: "skills/test-gen/prompt.md" }
61
61
  ]
62
62
  },
63
+ {
64
+ id: "skill-publishing-npm-packages",
65
+ category: "Skills",
66
+ label: "publishing-npm-packages",
67
+ description: "A Codex skill for preparing, troubleshooting, and automating npm package releases.",
68
+ files: [
69
+ { src: "skills/publishing-npm-packages/SKILL.md", dest: "skills/publishing-npm-packages/SKILL.md" }
70
+ ]
71
+ },
63
72
  {
64
73
  id: "plugin-context-window-compressor",
65
74
  category: "Plugins",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-arsenal",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "description": "A practical arsenal of Codex and Claude Code plugins, skills, prompts, workflows, and configs.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,158 @@
1
+ ---
2
+ name: publishing-npm-packages
3
+ description: Use when preparing, troubleshooting, or automating npm package releases, especially GitHub Actions Trusted Publishing, provenance, 2FA publish errors, version tags, npm pack checks, or npx CLI packages.
4
+ ---
5
+
6
+ # Publishing npm Packages
7
+
8
+ ## Overview
9
+
10
+ Publish npm packages through a verified release path. Prefer GitHub Actions Trusted Publishing with OIDC over long-lived `NPM_TOKEN` secrets.
11
+
12
+ ## Release Decision
13
+
14
+ Use this order:
15
+
16
+ 1. Existing package with Trusted Publishing configured: release by version tag.
17
+ 2. First publish for a new package: create the package with npm 2FA or a short-lived/granular manual path, then configure Trusted Publishing.
18
+ 3. CI provider unsupported or private dependency constraints: use a granular npm token with the narrowest publish scope.
19
+
20
+ ## Preflight
21
+
22
+ Before changing release config, inspect:
23
+
24
+ - `package.json`: `name`, `version`, `bin`, `files`, `repository.url`, `publishConfig.access`
25
+ - `package-lock.json`: present when workflow uses `npm ci`
26
+ - `.github/workflows/*.yml`: CI and publish workflow
27
+ - npm package state: `npm info <package-name>` when npm is available
28
+
29
+ For GitHub Actions Trusted Publishing, require:
30
+
31
+ ```yaml
32
+ permissions:
33
+ contents: read
34
+ id-token: write
35
+ ```
36
+
37
+ Use GitHub-hosted runners, Node 22.14+ or 24, npm 11.5.1+, and `actions/setup-node` with `registry-url: "https://registry.npmjs.org"`.
38
+
39
+ ## Package Metadata
40
+
41
+ Keep npm metadata boring and exact:
42
+
43
+ ```json
44
+ {
45
+ "type": "module",
46
+ "bin": {
47
+ "package-name": "bin/cli.js"
48
+ },
49
+ "repository": {
50
+ "type": "git",
51
+ "url": "git+https://github.com/OWNER/REPO.git"
52
+ },
53
+ "publishConfig": {
54
+ "access": "public"
55
+ }
56
+ }
57
+ ```
58
+
59
+ Do not use `./` in `bin` paths if npm reports that it auto-corrected the script name or path. Run `npm pkg fix` when available, or apply the equivalent minimal metadata fix.
60
+
61
+ ## Trusted Publishing Setup
62
+
63
+ Configure on npmjs.com after the package exists:
64
+
65
+ ```text
66
+ Packages -> PACKAGE -> Settings -> Trusted publishing
67
+ Provider: GitHub Actions
68
+ Owner: GitHub owner
69
+ Repository: GitHub repository
70
+ Workflow filename: publish.yml
71
+ Environment: npm, if the workflow uses environment: npm
72
+ ```
73
+
74
+ The workflow filename is only `publish.yml`, not `.github/workflows/publish.yml`.
75
+
76
+ If the workflow uses `environment: npm`, ensure GitHub has an environment named `npm`.
77
+
78
+ ## Recommended Workflows
79
+
80
+ Use separate CI and publish workflows.
81
+
82
+ CI:
83
+
84
+ ```yaml
85
+ name: CI
86
+ on:
87
+ pull_request:
88
+ push:
89
+ branches: [main]
90
+ permissions:
91
+ contents: read
92
+ jobs:
93
+ test:
94
+ runs-on: ubuntu-latest
95
+ steps:
96
+ - uses: actions/checkout@v6
97
+ - uses: actions/setup-node@v6
98
+ with:
99
+ node-version: "24"
100
+ package-manager-cache: false
101
+ - run: npm ci
102
+ - run: npm test
103
+ - run: npm pack --dry-run
104
+ ```
105
+
106
+ Publish:
107
+
108
+ ```yaml
109
+ name: Publish to npm
110
+ on:
111
+ push:
112
+ tags: ["v*"]
113
+ permissions:
114
+ contents: read
115
+ id-token: write
116
+ jobs:
117
+ publish:
118
+ runs-on: ubuntu-latest
119
+ environment: npm
120
+ steps:
121
+ - uses: actions/checkout@v6
122
+ - uses: actions/setup-node@v6
123
+ with:
124
+ node-version: "24"
125
+ registry-url: "https://registry.npmjs.org"
126
+ package-manager-cache: false
127
+ - run: npm ci
128
+ - run: npm test
129
+ - run: npm pack --dry-run
130
+ - run: npm publish
131
+ ```
132
+
133
+ ## Release Procedure
134
+
135
+ 1. Verify clean state: `git status --short`.
136
+ 2. Run tests: `npm test`.
137
+ 3. Inspect package contents: `npm pack --dry-run`.
138
+ 4. Bump version: `npm version patch`, `minor`, or `major`.
139
+ 5. Push commit and tag: `git push --follow-tags`.
140
+ 6. Check GitHub Actions publish job.
141
+ 7. Smoke test after publish: `npx <package-name> --help` or `npx <package-name> list`.
142
+
143
+ ## Failure Handling
144
+
145
+ | Symptom | Root Cause | Response |
146
+ | --- | --- | --- |
147
+ | `E403 Two-factor authentication... required` | Manual publish without required 2FA or publish token | Enable npm 2FA and retry manual first publish, or use Trusted Publishing after package exists |
148
+ | `ENEEDAUTH` in GitHub Actions | Trusted Publisher mismatch or missing OIDC permission | Check owner, repo, workflow filename, environment name, and `id-token: write` |
149
+ | npm auto-corrects `package.json` | Metadata is publishable but not canonical | Run `npm pkg fix` or make the exact minimal metadata change |
150
+ | `npm ci` fails in CI | Missing or stale lockfile | Generate/update `package-lock.json` with the intended npm version |
151
+ | Package name unavailable | Name already exists or scope mismatch | Rename to a scoped package such as `@owner/name` and set public access |
152
+
153
+ ## Guardrails
154
+
155
+ - Never publish without reading the `npm pack --dry-run` file list.
156
+ - Never add `NPM_TOKEN` when Trusted Publishing works for the project.
157
+ - Never reuse a version after a failed or partial publish; check `npm info <name> versions`.
158
+ - Never claim a package is published until npm or `npx` confirms the released version.