mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-27 11:07:03 +02:00
Fix Copy as gRPCurl with template-tag payloads (#413)
This commit is contained in:
@@ -1,35 +0,0 @@
|
|||||||
# Worktree Management Skill
|
|
||||||
|
|
||||||
## Creating Worktrees
|
|
||||||
|
|
||||||
When creating git worktrees for this project, ALWAYS use the path format:
|
|
||||||
```
|
|
||||||
../yaak-worktrees/<NAME>
|
|
||||||
```
|
|
||||||
|
|
||||||
For example:
|
|
||||||
- `git worktree add ../yaak-worktrees/feature-auth`
|
|
||||||
- `git worktree add ../yaak-worktrees/bugfix-login`
|
|
||||||
- `git worktree add ../yaak-worktrees/refactor-api`
|
|
||||||
|
|
||||||
## What Happens Automatically
|
|
||||||
|
|
||||||
The post-checkout hook will automatically:
|
|
||||||
1. Create `.env.local` with unique ports (YAAK_DEV_PORT and YAAK_PLUGIN_MCP_SERVER_PORT)
|
|
||||||
2. Copy gitignored editor config folders (.zed, .idea, etc.)
|
|
||||||
3. Run `npm install && npm run bootstrap`
|
|
||||||
|
|
||||||
## Deleting Worktrees
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git worktree remove ../yaak-worktrees/<NAME>
|
|
||||||
```
|
|
||||||
|
|
||||||
## Port Assignments
|
|
||||||
|
|
||||||
- Main worktree: 1420 (Vite), 64343 (MCP)
|
|
||||||
- First worktree: 1421, 64344
|
|
||||||
- Second worktree: 1422, 64345
|
|
||||||
- etc.
|
|
||||||
|
|
||||||
Each worktree can run `npm run app-dev` simultaneously without conflicts.
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
---
|
|
||||||
name: worktree-management
|
|
||||||
description: Manage Yaak git worktrees using the standard ../yaak-worktrees/<NAME> layout, including creation, removal, and expected automatic setup behavior and port assignments.
|
|
||||||
---
|
|
||||||
|
|
||||||
# Worktree Management
|
|
||||||
|
|
||||||
Use the Yaak-standard worktree path layout and lifecycle commands.
|
|
||||||
|
|
||||||
## Path Convention
|
|
||||||
|
|
||||||
Always create worktrees under:
|
|
||||||
|
|
||||||
`../yaak-worktrees/<NAME>`
|
|
||||||
|
|
||||||
Examples:
|
|
||||||
- `git worktree add ../yaak-worktrees/feature-auth`
|
|
||||||
- `git worktree add ../yaak-worktrees/bugfix-login`
|
|
||||||
- `git worktree add ../yaak-worktrees/refactor-api`
|
|
||||||
|
|
||||||
## Automatic Setup After Checkout
|
|
||||||
|
|
||||||
Project git hooks automatically:
|
|
||||||
1. Create `.env.local` with unique `YAAK_DEV_PORT` and `YAAK_PLUGIN_MCP_SERVER_PORT`
|
|
||||||
2. Copy gitignored editor config folders
|
|
||||||
3. Run `npm install && npm run bootstrap`
|
|
||||||
|
|
||||||
## Remove Worktree
|
|
||||||
|
|
||||||
`git worktree remove ../yaak-worktrees/<NAME>`
|
|
||||||
|
|
||||||
## Port Pattern
|
|
||||||
|
|
||||||
- Main worktree: Vite `1420`, MCP `64343`
|
|
||||||
- First extra worktree: `1421`, `64344`
|
|
||||||
- Second extra worktree: `1422`, `64345`
|
|
||||||
- Continue incrementally for additional worktrees
|
|
||||||
@@ -11,7 +11,7 @@ export const plugin: PluginDefinition = {
|
|||||||
async onSelect(ctx, args) {
|
async onSelect(ctx, args) {
|
||||||
const rendered_request = await ctx.grpcRequest.render({
|
const rendered_request = await ctx.grpcRequest.render({
|
||||||
grpcRequest: args.grpcRequest,
|
grpcRequest: args.grpcRequest,
|
||||||
purpose: 'preview',
|
purpose: 'send',
|
||||||
});
|
});
|
||||||
const data = await convert(rendered_request, args.protoFiles);
|
const data = await convert(rendered_request, args.protoFiles);
|
||||||
await ctx.clipboard.copyText(data);
|
await ctx.clipboard.copyText(data);
|
||||||
@@ -103,7 +103,7 @@ export async function convert(request: Partial<GrpcRequest>, allProtoFiles: stri
|
|||||||
|
|
||||||
// Add form params
|
// Add form params
|
||||||
if (request.message) {
|
if (request.message) {
|
||||||
xs.push('-d', `${quote(JSON.stringify(JSON.parse(request.message)))}`);
|
xs.push('-d', quote(request.message));
|
||||||
xs.push(NEWLINE);
|
xs.push(NEWLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -151,7 +151,26 @@ describe('exporter-curl', () => {
|
|||||||
[
|
[
|
||||||
`grpcurl -import-path '/'`,
|
`grpcurl -import-path '/'`,
|
||||||
`-proto '/foo.proto'`,
|
`-proto '/foo.proto'`,
|
||||||
`-d '{"foo":"bar","baz":1}'`,
|
`-d '{\n "foo": "bar",\n "baz": 1\n}'`,
|
||||||
|
'yaak.app',
|
||||||
|
].join(' \\\n '),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Sends data with unresolved template tags', async () => {
|
||||||
|
expect(
|
||||||
|
await convert(
|
||||||
|
{
|
||||||
|
url: 'https://yaak.app',
|
||||||
|
message: '{"timestamp": ${[ faker "timestamp" ]}, "foo": "bar"}',
|
||||||
|
},
|
||||||
|
['/foo.proto'],
|
||||||
|
),
|
||||||
|
).toEqual(
|
||||||
|
[
|
||||||
|
`grpcurl -import-path '/'`,
|
||||||
|
`-proto '/foo.proto'`,
|
||||||
|
`-d '{"timestamp": \${[ faker "timestamp" ]}, "foo": "bar"}'`,
|
||||||
'yaak.app',
|
'yaak.app',
|
||||||
].join(' \\\n '),
|
].join(' \\\n '),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user