Skip to content

Commit 78eefa1

Browse files
Merge pull request #2 from BlocksOrg/feat/nightly
Feat/nightly
2 parents c7f2a77 + 0af22ea commit 78eefa1

File tree

298 files changed

+18465
-5314
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

298 files changed

+18465
-5314
lines changed

.gemini/commands/find-docs.toml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
description = "Find relevant documentation and output GitHub URLs."
2+
3+
prompt = """
4+
## Mission: Find Relevant Documentation
5+
6+
Your task is to find documentation files relevant to the user's question within the current git repository and provide a list of GitHub URLs to view them.
7+
8+
### Workflow:
9+
10+
1. **Identify Repository Details**:
11+
* You may use shell commands like `git` or `gh` to get the remote URL of the repository.
12+
* From the remote URL, parse and construct the base GitHub URL (e.g., `https://github.com/user/repo`). You must handle both HTTPS (`https://github.com/user/repo.git`) and SSH (`[email protected]:user/repo.git`) formats.
13+
* Determine the default branch name. You can assume `main` for this purpose, as it is the most common.
14+
15+
2. **Search for Documentation**:
16+
* First, perform a targeted search across the repository for documentation files (e.g., `.md`, `.mdx`) that seem directly related to the user's question.
17+
* If this initial search yields no relevant results, and a `docs/` directory exists, read the content of all files within the `docs/` directory to find relevant information.
18+
* If you still can't find a direct match, broaden your search to include related concepts and synonyms of the keywords in the user's question.
19+
* For each file you identify as potentially relevant, read its content to confirm it addresses the user's query.
20+
21+
3. **Construct and Output URLs**:
22+
* For each file you identify as relevant, construct the full GitHub URL by combining the base URL, branch, and file path. **Do not use shell commands for this step.**
23+
* The URL format should be: `{BASE_GITHUB_URL}/blob/{BRANCH_NAME}/{PATH_TO_FILE_FROM_REPO_ROOT}`.
24+
* Present the final list to the user as a markdown list. Each item in the list should be the URL to the document, followed by a short summary of its content.
25+
* If, after all search attempts, you cannot find any relevant documentation, ask the user clarifying questions to better understand their needs. Do not return any URLs in this case.
26+
27+
### QUESTION:
28+
29+
{{args}}
30+
"""
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
description = "Go back to main and clean up the branch."
2+
3+
prompt = """
4+
I'm done with the work on this branch, and I'm ready to go back to main and clean up.
5+
6+
Here is the workflow I'd like you to follow:
7+
8+
1. **Get Current Branch:** First, I need you to get the name of the current branch and save it.
9+
2. **Branch Check:** Check if the current branch is `main`. If it is, I need you to stop and let me know.
10+
3. **Go to Main:** Next, I need you to checkout the main branch.
11+
4. **Pull Latest:** Once you are on the main branch, I need you to pull down the latest changes to make sure I'm up to date.
12+
5. **Branch Cleanup:** Finally, I need you to delete the branch that you noted in the first step.
13+
"""
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
description = "Review a specific pull request"
2+
3+
prompt = """
4+
## Mission: Comprehensive Pull Request Review
5+
6+
Today, our mission is to meticulously review community pull requests (PRs) for this project. We will proceed systematically, evaluating each candidate PR for its quality, adherence to standards, and readiness for merging.
7+
8+
### Workflow:
9+
10+
1. **PR Preparation & Initial Assessment**:
11+
* **You will check out the designated PR {{args}}** into a temporary branch.
12+
* **Execute the preflight checks (`npm run preflight`)**. This includes building, linting, and running all unit tests.
13+
* Analyze the output of these preflight checks, noting any failures, warnings, or linting issues.
14+
15+
2. **In-Depth Code Review**:
16+
* **Your primary role is to conduct a thorough and in-depth code review** of the changes introduced in the PR. Focus your analysis on the following criteria:
17+
* **Correctness**: Does the code achieve its stated purpose without bugs or logical errors?
18+
* **Maintainability**: Is the code clean, well-structured, and easy to understand and modify in the future? Consider factors like code clarity, modularity, and adherence to established design patterns.
19+
* **Readability**: Is the code well-commented (where necessary) and consistently formatted according to our project's coding style guidelines?
20+
* **Efficiency**: Are there any obvious performance bottlenecks or resource inefficiencies introduced by the changes?
21+
* **Security**: Are there any potential security vulnerabilities or insecure coding practices?
22+
* **Edge Cases and Error Handling**: Does the code appropriately handle edge cases and potential errors?
23+
* **Testability**: Is the new or modified code adequately covered by tests (even if preflight checks pass)? Suggest additional test cases that would improve coverage or robustness.
24+
* Based on your analysis, you will determine if the PR is **safe to merge**.
25+
26+
3. **Reviewing Previous Feedback**:
27+
* **Access and examine the PR's history** to identify any **outstanding requests or unresolved comments from previous reviews**. Incorporate these into your current review and explicitly highlight if they have been adequately addressed in the current state of the PR.
28+
29+
4. **Decision and Output Generation**:
30+
* **If the PR is deemed safe to merge** (after your comprehensive review and considering previous feedback):
31+
* Draft a **friendly, concise, and professional approval message**.
32+
* **The approval message should:**
33+
* Clearly state that the PR is approved.
34+
* Briefly acknowledge the quality or value of the contribution (e.g., "Great work on X feature!" or "Appreciate the fix for Y issue!").
35+
* **Do NOT mention the preflight checks or unit testing**, as these are internal processes.
36+
* Be suitable for public display on GitHub.
37+
* **If the PR is NOT safe to merge**:
38+
* Provide a **clear, constructive, and detailed summary of the issues found**.
39+
* Suggest **specific actionable changes** required for the PR to become merge-ready.
40+
* Ensure the feedback is professional and encourages the contributor.
41+
42+
### Post-PR Action:
43+
44+
* After providing your review and decision for the current PR, I will wait for you to perform any manual testing you wish to do. Please let me know when you are finished.
45+
* Once you have confirmed that you are done, I will switch to the `main` branch, clean up the local branch, and perform a pull to ensure we are synchronized with the latest upstream changes for the next review.
46+
47+
"""

