You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't have any working implementation of this, but thought of putting it out there as an idea. Would be thrilled to get my hands on a working implementation one way or the other.
import{messageWithTime}from"ai:time.md";// this should essentially behave as,// import { messageWithTime } from "./ai-gen/time.ts";//// the ai-gen/time.ts file should be treated as a "vendored" file// - something that is committed to source control; but not meant// to be directly edited or reviewed.// // this should also play nice with IDEs with the import// line above not producing errors/warnings.//// the workflow should be smart enough to (re)generate the code// as needed and should not introduce a new step into the // development workflow.//exportfunctionhandler(req: Request): Response{consturl=newURL(req.url);if(url.pathname==="/api"){returnResponse.json(messageWithTime());}returnnewResponse("<h1>Welcome to Deno!</h1>",{headers: {"content-type": "text/html"},});}if(import.meta.main){Deno.serve(handler);}
where, ai/time.md is:
```ts
export const messageWithTime: () => ({message: string; time: string;})
```
messageWithTime produces an object with a customary "Hello World" message and the current time as an ISO string.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Consider this variant of the
main.tsfile generated bydeno init.The attempt here is to provide a way to mix ai generated code with hand written code without pretending that both is "just code".
This way, the project preserves the original specification that produced the AI generated code; and treats that specification as the primary artifact.
This is in the same vein as https://github.com/uriva/english-script for example, albeit structured differently.
I don't have any working implementation of this, but thought of putting it out there as an idea. Would be thrilled to get my hands on a working implementation one way or the other.
where,
ai/time.mdis:Beta Was this translation helpful? Give feedback.
All reactions