Skip to content

Commit 2a2ded9

Browse files
feat: add flag parity (#42)
1 parent 2d12ccc commit 2a2ded9

File tree

5 files changed

+87
-42
lines changed

5 files changed

+87
-42
lines changed

packages/cli/src/commands/compute/app/create.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ export default class AppCreate extends Command {
1717
description: "Programming language (typescript, golang, rust, python)",
1818
options: ["typescript", "golang", "rust", "python"],
1919
}),
20-
template: Flags.string({
20+
"template-repo": Flags.string({
2121
description: "Template name or custom template URL",
2222
}),
23-
templateVersion: Flags.string({
23+
"template-version": Flags.string({
2424
description: "Template version/ref",
2525
}),
2626
verbose: Flags.boolean({
@@ -46,15 +46,15 @@ export default class AppCreate extends Command {
4646
const language = flags.language || (await promptLanguage());
4747

4848
// 3. Get template interactively if not provided
49-
const template = flags.template || (await selectTemplateInteractive(language));
49+
const template = flags["template-repo"] || (await selectTemplateInteractive(language));
5050

5151
// 4. Call SDK with all gathered parameters
5252
return createApp(
5353
{
5454
name,
5555
language,
5656
template: template || undefined,
57-
templateVersion: flags.templateVersion,
57+
templateVersion: flags["template-version"],
5858
verbose: flags.verbose,
5959
},
6060
logger,

packages/cli/src/commands/compute/app/deploy.ts

Lines changed: 69 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,22 @@ export default class AppDeploy extends Command {
7373
options: ["enable", "disable"],
7474
env: "ECLOUD_RESOURCE_USAGE_MONITORING",
7575
}),
76+
website: Flags.string({
77+
required: false,
78+
description: "App website URL (optional)",
79+
}),
80+
description: Flags.string({
81+
required: false,
82+
description: "App description (optional)",
83+
}),
84+
"x-url": Flags.string({
85+
required: false,
86+
description: "X (Twitter) profile URL (optional)",
87+
}),
88+
image: Flags.string({
89+
required: false,
90+
description: "Path to app icon/logo image - JPG/PNG, max 4MB, square recommended (optional)",
91+
}),
7692
};
7793

7894
async run() {
@@ -172,41 +188,64 @@ export default class AppDeploy extends Command {
172188

173189
// 11. Collect app profile while deployment is in progress (optional)
174190
if (!flags["skip-profile"]) {
175-
this.log(
176-
"\nDeployment confirmed onchain. While your instance provisions, set up a public profile:",
177-
);
191+
// Check if any profile flags were provided
192+
const hasProfileFlags = flags.website || flags.description || flags["x-url"] || flags.image;
193+
194+
let profile: {
195+
name: string;
196+
website?: string;
197+
description?: string;
198+
xURL?: string;
199+
imagePath?: string;
200+
} | null = null;
201+
202+
if (hasProfileFlags) {
203+
// Use flags directly if any were provided
204+
profile = {
205+
name: appName,
206+
website: flags.website,
207+
description: flags.description,
208+
xURL: flags["x-url"],
209+
imagePath: flags.image,
210+
};
211+
} else {
212+
// Otherwise prompt interactively
213+
this.log(
214+
"\nDeployment confirmed onchain. While your instance provisions, set up a public profile:",
215+
);
216+
217+
try {
218+
profile = (await getAppProfileInteractive(appName, true)) || null;
219+
} catch {
220+
// Profile collection cancelled or failed - continue without profile
221+
logger.debug("Profile collection skipped or cancelled");
222+
}
223+
}
178224

179-
try {
180-
const profile = await getAppProfileInteractive(appName, true);
225+
if (profile) {
226+
// Upload profile if provided (non-blocking - warn on failure but don't fail deployment)
227+
logger.info("Uploading app profile...");
228+
try {
229+
const userApiClient = new UserApiClient(environmentConfig, privateKey, rpcUrl);
230+
await userApiClient.uploadAppProfile(
231+
res.appId as `0x${string}`,
232+
profile.name,
233+
profile.website,
234+
profile.description,
235+
profile.xURL,
236+
profile.imagePath,
237+
);
238+
logger.info("✓ Profile uploaded successfully");
181239

182-
if (profile) {
183-
// Upload profile if provided (non-blocking - warn on failure but don't fail deployment)
184-
logger.info("Uploading app profile...");
240+
// Invalidate profile cache to ensure fresh data on next command
185241
try {
186-
const userApiClient = new UserApiClient(environmentConfig, privateKey, rpcUrl);
187-
await userApiClient.uploadAppProfile(
188-
res.appId as `0x${string}`,
189-
profile.name,
190-
profile.website,
191-
profile.description,
192-
profile.xURL,
193-
profile.imagePath,
194-
);
195-
logger.info("✓ Profile uploaded successfully");
196-
197-
// Invalidate profile cache to ensure fresh data on next command
198-
try {
199-
invalidateProfileCache(environment);
200-
} catch (cacheErr: any) {
201-
logger.debug(`Failed to invalidate profile cache: ${cacheErr.message}`);
202-
}
203-
} catch (uploadErr: any) {
204-
logger.warn(`Failed to upload profile: ${uploadErr.message}`);
242+
invalidateProfileCache(environment);
243+
} catch (cacheErr: any) {
244+
logger.debug(`Failed to invalidate profile cache: ${cacheErr.message}`);
205245
}
246+
} catch (uploadErr: any) {
247+
logger.warn(`Failed to upload profile: ${uploadErr.message}`);
206248
}
207-
} catch {
208-
// Profile collection cancelled or failed - continue without profile
209-
logger.debug("Profile collection skipped or cancelled");
210249
}
211250
}
212251

packages/cli/src/commands/compute/app/list.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ export default class AppList extends Command {
2929
char: "a",
3030
default: false,
3131
}),
32+
"address-count": Flags.integer({
33+
description: "Number of addresses to fetch",
34+
default: 1,
35+
}),
3236
};
3337

3438
async run() {
@@ -87,8 +91,9 @@ export default class AppList extends Command {
8791
const userApiClient = new UserApiClient(environmentConfig, privateKey, rpcUrl);
8892

8993
// Fetch all data in parallel
94+
const addressCount = flags["address-count"];
9095
const [appInfos, releaseBlockNumbers] = await Promise.all([
91-
getAppInfosChunked(userApiClient, filteredApps, 1).catch((err) => {
96+
getAppInfosChunked(userApiClient, filteredApps, addressCount).catch((err) => {
9297
if (flags.verbose) {
9398
this.warn(`Could not fetch app info from UserAPI: ${err}`);
9499
}
@@ -188,7 +193,7 @@ export default class AppList extends Command {
188193

189194
// Print app details using shared utility
190195
printAppDisplay(display, this.log.bind(this), " ", {
191-
singleAddress: true,
196+
singleAddress: addressCount === 1,
192197
showProfile: false,
193198
});
194199

packages/cli/src/commands/version.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ export default class Version extends Command {
7474

7575
// Print the short sha from the projects root .git dir
7676
// Run git directly, setting cwd so no shell expansion/risk
77-
const commitSha = execSync("git rev-parse --short HEAD", { cwd: packageRoot, encoding: "utf8" }).trim();
77+
const commitSha = execSync("git rev-parse --short HEAD", {
78+
cwd: packageRoot,
79+
encoding: "utf8",
80+
}).trim();
7881
this.log(`Commit: ${commitSha}`);
7982
} catch {
8083
// If we can't get the commit then print unknown

packages/sdk/src/client/common/templates/git.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,9 @@ export async function fetchTemplate(
4141
});
4242

4343
// Checkout the desired ref
44-
await execFileAsync(
45-
"git",
46-
["-C", targetDir, "checkout", "--quiet", ref],
47-
{ maxBuffer: 10 * 1024 * 1024 },
48-
);
44+
await execFileAsync("git", ["-C", targetDir, "checkout", "--quiet", ref], {
45+
maxBuffer: 10 * 1024 * 1024,
46+
});
4947

5048
// Update submodules
5149
await execAsync(`git -C ${targetDir} submodule update --init --recursive --progress`);

0 commit comments

Comments
 (0)