@relipa/ai-flow-kit 0.1.8 → 0.1.9

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.
@@ -14,7 +14,8 @@
14
14
  | What is the Gate Workflow, how do Gates 1–5 fit together | [AIFLOW.md](./AIFLOW.md) (§ Workflow Overview) | |
15
15
  | Roles — PM / DEV / AI responsibilities | [AIFLOW.md](./AIFLOW.md) (§ Roles) | Table is intentionally brief — see "Unanswered topics" for a fuller PM-specific guide |
16
16
  | All CLI commands (`ak ...`), options, examples | [cli-reference.md](./cli-reference.md) | |
17
- | Switching between Claude Code / Cursor / Gemini CLI mid-task | [ai-integration.md](./ai-integration.md) | |
17
+ | Switching between Claude Code / Codex / Cursor / Gemini CLI mid-task | [ai-integration.md](./ai-integration.md) | |
18
+ | Using Codex — VS Code extension, ChatGPT desktop app, or CLI | [ai-integration.md](./ai-integration.md) (§ 4 Codex) | `ak init --env codex` → `AGENTS.md` + `.codex/`; no session-start hook, so start a new session after `ak use` |
18
19
  | Config levels (global / project / local state) | [configuration.md](./configuration.md) | |
19
20
  | Something isn't working (`command not found`, permission denied, etc.) | [troubleshooting.md](./troubleshooting.md) | |
20
21
  | Bug-fix / feature / refactor / investigation / impact-analysis / Figma workflows | [workflows/](./workflows/) | one file per task type |
@@ -136,6 +136,7 @@ Then open Claude and the AI will auto-detect the current gate and resume exactly
136
136
  > **Multi-Tool Support:**
137
137
  > - If using **Cursor**: Gate Workflow is enforced via `.cursorrules`.
138
138
  > - If using **Gemini CLI**: Rules are loaded from `GEMINI.md`.
139
+ > - If using **Codex** (VS Code extension, ChatGPT desktop app, or CLI): rules are loaded from `AGENTS.md`. Codex has no session-start hook — start a **new** Codex session after `ak use`, then run `/ak-coding`.
139
140
  > - The AI will automatically detect if you are mid-task by reading `.aiflow/context/current.json`.
140
141
 
141
142
  ### Step 3: GATE 1 — AI Analyzes Requirement
@@ -7,11 +7,20 @@
7
7
  | Tool | Instruction File | Support Level | Key Features |
8
8
  |------|------------------|---------------|--------------|
9
9
  | **Claude Code** | `CLAUDE.md` | Native (Best) | Auto-triggers, full MCP access, session hooks. |
10
+ | **Codex** (VS Code extension, ChatGPT desktop app, CLI) | `AGENTS.md` | High | Auto-discovered skills (`.codex/skills/`), MCP via `.codex/config.toml`. |
10
11
  | **Cursor** | `.cursorrules` | High | Project-wide rules, `@Codebase` context. |
11
12
  | **Gemini CLI** | `GEMINI.md` | Medium | System instructions support. |
12
13
  | **GitHub Copilot** | `.github/copilot-instructions.md` | Medium | Inline suggestions, custom instructions. |
13
14
  | **OpenCode / Generic** | `AI_INSTRUCTIONS.md` | General | Manual context loading. |
14
15
 
16
+ Select which tools to configure with `--env`:
17
+
18
+ ```bash
19
+ ak init --framework reactjs --env claude,codex
20
+ ```
21
+
22
+ Omitting `--env` configures every tool except `generic`.
23
+
15
24
  ---
16
25
 
17
26
  ## Tool-Specific Setup
@@ -27,10 +36,65 @@ Pass `GEMINI.md` as system instructions to your Gemini session.
27
36
  - **Tip**: Always ensure the AI reads `.aiflow/context/current.json` first to load the ticket context.
28
37
  - Gemini is excellent for large context analysis during Gate 1.
29
38
 
30
- ### 3. GitHub Copilot / Codex
39
+ ### 3. GitHub Copilot
31
40
  Copilot uses `.github/copilot-instructions.md` to guide its suggestions.
32
41
  - This ensures that Copilot's inline completions follow your project's architecture and team rules.
33
42
 
