Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,8 @@ next-env.d.ts
# renders
renders/

# tiles
tiles/

# .claude
.claude/settings.local.json
83 changes: 83 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Node Banana - Development Guide

## Model

The application uses these models for image generation. These models are very recently released and do exist.
gemini-3-pro-image-preview
gemini-2.5-flash-preview-image-generation
Comment on lines +5 to +7
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Fix incorrect and retired model identifier in the models list.

The model gemini-2.5-flash-preview-image-generation was retired on October 31, 2025, and the name itself is inaccurate. The correct, current model identifier is gemini-2.5-flash-image. Since this is a development guide for models "very recently released," using an outdated, non-existent model name undermines credibility and will confuse developers.

🔎 Proposed fix
- gemini-3-pro-image-preview
- gemini-2.5-flash-preview-image-generation
+ gemini-3-pro-image-preview
+ gemini-2.5-flash-image
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
The application uses these models for image generation. These models are very recently released and do exist.
gemini-3-pro-image-preview
gemini-2.5-flash-preview-image-generation
The application uses these models for image generation. These models are very recently released and do exist.
gemini-3-pro-image-preview
gemini-2.5-flash-image
🤖 Prompt for AI Agents
In AGENTS.md around lines 5 to 7, the models list contains a retired/inaccurate
identifier; replace the incorrect "gemini-2.5-flash-preview-image-generation"
entry with the current, correct model identifier "gemini-2.5-flash-image" and
ensure the surrounding text still accurately reflects that these are recently
released models.


## Node Connection System

### Handle Types

Nodes communicate through typed handles. Each handle has a **data type** that determines what connections are valid.

| Handle Type | Data Format | Description |
| ----------- | --------------- | ----------------------------------------------------------- |
| `image` | Base64 data URL | Visual content (photos, generated images, annotated images) |
| `text` | String | Text content (user prompts, LLM outputs, transformed text) |

### Connection Rules

1. **Type Matching**: Handles can only connect to handles of the same type

- `image` → `image` (valid)
- `text` → `text` (valid)
- `image` → `text` (invalid)

2. **Direction**: Connections flow from `source` (output) to `target` (input)

3. **Multiplicity**:
- Image inputs on generation nodes accept multiple connections (for multi-image context)
- Text inputs accept single connections (last connected wins)

### Data Flow in `getConnectedInputs`

When a node executes, it retrieves connected inputs via `getConnectedInputs(nodeId)` in `workflowStore.ts`. This function returns `{ images: string[], text: string | null }`.

**For `image` handles, extract from:**

- `imageInput` → `data.image`
- `annotation` → `data.outputImage`
- `nanoBanana` → `data.outputImage`

**For `text` handles, extract from:**

- `prompt` → `data.prompt`
- `llmGenerate` → `data.outputText`

### Adding New Node Types

When creating a new node type:

1. **Define the data interface** in `src/types/index.ts`
2. **Add to `NodeType` union** in `src/types/index.ts`
3. **Create default data** in `createDefaultNodeData()` in `workflowStore.ts`
4. **Add dimensions** to `defaultDimensions` in `workflowStore.ts`
5. **Create the component** in `src/components/nodes/`
6. **Export from** `src/components/nodes/index.ts`
7. **Register in nodeTypes** in `WorkflowCanvas.tsx`
8. **Add minimap color** in `WorkflowCanvas.tsx`
9. **Update `getConnectedInputs`** if the node produces output that other nodes consume
10. **Add execution logic** in `executeWorkflow()` if the node requires processing
11. **Update `ConnectionDropMenu.tsx`** to include the node in appropriate source/target lists

### Handle Naming Convention

Use descriptive handle IDs that match the data type:

- `id="image"` for image data
- `id="text"` for text data

Future handle types might include:

- `audio` - for audio data
- `video` - for video data
- `json` - for structured data
- `number` - for numeric values

### Validation

Connection validation happens in `isValidConnection()` in `WorkflowCanvas.tsx`. Update this function if adding new handle types with specific rules.

Workflow validation happens in `validateWorkflow()` in `workflowStore.ts`. Add checks for required inputs on new node types.
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
dev:
npm run dev

sync-fork:
@echo "Fetching from upstream..."
git fetch upstream
@echo "Merging upstream/main into current branch..."
git merge upstream/main
@echo "Pushing to origin..."
git push origin
@echo "Fork synced successfully!"

setup-upstream:
@echo "Setting up upstream remote..."
@read -p "Enter upstream repository URL: " url; \
git remote add upstream $$url
@echo "Upstream remote added. Run 'make sync-fork' to sync."
Comment on lines +1 to +17
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Add .PHONY declarations for all targets.

All three targets (dev, sync-fork, setup-upstream) are phony (not files) and should be declared to avoid conflicts with files of the same name and ensure correct behavior.

🔎 Proposed fix
+.PHONY: dev sync-fork setup-upstream
+
 dev:
 	npm run dev
 
 sync-fork:
 	@echo "Fetching from upstream..."
 	git fetch upstream
 	@echo "Merging upstream/main into current branch..."
 	git merge upstream/main
 	@echo "Pushing to origin..."
 	git push origin
 	@echo "Fork synced successfully!"
 
 setup-upstream:
 	@echo "Setting up upstream remote..."
 	@read -p "Enter upstream repository URL: " url; \
 	git remote add upstream $$url
 	@echo "Upstream remote added. Run 'make sync-fork' to sync."
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
dev:
npm run dev
sync-fork:
@echo "Fetching from upstream..."
git fetch upstream
@echo "Merging upstream/main into current branch..."
git merge upstream/main
@echo "Pushing to origin..."
git push origin
@echo "Fork synced successfully!"
setup-upstream:
@echo "Setting up upstream remote..."
@read -p "Enter upstream repository URL: " url; \
git remote add upstream $$url
@echo "Upstream remote added. Run 'make sync-fork' to sync."
.PHONY: dev sync-fork setup-upstream
dev:
npm run dev
sync-fork:
@echo "Fetching from upstream..."
git fetch upstream
@echo "Merging upstream/main into current branch..."
git merge upstream/main
@echo "Pushing to origin..."
git push origin
@echo "Fork synced successfully!"
setup-upstream:
@echo "Setting up upstream remote..."
@read -p "Enter upstream repository URL: " url; \
git remote add upstream $$url
@echo "Upstream remote added. Run 'make sync-fork' to sync."
🧰 Tools
🪛 checkmake (0.2.2)

[warning] 1-1: Missing required phony target "all"

(minphony)


[warning] 1-1: Missing required phony target "clean"

(minphony)


[warning] 1-1: Missing required phony target "test"

(minphony)

🤖 Prompt for AI Agents
In Makefile around lines 1 to 17, the targets dev, sync-fork and setup-upstream
are phony but not declared; add a .PHONY declaration listing these three targets
near the top of the file so Make won’t treat them as files and to ensure correct
behavior when files with those names exist.

Loading