feat: New from plan script task (#28)

* feat: New from plan script task

* cr
This commit is contained in:
Brace Sproul 2025-05-26 17:50:33 -07:00 • committed by GitHub
parent afac1eab8b
commit f9debc144e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 32 additions and 55 deletions

View file

@ -19,49 +19,14 @@ async function runFromPlan() {
messages: [
{
role: "user",
content: `The project is structured as a monorepo, with some apps located inside the /apps directory. In this directory, there is an /auth directory. This directory only contains the scaffolding for a new app in the monorepo, but is not yet implemented. Please take the following plan/task description and implement it in the /auth directory:
This monorepo is for an AI coding agent. The app runs and edits the code in the cloud in a sandboxed environment. Right now, we require users to generate a GitHub PAT, which we store in a .env file and can use to authenticate with GitHub. This is not idea, and instead we want to have a github oauth app which users can authenticate with.
Please implement a new auth server inside the /auth directory which can do this.
You will not have any access to secrets, so you will not be able to run the server to test it.
I want the server to be able to authenticate users with GitHub, such that we will be able to take the following actions:
1. clone repositories they give us access to
2. checkout existing and create new branches on the repositories they give us access to
3. make pull requests and push changes to the repositories they give us access to
Once you're done, ensure you've documented the development process in the readme of this new app.`,
content:
"This repo contains the react/next.js code for my persona/portfolio site. It currently has static values set for the number of stars on the repositories I highlight. I want this to be accurate, but I do NOT want it to make requests to GitHub every time a user visits. Instead, please implement a solution which will run once a day, fetch the number of stars from a list of repos, then write them to vercel's KV store. Finally, update the UI to make a request to the KV store when the user visits my page and render the accurate star counts.",
},
{
id: "toolu_01RNEjViZFBXgCSNMwqKvkVL",
id: "msg_01UM7mQS4P37haW1LrABGZez",
role: "assistant",
content: [
{
index: 0,
type: "tool_use",
id: "toolu_01RNEjViZFBXgCSNMwqKvkVL",
name: "condense_planning_context",
input:
'{"context": "The user has a React/Next.js portfolio site with static star counts for GitHub repositories. The project structure is:\\n\\n- Located in ./personal-site/ directory\\n- Uses Next.js 15.2.3 with TypeScript\\n- Already has @vercel/kv dependency installed\\n- Main page at src/app/page.tsx contains hardcoded star values for 6 repositories:\\n - langchain-ai/langchainjs (14.3k stars)\\n - langchain-ai/langgraphjs (1.3k stars) \\n - langchain-ai/open-canvas (4.4k stars)\\n - langchain-ai/agent-inbox (496 stars)\\n - langchain-ai/agent-chat-ui (583 stars)\\n - langchain-ai/social-media-agent (1.2k stars)\\n\\n- Stars are displayed in ProjectCard components with a stars prop\\n- Existing API routes in src/app/api/ (gh-viewer and gh-viewer-v2)\\n- The gh-viewer route already uses Vercel KV for storing view counts\\n\\nThe user wants to:\\n1. Create a daily cron job to fetch real GitHub star counts\\n2. Store the data in Vercel KV\\n3. Update the UI to fetch from KV instead of using static values\\n4. Avoid making GitHub API calls on every page visit\\n\\nThe project already has the necessary infrastructure (Vercel KV, API routes) and just needs the GitHub star fetching logic and UI updates."}',
},
],
tool_calls: [
{
name: "condense_planning_context",
args: {
context:
"The user has a React/Next.js portfolio site with static star counts for GitHub repositories. The project structure is:\n\n- Located in ./personal-site/ directory\n- Uses Next.js 15.2.3 with TypeScript\n- Already has @vercel/kv dependency installed\n- Main page at src/app/page.tsx contains hardcoded star values for 6 repositories:\n - langchain-ai/langchainjs (14.3k stars)\n - langchain-ai/langgraphjs (1.3k stars) \n - langchain-ai/open-canvas (4.4k stars)\n - langchain-ai/agent-inbox (496 stars)\n - langchain-ai/agent-chat-ui (583 stars)\n - langchain-ai/social-media-agent (1.2k stars)\n\n- Stars are displayed in ProjectCard components with a stars prop\n- Existing API routes in src/app/api/ (gh-viewer and gh-viewer-v2)\n- The gh-viewer route already uses Vercel KV for storing view counts\n\nThe user wants to:\n1. Create a daily cron job to fetch real GitHub star counts\n2. Store the data in Vercel KV\n3. Update the UI to fetch from KV instead of using static values\n4. Avoid making GitHub API calls on every page visit\n\nThe project already has the necessary infrastructure (Vercel KV, API routes) and just needs the GitHub star fetching logic and UI updates.",
},
id: "toolu_01RNEjViZFBXgCSNMwqKvkVL",
type: "tool_call",
},
],
additional_kwargs: {
summary_message: true,
},
},
{
role: "tool",
tool_call_id: "toolu_01RNEjViZFBXgCSNMwqKvkVL",
name: "condense_planning_context",
content: "Successfully summarized planning context.",
content:
"The project is structured as a monorepo, with some apps located inside the /apps directory. In this directory, there is an /auth directory. This directory only contains the scaffolding for a new app in the monorepo, but is not yet implemented. Please take the following plan/task description and implement it in the /auth directory:\nThis monorepo is for an AI coding agent. The app runs and edits the code in the cloud in a sandboxed environment. Right now, we require users to generate a GitHub PAT, which we store in a .env file and can use to authenticate with GitHub. This is not idea, and instead we want to have a github oauth app which users can authenticate with.\nPlease implement a new auth server inside the /auth directory which can do this.\nYou will not have any access to secrets, so you will not be able to run the server to test it.\nI want the server to be able to authenticate users with GitHub, such that we will be able to take the following actions:\n1. clone repositories they give us access to\n2. checkout existing and create new branches on the repositories they give us access to\n3. make pull requests and push changes to the repositories they give us access to\nOnce you're done, ensure you've documented the development process in the readme of this new app.",
additional_kwargs: {
summary_message: true,
},
@ -70,48 +35,60 @@ Once you're done, ensure you've documented the development process in the readme
plan: [
{
index: 0,
plan: "Create a list of GitHub repositories with their URLs extracted from the current static star values in page.tsx",
plan: "Set up the Express.js server with TypeScript configuration and necessary dependencies for GitHub OAuth authentication",
completed: false,
},
{
index: 1,
plan: "Create a new API route `/api/github-stars` that fetches star counts from GitHub API for the repository list",
plan: "Implement GitHub OAuth flow endpoints including authorization redirect and callback handling",
completed: false,
},
{
index: 2,
plan: "Create a new API route `/api/stars` that retrieves cached star counts from Vercel KV store",
plan: "Create middleware for JWT token generation and validation for authenticated sessions",
completed: false,
},
{
index: 3,
plan: "Implement a daily cron job using Vercel Cron Jobs (vercel.json) that calls the GitHub stars API and updates the KV store",
plan: "Add environment configuration management for OAuth app credentials and server settings",
completed: false,
},
{
index: 4,
plan: "Update the ProjectCard component to fetch star counts from the KV store API instead of using static values",
plan: "Create user session management and token storage mechanisms",
completed: false,
},
{
index: 5,
plan: "Add error handling and fallback to static values if KV store is unavailable",
plan: "Implement API endpoints for checking authentication status and user permissions",
completed: false,
},
{
index: 6,
plan: "Update the page.tsx to remove static star values and implement dynamic fetching",
plan: "Add comprehensive error handling and logging throughout the authentication flow",
completed: false,
},
{
index: 7,
plan: "Create comprehensive README documentation covering setup, configuration, and development process",
completed: false,
},
{
index: 8,
plan: "Add TypeScript type definitions for GitHub OAuth responses and internal data structures",
completed: false,
},
],
proposedPlan: [
"Create a list of GitHub repositories with their URLs extracted from the current static star values in page.tsx",
"Create a new API route `/api/github-stars` that fetches star counts from GitHub API for the repository list",
"Create a new API route `/api/stars` that retrieves cached star counts from Vercel KV store",
"Implement a daily cron job using Vercel Cron Jobs (vercel.json) that calls the GitHub stars API and updates the KV store",
"Update the ProjectCard component to fetch star counts from the KV store API instead of using static values",
"Add error handling and fallback to static values if KV store is unavailable",
"Update the page.tsx to remove static star values and implement dynamic fetching",
"Set up the Express.js server with TypeScript configuration and necessary dependencies for GitHub OAuth authentication",
"Implement GitHub OAuth flow endpoints including authorization redirect and callback handling",
"Create middleware for JWT token generation and validation for authenticated sessions",
"Add environment configuration management for OAuth app credentials and server settings",
"Create user session management and token storage mechanisms",
"Implement API endpoints for checking authentication status and user permissions",
"Add comprehensive error handling and logging throughout the authentication flow",
"Create comprehensive README documentation covering setup, configuration, and development process",
"Add TypeScript type definitions for GitHub OAuth responses and internal data structures",
],
planChangeRequest: undefined,
sandboxSessionId: undefined,

View file

@ -38,7 +38,7 @@ You MUST adhere to the following criteria when executing the task:
- Analyzing code for vulnerabilities is allowed.
- Showing user code and tool call details is allowed.
- Remember to always properly format and quote your shell commands.
- Take advantage of the condensed context tool call messages in the conversation history (under the names \`condense_task_context\` and \`condense_planning_context\`). These contain summarized/condensed context from previously completed steps. Ensure you always read these messages to avoid duplicate work (e.g.: searching for file paths).
- Take advantage of the condensed context messages in the conversation history (under the names \`condense_task_context\` and \`condense_planning_context\`). These contain summarized/condensed context from previously completed steps. Ensure you always read these messages to avoid duplicate work (e.g.: searching for file paths).
- These summary messages may include a section called 'Codebase files and descriptions' which contains a list of files, and descriptions of the files' contents. If you need context on a file, or directory, ensure you first check this section of the summary messages to avoid duplicate work.
- The summary messages may also include a section called 'Key repository insights and learnings'. This contains key insights, learnings, and facts the model discovered while completing a task.
- Each summary message will also include a short description of the task it completed, how it did so, and every change it made to the codebase during this task. This section will be titled 'Repository modifications summary'.