43
+ ### 4. Codex (OpenAI)
44
+
45
+ `ak init --env codex` sets up all three local Codex surfaces at once — they share the same
46
+ `CODEX_HOME` config, skills and MCP setup, so one install covers every one of them:
47
+
48
+ | Surface | How to use it |
49
+ |---------|---------------|
50
+ | **Codex IDE extension** (VS Code / Cursor / Windsurf) | Open the project folder → Codex panel → `/ak-coding` |
51
+ | **ChatGPT desktop app** (Codex mode) | Point Codex at this project folder → `/ak-coding` |
52
+ | **`codex` CLI** | `cd` into the project → `codex` → `/ak-coding` |
53
+
54
+ What gets generated:
55
+
56
+ | File | Purpose |
57
+ |------|---------|
58
+ | `AGENTS.md` | Instruction file Codex reads automatically at the repo root |
59
+ | `.codex/skills/` | All kit skills, auto-discovered and indexed by Codex |
60
+ | `.codex/config.toml` | MCP servers (mirrored from `.mcp.json`) + `project_doc_max_bytes` |
61
+ | `.aiflow/instructions/` | The full gate workflows, which `AGENTS.md` links to |
62
+
63
+ **Why `AGENTS.md` links to the workflows instead of containing them.** Codex truncates the
64
+ combined `AGENTS.md` chain at `project_doc_max_bytes` — **32 KiB by default**. The assembled
65
+ workflow set is around 115 KB, so inlining it the way `CLAUDE.md` does would silently cut the
66
+ instructions off mid-gate. `AGENTS.md` therefore stays around 20 KB and points at
67
+ `.aiflow/instructions/gate-workflow.md` (plus the BA and QA workflows), which Codex reads on
68
+ demand. `.codex/config.toml` also raises the limit to 128 KiB as a safety margin for
69
+ multi-framework projects.
70
+
71
+ **Entry-point skills.** Four skills wrap the workflows so you can start without remembering
72
+ file paths:
73
+
74
+ | Skill | Use it for |
75
+ |-------|-----------|
76
+ | `/ak-coding` | Start or resume the DEV 5-Gate coding workflow |
77
+ | `/ak-create-spec` | BA spec creation |
78
+ | `/ak-create-testcase` | QA testcase creation |
79
+ | `/ak-ask` | Questions about ai-flow-kit itself |
80
+
81
+ **Things to know:**
82
+
83
+ - **No session-start hook.** Unlike Claude Code, Codex will not auto-load a ticket. After
84
+ `ak use <TICKET>`, start a **new** Codex session so it re-reads `AGENTS.md`, then run
85
+ `/ak-coding`.
86
+ - **Restart after `ak update` / `ak sync-skills`.** Codex loads skill metadata at session
87
+ start, so new or changed skills need a fresh session.
88
+ - **Project trust.** Codex only loads `.codex/config.toml` for projects you have trusted. If
89
+ MCP servers do not appear, trust the project in Codex first.
90
+ - **Hand-edited config is never overwritten.** If `.codex/config.toml` exists without the
91
+ `# ai-flow-kit managed` header, the kit leaves it alone and writes the generated version to
92
+ `.aiflow/reference/codex-config.toml` for you to merge.
93
+
94
+ Verify the whole setup with `ak doctor`, which checks `AGENTS.md` against the active byte
95
+ budget, the skill mirror, the workflow files, and MCP drift between `.mcp.json` and
96
+ `.codex/config.toml`.
97
+
34
98
  ---
35
99
 
36
100
  ## Cross-Tool State Resumption
@@ -43,9 +107,12 @@ The "Secret Sauce" of `ai-flow-kit` is its file-based state management:
43
107
  Because these are standard files, any AI tool can read them. You can:
44
108
  1. Start **Gate 1** (Analysis) in Claude Code.
45
109
  2. Review and **Approve** the requirement doc.
46
- 3. Switch to **Cursor** for **Gate 3** (Coding) because you prefer the IDE integrations.
110
+ 3. Switch to **Cursor** or **Codex** for **Gate 3** (Coding) because you prefer the IDE integrations.
47
111
  4. Switch back to **Claude Code** for **Gate 4** (Self-Review) to use its automated testing power.
48
112
 
113
+ When resuming in Codex, run `/ak-coding`: it reads `.aiflow/tasks/[taskId]/task-state.json`
114
+ and picks up at the gate already in progress instead of restarting from Gate 1.
115
+
49
116
  ---
50
117
 
51
118
  ## Best Practices
