Skip to content

Conversation

@archandatta
Copy link
Contributor

@archandatta archandatta commented Dec 4, 2025

Description

  • Phase 1 of migrating the npx @onkernel/create-kernel-app to the cli
  • Added one ts sample-app template to test
  • Current functions:
    • prompts user to create new app (no auth required)
    • allows flags for name, language, template
    • validators for name and language
    • copies all the files from template into newly created directory
  • Next additions:
    • add all the templates (including python)
    • validation for templates
    • install dependencies

Testing

  • uncomment line 133 in root.go
  • run make build && ./bin/kernel create
  • should walk through the prompts and create a new app with sample-app template in ts
  • should give this output:
Screenshot 2025-12-05 at 10 48 13 AM

@mesa-dot-dev
Copy link

mesa-dot-dev bot commented Dec 5, 2025

Mesa Description

Description

  • Phase 1 of migrating the npx @onkernel/create-kernel-app to the cli
  • Added one ts sample-app template to test
  • Current functions:
    • prompts user to create new app (no auth required)
    • allows flags for name, language, template
    • validators for name and language
    • copies all the files from template into newly created directory
  • Next additions:
    • add all the templates (including python)
    • validation for templates
    • install dependencies

Testing

  • uncomment line 133 in root.go
  • run make build && ./bin/kernel create
  • should walk through the prompts and create a new app with sample-app template in ts
  • should give this output:
Screenshot 2025-12-05 at 10 48 13 AM

TL;DR

Introduced a new create command to the CLI for scaffolding Kernel applications, including a TypeScript sample app template.

Why we made these changes

This is Phase 1 of migrating the npx @onkernel/create-kernel-app functionality to the cli, aiming to centralize application creation within the CLI.

What changed?

  • cmd/create.go: Added a new create command to the CLI for scaffolding new Kernel applications, supporting flags for name, language, and template, and providing post-creation instructions.
  • cmd/create_test.go: Added comprehensive unit tests for the create command, covering successful template generation and invalid template error handling.
  • cmd/root.go: Integrated the create command, marking it as authentication-exempt and temporarily hidden.
  • go.mod, go.sum: Updated Go module dependencies.
  • pkg/create/copy.go: Introduced CopyTemplateFiles to copy embedded template files from an embedded Go filesystem to the target application path.
  • pkg/create/prompts.go: Added interactive command-line prompting functions (PromptForAppName, PromptForLanguage, PromptForTemplate) using the survey library.
  • pkg/create/types.go: Defined foundational types, constants, and utility functions for managing application templates and supported languages, including a TemplateInfo struct and a Templates map with a "sample-app" template.
  • pkg/create/types_test.go: Added unit tests for language normalization and template definitions, verifying the Templates map and 'sample-app' template.
  • pkg/templates/templates.go: Initialized an embedded file system to include the typescript directory.
  • pkg/templates/typescript/sample-app/: Added a new TypeScript sample application template (ts-basic) with README.md, _gitignore, index.ts (demonstrating @onkernel/sdk and playwright), package-lock.json, package.json, pnpm-lock.yaml, and tsconfig.json.

Validation

  • uncomment line 133 in root.go
  • run make build && ./bin/kernel create
  • should walk through the prompts and create a new app with sample-app template in ts
  • should give this output:
Screenshot 2025-12-05 at 10 48 13 AM

Description generated by Mesa. Update settings

@archandatta archandatta marked this pull request as ready for review December 5, 2025 14:49
@archandatta archandatta requested a review from rgarcia December 5, 2025 14:49
Copy link

@mesa-dot-dev mesa-dot-dev bot left a comment

Choose a reason for hiding this comment

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

Performed full review of 81c29c0...89aa20b

Analysis

  1. Language/Template Mismatch: Python is declared as supported in types.go, but only TypeScript templates are embedded. This will cause runtime failures when users try to create Python apps.

  2. Hardcoded Output Messages: Success messages and next steps in create.go don't adapt to the selected language or app name, creating a confusing experience, especially for Python users.

  3. Missing Template Validation: There's an unimplemented TODO for template validation in prompts.go, allowing users to provide invalid templates that won't fail until file copy operations.

  4. Incomplete Error Handling: Directory creation doesn't clean up on subsequent failures, leaving empty directories when template copying fails.

  5. Code Quality Issues: Function name typo in prompts.go ("handleLangugePrompt") and error messages in copy.go could be more actionable.

