ai-cli-mcp 2.10.0 → 2.12.0

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 (51) hide show
  1. package/.github/workflows/watch-session-prs.yml +276 -0
  2. package/CHANGELOG.md +17 -0
  3. package/README.ja.md +104 -5
  4. package/README.md +104 -5
  5. package/dist/__tests__/app-cli.test.js +285 -0
  6. package/dist/__tests__/cli-bin-smoke.test.js +54 -0
  7. package/dist/__tests__/cli-builder.test.js +49 -2
  8. package/dist/__tests__/cli-process-service.test.js +233 -0
  9. package/dist/__tests__/cli-utils.test.js +109 -0
  10. package/dist/__tests__/error-cases.test.js +2 -1
  11. package/dist/__tests__/mcp-contract.test.js +195 -0
  12. package/dist/__tests__/process-management.test.js +15 -8
  13. package/dist/__tests__/server.test.js +29 -3
  14. package/dist/__tests__/validation.test.js +2 -2
  15. package/dist/__tests__/wait.test.js +31 -0
  16. package/dist/app/cli.js +304 -0
  17. package/dist/app/mcp.js +362 -0
  18. package/dist/bin/ai-cli-mcp.js +6 -0
  19. package/dist/bin/ai-cli.js +10 -0
  20. package/dist/cli-builder.js +29 -22
  21. package/dist/cli-process-service.js +328 -0
  22. package/dist/cli-utils.js +142 -88
  23. package/dist/cli.js +1 -1
  24. package/dist/model-catalog.js +50 -0
  25. package/dist/process-service.js +198 -0
  26. package/dist/server.js +3 -577
  27. package/docs/cli-architecture.md +275 -0
  28. package/package.json +3 -2
  29. package/src/__tests__/app-cli.test.ts +362 -0
  30. package/src/__tests__/cli-bin-smoke.test.ts +71 -0
  31. package/src/__tests__/cli-builder.test.ts +62 -3
  32. package/src/__tests__/cli-process-service.test.ts +278 -0
  33. package/src/__tests__/cli-utils.test.ts +132 -0
  34. package/src/__tests__/error-cases.test.ts +3 -4
  35. package/src/__tests__/mcp-contract.test.ts +250 -0
  36. package/src/__tests__/process-management.test.ts +15 -9
  37. package/src/__tests__/server.test.ts +27 -6
  38. package/src/__tests__/validation.test.ts +2 -2
  39. package/src/__tests__/wait.test.ts +38 -0
  40. package/src/app/cli.ts +373 -0
  41. package/src/app/mcp.ts +398 -0
  42. package/src/bin/ai-cli-mcp.ts +7 -0
  43. package/src/bin/ai-cli.ts +11 -0
  44. package/src/cli-builder.ts +32 -22
  45. package/src/cli-process-service.ts +415 -0
  46. package/src/cli-utils.ts +185 -99
  47. package/src/cli.ts +1 -1
  48. package/src/model-catalog.ts +60 -0
  49. package/src/process-service.ts +261 -0
  50. package/src/server.ts +3 -667
  51. package/.github/workflows/watch-codex-fork-pr.yml +0 -98
@@ -1,98 +0,0 @@
1
- name: Watch Codex Fork PR
2
-
3
- on:
4
- schedule:
5
- - cron: '17 0 * * *'
6
- workflow_dispatch:
7
-
8
- permissions:
9
- contents: read
10
- issues: write
11
-
12
- jobs:
13
- watch-pr:
14
- runs-on: ubuntu-latest
15
- steps:
16
- - name: Check upstream PR and notify issue
17
- uses: actions/github-script@v7
18
- env:
19
- UPSTREAM_OWNER: openai
20
- UPSTREAM_REPO: codex
21
- UPSTREAM_PR_NUMBER: '13537'
22
- TARGET_ISSUE_NUMBER: '7'
23
- COMMENT_MARKER: '<!-- codex-fork-pr-13537-merged -->'
24
- with:
25
- github-token: ${{ secrets.GITHUB_TOKEN }}
26
- script: |
27
- const upstreamOwner = process.env.UPSTREAM_OWNER;
28
- const upstreamRepo = process.env.UPSTREAM_REPO;
29
- const pull_number = Number(process.env.UPSTREAM_PR_NUMBER);
30
- const issue_number = Number(process.env.TARGET_ISSUE_NUMBER);
31
- const marker = process.env.COMMENT_MARKER;
32
-
33
- const { data: pr } = await github.rest.pulls.get({
34
- owner: upstreamOwner,
35
- repo: upstreamRepo,
36
- pull_number,
37
- });
38
-
39
- core.summary
40
- .addHeading('Upstream PR status')
41
- .addTable([
42
- [
43
- { data: 'Field', header: true },
44
- { data: 'Value', header: true },
45
- ],
46
- ['PR', `${upstreamOwner}/${upstreamRepo}#${pr.number}`],
47
- ['Title', pr.title],
48
- ['State', pr.state],
49
- ['Merged', String(Boolean(pr.merged_at))],
50
- ['Merged at', pr.merged_at ?? 'not merged'],
51
- ['Updated at', pr.updated_at],
52
- ['URL', pr.html_url],
53
- ]);
54
-
55
- if (!pr.merged_at) {
56
- core.info(`PR #${pr.number} is not merged yet. No issue comment posted.`);
57
- await core.summary.write();
58
- return;
59
- }
60
-
61
- const comments = await github.paginate(github.rest.issues.listComments, {
62
- owner: context.repo.owner,
63
- repo: context.repo.repo,
64
- issue_number,
65
- per_page: 100,
66
- });
67
-
68
- const existingComment = comments.find((comment) => comment.body?.includes(marker));
69
- if (existingComment) {
70
- core.info(`Issue #${issue_number} already has a merged notification comment.`);
71
- await core.summary.addRaw(`Merged notification already exists: ${existingComment.html_url}\n`).write();
72
- return;
73
- }
74
-
75
- const body = [
76
- marker,
77
- 'upstream PR `openai/codex#13537` has been merged.',
78
- '',
79
- `- PR: ${pr.html_url}`,
80
- `- Merged at: ${pr.merged_at}`,
81
- '',
82
- 'This is the PR that adds non-interactive forking via `codex exec --fork <SESSION_ID> [PROMPT]`.',
83
- 'That means a new session ID can be issued when forking an existing session headlessly.',
84
- '`resume` itself still continues the same session and does not issue a new session ID.',
85
- ].join('\n');
86
-
87
- const { data: comment } = await github.rest.issues.createComment({
88
- owner: context.repo.owner,
89
- repo: context.repo.repo,
90
- issue_number,
91
- body,
92
- });
93
-
94
- core.info(`Posted merged notification to issue #${issue_number}: ${comment.html_url}`);
95
- await core.summary
96
- .addHeading('Issue notification')
97
- .addRaw(`Posted merged notification: ${comment.html_url}\n`)
98
- .write();