@@ -53,7 +53,7 @@ ak init --no-rtk # skip RTK setup
53
53
  **Options:**
54
54
  - `-f, --framework <types>` (alias: `--fw`) — Framework templates, comma-separated (e.g. `spring-boot,reactjs`)
55
55
  - `-a, --adapter <types>` — MCP adapters (jira, backlog, google-sheets)
56
- - `-e, --env <types>` — AI tools to configure (cursor, gemini, copilot, generic). Default excludes `generic`.
56
+ - `-e, --env <types>` — AI tools to configure (claude, cursor, gemini, copilot, codex, generic). Default excludes `generic`. Selecting `codex` also writes `AGENTS.md`, `.codex/skills/`, `.codex/config.toml` and `.aiflow/instructions/` — see [ai-integration.md](./ai-integration.md#4-codex-openai).
57
57
  - `--with-rtk` — Force enable RTK token compression hook
58
58
  - `--no-rtk` — Skip RTK setup even if RTK is detected
59
59
 
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@relipa/ai-flow-kit",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "All-in-one AI Flow Kit for team development with Claude AI - skills, templates, and MCP adapters",
5
5
  "author": "Example Team",
6
6
  "publishConfig": {
7
7
  "access": "public",
8
- "registry": "https://registry.npmjs.com/"
8
+ "registry": "https://registry.npmjs.org/"
9
9
  },
10
10
  "license": "ISC",
11
11
  "type": "commonjs",
package/scripts/doctor.js CHANGED
@@ -45,6 +45,82 @@ async function showTokenBreakdown(ticketId) {
45
45
  console.log(` Total estimated: ~${total.toLocaleString()} tokens`);
46
46
  }
47
47
 
48
+ /**
49
+ * Verify the Codex side of the install: AGENTS.md, the skill mirror, the
50
+ * workflow files it points at, and the project config.
51
+ */
52
+ async function checkCodex(projectDir, errors, warnings) {
53
+ console.log('');
54
+ console.log(chalk.bold('Codex (AGENTS.md — VS Code extension / ChatGPT desktop app / CLI):'));
55
+
56
+ const agentsPath = path.join(projectDir, 'AGENTS.md');
57
+ if (!(await fs.pathExists(agentsPath))) {
58
+ errors.push('Missing AGENTS.md — Codex has no instructions. Run `ak sync-skills`.');
59
+ } else {
60
+ const size = (await fs.stat(agentsPath)).size;
61
+ const kib = (size / 1024).toFixed(1);
62
+ // Codex reads config from .codex/config.toml; without a raised limit it
63
+ // truncates the AGENTS.md chain at 32 KiB.
64
+ const configPath = path.join(projectDir, '.codex', 'config.toml');
65
+ let limit = 32 * 1024;
66
+ if (await fs.pathExists(configPath)) {
67
+ const cfg = await fs.readFile(configPath, 'utf-8').catch(() => '');
68
+ const m = cfg.match(/^\s*project_doc_max_bytes\s*=\s*(\d+)/m);
69
+ if (m) limit = parseInt(m[1], 10);
70
+ }
71
+ if (size > limit) {
72
+ errors.push(`AGENTS.md is ${kib} KiB but Codex truncates at ${(limit / 1024).toFixed(0)} KiB — instructions are being cut off. Run \`ak sync-skills\`.`);
73
+ } else {
74
+ console.log(chalk.green(` ✓ AGENTS.md exists (${kib} KiB / ${(limit / 1024).toFixed(0)} KiB budget)`));
75
+ }
76
+ }
77
+
78
+ const codexSkills = path.join(projectDir, '.codex', 'skills');
79
+ if (!(await fs.pathExists(codexSkills))) {
80
+ warnings.push('Missing .codex/skills/ — Codex cannot load kit skills. Run `ak sync-skills`.');
81
+ } else {
82
+ const entries = await fs.readdir(codexSkills);
83
+ const entryPoints = ['ak-coding', 'ak-create-spec', 'ak-create-testcase', 'ak-ask'];
84
+ const missing = entryPoints.filter(e => !entries.includes(e));
85
+ if (missing.length) {
86
+ warnings.push(`.codex/skills/ is missing entry-point skill(s): ${missing.join(', ')}. Run \`ak sync-skills\`.`);
87
+ } else {
88
+ console.log(chalk.green(` ✓ .codex/skills/ — ${entries.length} skills incl. all 4 entry points`));
89
+ }
90
+ }
91
+
92
+ const instructionsDir = path.join(projectDir, '.aiflow', 'instructions');
93
+ const required = ['gate-workflow.md', 'create-spec-workflow.md', 'create-testcase-workflow.md'];
94
+ const missingWorkflows = [];
95
+ for (const f of required) {
96
+ if (!(await fs.pathExists(path.join(instructionsDir, f)))) missingWorkflows.push(f);
97
+ }
98
+ if (missingWorkflows.length) {
99
+ errors.push(`AGENTS.md points at .aiflow/instructions/ but these are missing: ${missingWorkflows.join(', ')}. Run \`ak sync-skills\`.`);
100
+ } else {
101
+ console.log(chalk.green(' ✓ .aiflow/instructions/ — all 3 workflow files present'));
102
+ }
103
+
104
+ const configPath = path.join(projectDir, '.codex', 'config.toml');
105
+ if (!(await fs.pathExists(configPath))) {
106
+ warnings.push('Missing .codex/config.toml — Codex has no MCP servers and keeps the 32 KiB doc limit. Run `ak sync-skills`.');
107
+ } else {
108
+ const cfg = await fs.readFile(configPath, 'utf-8').catch(() => '');
109
+ const servers = [...cfg.matchAll(/^\[mcp_servers\.([^\]]+)\]/gm)].map(m => m[1]);
110
+ const mcpPath = path.join(projectDir, '.mcp.json');
111
+ let claudeServers = [];
112
+ if (await fs.pathExists(mcpPath)) {
113
+ const mcp = await fs.readJson(mcpPath).catch(() => ({}));
114
+ claudeServers = Object.keys(mcp.mcpServers || {});
115
+ }
116
+ const drift = claudeServers.filter(s => !servers.includes(s));
117
+ console.log(chalk.green(` ✓ .codex/config.toml — ${servers.length} MCP server(s)${servers.length ? `: ${servers.join(', ')}` : ''}`));
118
+ if (drift.length) {
119
+ warnings.push(`.codex/config.toml is out of sync with .mcp.json — missing: ${drift.join(', ')}. Run \`ak sync-skills\`.`);
120
+ }
121
+ }
122
+ }
123
+
48
124
  module.exports = async function doctor(options = {}) {
49
125
  const projectDir = process.cwd();
50
126
  const errors = [];
@@ -87,13 +163,20 @@ module.exports = async function doctor(options = {}) {
87
163
 
88
164
  // ── Version tracking ───────────────────────────────────────
89
165
  const stateFile = path.join(projectDir, '.aiflow', 'state.json');
166
+ let selectedTools = [];
90
167
  if (!(await fs.pathExists(stateFile))) {
91
168
  errors.push('Missing `.aiflow/state.json`. Version tracking is broken.');
92
169
  } else {
93
170
  const state = await fs.readJson(stateFile);
171
+ selectedTools = state.aiTools || [];
94
172
  console.log(chalk.green(`✓ Version tracking active (v${state.current_version})`));
95
173
  }
96
174
 
175
+ // ── Codex (OpenAI) ─────────────────────────────────────────
176
+ if (selectedTools.includes('codex')) {
177
+ await checkCodex(projectDir, errors, warnings);
178
+ }
179
+
97
180
  // ── SessionStart hook ──────────────────────────────────────
98
181
  const settingsPath = path.join(projectDir, '.claude', 'settings.json');
99
182
  if (await fs.pathExists(settingsPath)) {
package/scripts/guide.js CHANGED
@@ -146,7 +146,7 @@ function showCommands() {
146
146
  group: 'Setup',
147
147
  items: [
148
148
  ['aiflow init', '--framework <fw> --adapter <ad>', 'Initialize project'],
149
- ['aiflow init', '--env <tools>', 'AI tools: cursor,gemini,copilot'],
149
+ ['aiflow init', '--env <tools>', 'AI tools: claude,cursor,gemini,copilot,codex'],
150
150
  ['aiflow init', '--with-rtk | --no-rtk', 'RTK bash compression (60–90% saving)'],
151
151
  // ['aiflow init', '--with-gitnexus', 'GitNexus code intelligence (waits for index)'],
152
152
  // ['aiflow init', '--with-gitnexus --no-wait', 'GitNexus: index in background'],