Tip

Help

Slash Commands:

  • /review - Request a full code review
  • /review latest - Review only changes since the last review
  • /describe - Generate PR description. This will update the PR body or issue comment depending on your configuration
  • /help - Get help with Mesa commands and configuration options

17 files reviewed | 0 comments | Edit Agent SettingsRead Docs

@@ -0,0 +1,5 @@
# Kernel Typscript Sample App
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: "Typscript" → "TypeScript"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will fix in #44

"typescript": "^5"
},
"dependencies": {
"@onkernel/sdk": ">=0.14.2",
Copy link
Contributor

Choose a reason for hiding this comment

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

Might want to regenerate the lock files with the latest SDK version.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will fix in #44

Copy link
Contributor

@rgarcia rgarcia left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Solid Phase 1 implementation. Left some comments.

@rgarcia
Copy link
Contributor

rgarcia commented Dec 6, 2025

random thing i forgot here--make sure to update the readme of the repo with documentation for the new command

@archandatta
Copy link
Contributor Author

random thing i forgot here--make sure to update the readme of the repo with documentation for the new command

Yeah I'll add this when I'm almost done with this!

@archandatta
Copy link
Contributor Author

archandatta commented Dec 8, 2025

@rgarcia made some structural changes in 261ead0 to make it easier for testing/maintainability

@archandatta archandatta requested a review from rgarcia December 8, 2025 17:15
@archandatta archandatta force-pushed the archand/port/create-kernel-app branch from c837987 to 261ead0 Compare December 8, 2025 17:17
@archandatta
Copy link
Contributor Author

@cursoragent review

@cursor
Copy link

cursor bot commented Dec 9, 2025

Now I have a comprehensive understanding of the PR. Let me review the code and provide feedback on the outstanding issues mentioned in the PR comments, as well as any additional observations.

Code Review for PR #43: Create kernel app port

Summary

This is a solid Phase 1 implementation of migrating npx @onkernel/create-kernel-app to the CLI. The structure is clean with good separation between the command, prompts, types, and file copying logic.

Outstanding Issues from PR Comments

  1. ✅ Fixed: handleLangugePrompt typo - I see the function is now correctly named handleLanguagePrompt in prompts.go:74

  2. ⚠️ Still needs attention: README typo - The sample-app README still has "Typscript" instead of "TypeScript":

# Kernel Typscript Sample App
  1. ⚠️ Still needs attention: Outdated comment about log streaming - In index.ts:19, there's still a reference to opening logs in a separate tab. Since log streaming was added to kernel invoke, this should be updated:
 *  kernel invoke ts-basic get-page-title -p '{"url": "https://www.google.com"}'
 *  kernel logs ts-basic -f # Open in separate tab
  1. ✅ Fixed: createCmd is now registered - I see it's uncommented in root.go:132

  2. ⚠️ SDK version lock files - The comment mentioned regenerating lock files with the latest SDK version. The package.json has @onkernel/sdk": ">=0.14.2 but lock files may need regeneration.

Additional Observations

  1. App name validation when provided via flag - Per @rgarcia's comment, the validation is now properly applied when app name is provided via flag (lines 65-69 in prompts.go). ✅

  2. Missing README documentation - Per @rgarcia's comment, the main README should be updated with documentation for the new create command. Currently the README has no mention of kernel create.

  3. Template validation TODO - There's a TODO comment at prompts.go:98 about adding validation for templates. This is noted as a future addition.

  4. Test coverage - The tests look good, covering both successful creation and invalid template error handling.

Recommendations

  1. Fix the typo in pkg/templates/typescript/sample-app/README.md: "Typscript" → "TypeScript"

  2. Remove or update the outdated log streaming comment in index.ts:

    *  kernel logs ts-basic -f # Open in separate tab

    Could be changed to just:

    *  kernel logs ts-basic -f
  3. Add documentation for kernel create to the main README.md

Would you like me to make these fixes?


Open in Cursor Open in Web

Learn more about Cursor Agents

@cursor
Copy link

cursor bot commented Dec 9, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@archandatta archandatta merged commit 0b56ae5 into main Dec 9, 2025
1 check passed
@archandatta archandatta deleted the archand/port/create-kernel-app branch December 9, 2025 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants