runwork 0.10.1 → 0.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/__tests__/clone-args.test.d.ts +1 -0
- package/dist/commands/__tests__/clone-args.test.js +44 -0
- package/dist/commands/clone.d.ts +14 -0
- package/dist/commands/clone.js +20 -2
- package/dist/commands/dev.d.ts +3 -0
- package/dist/commands/dev.js +621 -8
- package/dist/commands/info.d.ts +31 -0
- package/dist/commands/info.js +37 -0
- package/dist/dev/__tests__/attach.test.d.ts +1 -0
- package/dist/dev/__tests__/attach.test.js +296 -0
- package/dist/dev/__tests__/detach.test.d.ts +1 -0
- package/dist/dev/__tests__/detach.test.js +328 -0
- package/dist/dev/__tests__/preview-url-poller.test.d.ts +1 -0
- package/dist/dev/__tests__/preview-url-poller.test.js +149 -0
- package/dist/dev/__tests__/session.test.d.ts +1 -0
- package/dist/dev/__tests__/session.test.js +347 -0
- package/dist/dev/__tests__/stop.test.d.ts +1 -0
- package/dist/dev/__tests__/stop.test.js +172 -0
- package/dist/dev/attach.d.ts +120 -0
- package/dist/dev/attach.js +269 -0
- package/dist/dev/detach.d.ts +164 -0
- package/dist/dev/detach.js +247 -0
- package/dist/dev/preview-url-poller.d.ts +35 -0
- package/dist/dev/preview-url-poller.js +50 -0
- package/dist/dev/session.d.ts +158 -0
- package/dist/dev/session.js +252 -0
- package/dist/dev/stop.d.ts +52 -0
- package/dist/dev/stop.js +101 -0
- package/dist/generated/version.d.ts +1 -1
- package/dist/generated/version.js +1 -1
- package/dist/git/__tests__/credential-helper-e2e.test.d.ts +21 -0
- package/dist/git/__tests__/credential-helper-e2e.test.js +195 -0
- package/dist/git/__tests__/credentials.test.js +33 -20
- package/dist/git/__tests__/preflight-resolution.test.d.ts +1 -0
- package/dist/git/__tests__/preflight-resolution.test.js +366 -0
- package/dist/git/credentials.d.ts +17 -0
- package/dist/git/credentials.js +22 -1
- package/dist/git/preflight.d.ts +34 -5
- package/dist/git/preflight.js +237 -11
- package/dist/health/__tests__/checks.test.js +134 -0
- package/dist/health/checks.d.ts +13 -0
- package/dist/health/checks.js +130 -14
- package/dist/health/runner.js +5 -1
- package/dist/ui/__tests__/keyboard.test.js +4 -0
- package/dist/ui/keyboard.d.ts +1 -1
- package/dist/ui/keyboard.js +4 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { normalizeCloneArgs } from '../clone.js';
|
|
3
|
+
describe('normalizeCloneArgs', () => {
|
|
4
|
+
it('passes through both args unchanged when --app is not provided', () => {
|
|
5
|
+
expect(normalizeCloneArgs('app-id', 'C:/dir', undefined)).toEqual({
|
|
6
|
+
appId: 'app-id',
|
|
7
|
+
directory: 'C:/dir',
|
|
8
|
+
});
|
|
9
|
+
expect(normalizeCloneArgs('app-id', 'C:/dir', {})).toEqual({
|
|
10
|
+
appId: 'app-id',
|
|
11
|
+
directory: 'C:/dir',
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
it('passes through both args unchanged when --app is set but directory is also explicit', () => {
|
|
15
|
+
expect(normalizeCloneArgs('app-id', 'C:/dir', { app: 'foo' })).toEqual({ appId: 'app-id', directory: 'C:/dir' });
|
|
16
|
+
});
|
|
17
|
+
it('shifts the first positional to directory when --app is set and only one positional arg is present', () => {
|
|
18
|
+
// The reproducer from the field:
|
|
19
|
+
// runwork clone --app academic-grade-conversion C:\Users\Oytun\Desktop\agc-test
|
|
20
|
+
// commander binds rawAppId = "C:\Users\..." and rawDirectory = undefined.
|
|
21
|
+
expect(normalizeCloneArgs('C:\\Users\\Oytun\\Desktop\\agc-test', undefined, {
|
|
22
|
+
app: 'academic-grade-conversion',
|
|
23
|
+
})).toEqual({
|
|
24
|
+
appId: undefined,
|
|
25
|
+
directory: 'C:\\Users\\Oytun\\Desktop\\agc-test',
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
it('does not shift when --app is set and no positional args are provided', () => {
|
|
29
|
+
expect(normalizeCloneArgs(undefined, undefined, { app: 'foo' })).toEqual({
|
|
30
|
+
appId: undefined,
|
|
31
|
+
directory: undefined,
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
it('does not shift when --app is set with only the directory positional (rawAppId already undefined)', () => {
|
|
35
|
+
// commander binds positional arguments left-to-right; if only one is
|
|
36
|
+
// given, it's always rawAppId. So this case shouldn't arise in practice
|
|
37
|
+
// -- but if a future commander upgrade changes that, we should leave
|
|
38
|
+
// already-correct args alone.
|
|
39
|
+
expect(normalizeCloneArgs(undefined, 'C:/dir', { app: 'foo' })).toEqual({
|
|
40
|
+
appId: undefined,
|
|
41
|
+
directory: 'C:/dir',
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
});
|
package/dist/commands/clone.d.ts
CHANGED
|
@@ -10,4 +10,18 @@ export interface CloneResult {
|
|
|
10
10
|
workspaceName: string;
|
|
11
11
|
}
|
|
12
12
|
export declare function execClone(client: ApiClient, app: AppInfo, directory?: string, creds?: Credentials | null): Promise<CloneResult>;
|
|
13
|
+
/**
|
|
14
|
+
* Reconcile positional args with --app. When --app is provided, the first
|
|
15
|
+
* positional argument is intended as the *directory* -- not another appId
|
|
16
|
+
* -- because the app is already disambiguated by the option. Without this,
|
|
17
|
+
* `runwork clone --app foo C:\path\to\dir` ends up parsing `C:\path\to\dir`
|
|
18
|
+
* as `appId` (which is then ignored because `--app` wins), leaving
|
|
19
|
+
* `directory` undefined and silently cloning into the slug under cwd.
|
|
20
|
+
*/
|
|
21
|
+
export declare function normalizeCloneArgs(appId: string | undefined, directory: string | undefined, options: {
|
|
22
|
+
app?: string;
|
|
23
|
+
} | undefined): {
|
|
24
|
+
appId: string | undefined;
|
|
25
|
+
directory: string | undefined;
|
|
26
|
+
};
|
|
13
27
|
export declare const cloneCommand: Command;
|
package/dist/commands/clone.js
CHANGED
|
@@ -109,13 +109,28 @@ export async function execClone(client, app, directory, creds) {
|
|
|
109
109
|
workspaceName: app.workspaceName,
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Reconcile positional args with --app. When --app is provided, the first
|
|
114
|
+
* positional argument is intended as the *directory* -- not another appId
|
|
115
|
+
* -- because the app is already disambiguated by the option. Without this,
|
|
116
|
+
* `runwork clone --app foo C:\path\to\dir` ends up parsing `C:\path\to\dir`
|
|
117
|
+
* as `appId` (which is then ignored because `--app` wins), leaving
|
|
118
|
+
* `directory` undefined and silently cloning into the slug under cwd.
|
|
119
|
+
*/
|
|
120
|
+
export function normalizeCloneArgs(appId, directory, options) {
|
|
121
|
+
if (options?.app && appId && !directory) {
|
|
122
|
+
return { appId: undefined, directory: appId };
|
|
123
|
+
}
|
|
124
|
+
return { appId, directory };
|
|
125
|
+
}
|
|
112
126
|
export const cloneCommand = new Command('clone')
|
|
113
127
|
.description('Clone a Runwork app to local development')
|
|
114
128
|
.argument('[appId]', 'App ID to clone (interactive if omitted)')
|
|
115
129
|
.argument('[directory]', 'Target directory')
|
|
116
130
|
.option('--app <name-or-id>', 'App name or ID (skips interactive selection)')
|
|
117
|
-
.action(async (
|
|
131
|
+
.action(async (rawAppId, rawDirectory, options) => {
|
|
118
132
|
requireGit('clone');
|
|
133
|
+
const { appId, directory } = normalizeCloneArgs(rawAppId, rawDirectory, options);
|
|
119
134
|
const creds = requireAuth();
|
|
120
135
|
const client = new ApiClient(creds);
|
|
121
136
|
const useJson = shouldOutputJson(undefined);
|
|
@@ -151,7 +166,10 @@ export const cloneCommand = new Command('clone')
|
|
|
151
166
|
jsonOut(response);
|
|
152
167
|
return;
|
|
153
168
|
}
|
|
154
|
-
|
|
169
|
+
// No trailing separator: cloneResult.directory is already an absolute
|
|
170
|
+
// path. Appending '/' here mixed with Windows '\' separators produced
|
|
171
|
+
// confusing output like `C:\Users\...\app/` on Windows.
|
|
172
|
+
console.log(`\nApp "${cloneResult.appName}" cloned to ${cloneResult.directory}`);
|
|
155
173
|
console.log(`Remote: ${client.getGitRemoteUrl(cloneResult.workspaceId, cloneResult.appId)}`);
|
|
156
174
|
await runAgentWizard(cloneResult.directory);
|
|
157
175
|
console.log(`Next: cd ${cloneResult.slug} && runwork dev`);
|
package/dist/commands/dev.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
+
import { type SessionMode } from '../dev/session.js';
|
|
2
3
|
export declare function execDev(options?: {
|
|
3
4
|
logs?: boolean;
|
|
4
5
|
logsOnlyFile?: boolean;
|
|
5
6
|
json?: boolean;
|
|
7
|
+
mode?: SessionMode;
|
|
8
|
+
restart?: boolean;
|
|
6
9
|
}): Promise<void>;
|
|
7
10
|
export declare const devCommand: Command;
|