.github/CODEOWNERS

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1-
# By default, require reviews from the release approvers for all files.
2-
* @google-gemini/gemini-cli-askmode-approvers
1+
# By default, require reviews from the maintainers for all files.
2+
* @google-gemini/gemini-cli-maintainers
33

4-
# The following files don't need reviews from the release approvers.
4+
# Require reviews from the release approvers for critical files.
55
# These patterns override the rule above.
6-
**/*.md
7-
/docs/
6+
/package.json @google-gemini/gemini-cli-askmode-approvers
7+
/package-lock.json @google-gemini/gemini-cli-askmode-approvers
8+
/GEMINI.md @google-gemini/gemini-cli-askmode-approvers
9+
/SECURITY.md @google-gemini/gemini-cli-askmode-approvers
10+
/LICENSE @google-gemini/gemini-cli-askmode-approvers
11+
/.github/workflows/ @google-gemini/gemini-cli-askmode-approvers
12+
/packages/cli/package.json @google-gemini/gemini-cli-askmode-approvers
13+
/packages/cli/package-lock.json @google-gemini/gemini-cli-askmode-approvers
14+
/packages/core/package.json @google-gemini/gemini-cli-askmode-approvers
15+
/packages/core/package-lock.json @google-gemini/gemini-cli-askmode-approvers
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: 'Publish Release'
2+
description: 'Builds, prepares, and publishes the gemini-cli packages to npm and creates a GitHub release.'
3+
4+
inputs:
5+
release-version:
6+
description: 'The version to release (e.g., 0.1.11).'
7+
required: true
8+
npm-tag:
9+
description: 'The npm tag to publish with (e.g., latest, preview, nightly).'
10+
required: true
11+
wombat-token-core:
12+
description: 'The npm token for the @blocksuser/gemini-cli-core package.'
13+
required: true
14+
wombat-token-cli:
15+
description: 'The npm token for the @blocksuser/gemini-cli package.'
16+
required: true
17+
github-token:
18+
description: 'The GitHub token for creating the release.'
19+
required: true
20+
dry-run:
21+
description: 'Whether to run in dry-run mode.'
22+
required: true
23+
release-branch:
24+
description: 'The branch to target for the release.'
25+
required: true
26+
previous-tag:
27+
description: 'The previous tag to use for generating release notes.'
28+
required: true
29+
working-directory:
30+
description: 'The working directory to run the steps in.'
31+
required: false
32+
default: '.'
33+
34+
runs:
35+
using: 'composite'
36+
steps:
37+
- name: 'Build and Prepare Packages'
38+
working-directory: '${{ inputs.working-directory }}'
39+
run: |-
40+
npm run build:packages
41+
npm run prepare:package
42+
shell: 'bash'
43+
44+
- name: 'Configure npm for publishing'
45+
uses: 'actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020'
46+
with:
47+
node-version-file: '${{ inputs.working-directory }}/.nvmrc'
48+
registry-url: 'https://wombat-dressing-room.appspot.com'
49+
scope: '@google'
50+
51+
- name: 'Publish @blocksuser/gemini-cli-core'
52+
working-directory: '${{ inputs.working-directory }}'
53+
env:
54+
NODE_AUTH_TOKEN: '${{ inputs.wombat-token-core }}'
55+
run: |-
56+
npm publish \
57+
--dry-run="${{ inputs.dry-run }}" \
58+
--workspace="@blocksuser/gemini-cli-core" \
59+
--tag="${{ inputs.npm-tag }}"
60+
shell: 'bash'
61+
62+
- name: 'Install latest core package'
63+
working-directory: '${{ inputs.working-directory }}'
64+
if: '${{ inputs.dry-run == "false" }}'
65+
run: |-
66+
npm install "@blocksuser/gemini-cli-core@${{ inputs.release-version }}" \
67+
--workspace="@blocksuser/gemini-cli" \
68+
--save-exact
69+
shell: 'bash'
70+
71+
- name: 'Publish @blocksuser/gemini-cli'
72+
working-directory: '${{ inputs.working-directory }}'
73+
env:
74+
NODE_AUTH_TOKEN: '${{ inputs.wombat-token-cli }}'
75+
run: |-
76+
npm publish \
77+
--dry-run="${{ inputs.dry-run }}" \
78+
--workspace="@blocksuser/gemini-cli" \
79+
--tag="${{ inputs.npm-tag }}"
80+
shell: 'bash'
81+
82+
- name: 'Bundle'
83+
working-directory: '${{ inputs.working-directory }}'
84+
run: 'npm run bundle'
85+
shell: 'bash'
86+
87+
- name: 'Create GitHub Release'
88+
working-directory: '${{ inputs.working-directory }}'
89+
if: '${{ inputs.dry-run == "false" }}'
90+
env:
91+
GITHUB_TOKEN: '${{ inputs.github-token }}'
92+
run: |-
93+
gh release create "v${{ inputs.release-version }}" \
94+
bundle/gemini.js \
95+
--target "${{ inputs.release-branch }}" \
96+
--title "Release v${{ inputs.release-version }}" \
97+
--notes-start-tag "${{ inputs.previous-tag }}" \
98+
--generate-notes
99+
shell: 'bash'

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,8 @@ jobs:
375375
# Check for changes in bundle size.
376376
bundle_size:
377377
name: 'Check Bundle Size'
378+
if: |-
379+
${{ github.event_name != 'merge_group' }}
378380
runs-on: 'ubuntu-latest'
379381
permissions:
380382
contents: 'read' # For checkout
@@ -392,3 +394,4 @@ jobs:
392394
pattern: './bundle/**/*.{js,sb}'
393395
minimum-change-threshold: '1000'
394396
compression: 'none'
397+
clean-script: 'clean'
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: 'Create Patch PR'
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
commit:
7+
description: 'The commit SHA to cherry-pick for the patch.'
8+
required: true
9+
type: 'string'
10+
channel:
11+
description: 'The release channel to patch.'
12+
required: true
13+
type: 'choice'
14+
options:
15+
- 'stable'
16+
- 'preview'
17+
dry_run:
18+
description: 'Whether to run in dry-run mode.'
19+
required: false
20+
type: 'boolean'
21+
default: false
22+
23+
jobs:
24+
create-patch:
25+
runs-on: 'ubuntu-latest'
26+
permissions:
27+
contents: 'write'
28+
pull-requests: 'write'
29+
steps:
30+
- name: 'Checkout'
31+
uses: 'actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8' # ratchet:actions/checkout@v5
32+
with:
33+
fetch-depth: 0
34+
35+
- name: 'Setup Node.js'
36+
uses: 'actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020' # ratchet:actions/setup-node@v4
37+
with:
38+
node-version-file: '.nvmrc'
39+
cache: 'npm'
40+
41+
- name: 'Install Dependencies'
42+
run: 'npm ci'
43+
44+
- name: 'Configure Git User'
45+
run: |-
46+
git config user.name "gemini-cli-robot"
47+
git config user.email "[email protected]"
48+
49+
- name: 'Create Patch for Stable'
50+
if: "github.event.inputs.channel == 'stable'"
51+
env:
52+
GH_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
53+
run: 'node scripts/create-patch-pr.js --commit=${{ github.event.inputs.commit }} --channel=stable --dry-run=${{ github.event.inputs.dry_run }}'
54+
55+
- name: 'Create Patch for Preview'
56+
env:
57+
GH_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
58+
run: 'node scripts/create-patch-pr.js --commit=${{ github.event.inputs.commit }} --channel=${{ github.event.inputs.channel }} --dry-run=${{ github.event.inputs.dry_run }}'
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: 'Nightly Release'
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * *'
6+
workflow_dispatch:
7+
inputs:
8+
dry_run:
9+
description: 'Run a dry-run of the release process; no branches, npm packages or GitHub releases will be created.'
10+
required: true
11+
type: 'boolean'
12+
default: true
13+
14+
jobs:
15+
release:
16+
runs-on: 'ubuntu-latest'
17+
steps:
18+
- name: 'Checkout'
19+
uses: 'actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8'
20+
with:
21+
fetch-depth: 0
22+
23+
- name: 'Setup Node.js'
24+
uses: 'actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020' # ratchet:actions/setup-node@v4
25+
with:
26+
node-version-file: '.nvmrc'
27+
cache: 'npm'
28+
29+
- name: 'Install Dependencies'
30+
run: 'npm ci'
31+
32+
- name: 'Get Nightly Version'
33+
id: 'nightly_version'
34+
env:
35+
GH_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
36+
run: |
37+
VERSION_JSON=$(node scripts/get-release-version.js --type=nightly)
38+
echo "RELEASE_TAG=$(echo "${VERSION_JSON}" | jq -r .releaseTag)" >> "${GITHUB_OUTPUT}"
39+
echo "RELEASE_VERSION=$(echo "${VERSION_JSON}" | jq -r .releaseVersion)" >> "${GITHUB_OUTPUT}"
40+
echo "NPM_TAG=$(echo "${VERSION_JSON}" | jq -r .npmTag)" >> "${GITHUB_OUTPUT}"
41+
echo "PREVIOUS_TAG=$(echo "${VERSION_JSON}" | jq -r .previousReleaseTag)" >> "${GITHUB_OUTPUT}"
42+
43+
- name: 'Publish Release'
44+
uses: './.github/actions/publish-release'
45+
with:
46+
release-version: '${{ steps.nightly_version.outputs.RELEASE_VERSION }}'
47+
npm-tag: '${{ steps.nightly_version.outputs.NPM_TAG }}'
48+
wombat-token-core: '${{ secrets.WOMBAT_TOKEN_CORE }}'
49+
wombat-token-cli: '${{ secrets.WOMBAT_TOKEN_CLI }}'
50+
github-token: '${{ secrets.GITHUB_TOKEN }}'
51+
dry-run: '${{ github.event.inputs.dry_run }}'
52+
release-branch: 'main'
53+
previous-tag: '${{ steps.nightly_version.outputs.PREVIOUS_TAG }}'
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: 'Patch from Comment'
2+
3+
on:
4+
issue_comment:
5+
types: ['created']
6+
7+
jobs:
8+
slash-command:
9+
runs-on: 'ubuntu-latest'
10+
steps:
11+
- name: 'Slash Command Dispatch'
12+
id: 'slash_command'
13+
uses: 'peter-evans/slash-command-dispatch@40877f718dce0101edfc7aea2b3800cc192f9ed5'
14+
with:
15+
token: '${{ secrets.GITHUB_TOKEN }}'
16+
commands: 'patch'
17+
permission: 'write'
18+
issue-type: 'pull-request'
19+
static-args: |
20+
dry_run=false
21+
22+
- name: 'Get PR Status'
23+
id: 'pr_status'
24+
if: "steps.slash_command.outputs.dispatched == 'true'"
25+
env:
26+
GH_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
27+
run: |
28+
gh pr view "${{ github.event.issue.number }}" --json mergeCommit,state > pr_status.json
29+
echo "MERGE_COMMIT_SHA=$(jq -r .mergeCommit.oid pr_status.json)" >> "$GITHUB_OUTPUT"
30+
echo "STATE=$(jq -r .state pr_status.json)" >> "$GITHUB_OUTPUT"
31+
32+
- name: 'Dispatch if Merged'
33+
if: "steps.pr_status.outputs.STATE == 'MERGED'"
34+
uses: 'actions/github-script@00f12e3e20659f42342b1c0226afda7f7c042325'
35+
with:
36+
script: |
37+
const args = JSON.parse('${{ steps.slash_command.outputs.command-arguments }}');
38+
github.rest.actions.createWorkflowDispatch({
39+
owner: context.repo.owner,
40+
repo: context.repo.repo,
41+
workflow_id: 'create-patch-pr.yml',
42+
ref: 'main',
43+
inputs: {
44+
commit: '${{ steps.pr_status.outputs.MERGE_COMMIT_SHA }}',
45+
channel: args.channel,
46+
dry_run: args.dry_run
47+
}
48+
})
49+
50+
- name: 'Comment on Failure'
51+
if: "steps.pr_status.outputs.STATE != 'MERGED'"
52+
uses: 'peter-evans/create-or-update-comment@67dcc547d311b736a8e6c5c236542148a47adc3d'
53+
with:
54+
issue-number: '${{ github.event.issue.number }}'
55+
body: |
56+
:x: The `/patch` command failed. This pull request must be merged before a patch can be created.

0 commit comments

Comments
 (0)