alpic 0.0.0-dev.5de73b6 → 0.0.0-dev.6816670
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/{deploy.d.ts → hello.d.ts} +1 -1
- package/dist/commands/hello.js +10 -0
- package/dist/commands/hello.js.map +1 -0
- package/package.json +1 -5
- package/dist/commands/deploy.js +0 -96
- package/dist/commands/deploy.js.map +0 -1
- package/dist/types/api.d.ts +0 -30
- package/dist/types/api.js +0 -2
- package/dist/types/api.js.map +0 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command } from "@oclif/core";
|
|
2
|
+
export class Hello extends Command {
|
|
3
|
+
static description = "A simple hello world command for testing";
|
|
4
|
+
static examples = ["<%= config.bin %> hello"];
|
|
5
|
+
async run() {
|
|
6
|
+
await this.parse(Hello);
|
|
7
|
+
this.log("Hello, world! 👋");
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=hello.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hello.js","sourceRoot":"","sources":["../../src/commands/hello.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,MAAM,OAAO,KAAM,SAAQ,OAAO;IAChC,MAAM,CAAU,WAAW,GAAG,0CAA0C,CAAC;IAEzE,MAAM,CAAU,QAAQ,GAAG,CAAC,yBAAyB,CAAC,CAAC;IAEvD,KAAK,CAAC,GAAG;QACP,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACxB,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAC/B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "alpic",
|
|
3
|
-
"version": "0.0.0-dev.
|
|
3
|
+
"version": "0.0.0-dev.6816670",
|
|
4
4
|
"description": "The command-line interface for Alpic",
|
|
5
5
|
"homepage": "https://alpic.ai",
|
|
6
6
|
"preferGlobal": true,
|
|
@@ -24,10 +24,6 @@
|
|
|
24
24
|
],
|
|
25
25
|
"author": "Alpic",
|
|
26
26
|
"license": "ISC",
|
|
27
|
-
"dependencies": {
|
|
28
|
-
"@clack/prompts": "^0.8.2",
|
|
29
|
-
"tar": "^7.4.0"
|
|
30
|
-
},
|
|
31
27
|
"devDependencies": {
|
|
32
28
|
"@oclif/core": "^4.8.0",
|
|
33
29
|
"@total-typescript/tsconfig": "^1.0.4",
|
package/dist/commands/deploy.js
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import * as p from "@clack/prompts";
|
|
2
|
-
import { Command } from "@oclif/core";
|
|
3
|
-
import { execSync } from "node:child_process";
|
|
4
|
-
import { mkdtempSync, readFileSync, rmSync } from "node:fs";
|
|
5
|
-
import { tmpdir } from "node:os";
|
|
6
|
-
import { join } from "node:path";
|
|
7
|
-
import { create as tarCreate } from "tar";
|
|
8
|
-
const API_BASE_URLS = {
|
|
9
|
-
local: "http://localhost:3000",
|
|
10
|
-
staging: "https://api.staging.alpic.ai",
|
|
11
|
-
production: "https://api.alpic.ai",
|
|
12
|
-
};
|
|
13
|
-
function getApiBaseUrl() {
|
|
14
|
-
const target = process.env.ALPIC_TARGET?.toLowerCase() ?? "production";
|
|
15
|
-
return API_BASE_URLS[target];
|
|
16
|
-
}
|
|
17
|
-
export class Deploy extends Command {
|
|
18
|
-
static description = "Deploy a project to Alpic";
|
|
19
|
-
static examples = ["<%= config.bin %> deploy"];
|
|
20
|
-
async run() {
|
|
21
|
-
await this.parse(Deploy);
|
|
22
|
-
p.intro("Deploying to Alpic");
|
|
23
|
-
const apiKey = process.env.ALPIC_API_KEY;
|
|
24
|
-
if (!apiKey) {
|
|
25
|
-
p.cancel("ALPIC_API_KEY environment variable is required");
|
|
26
|
-
this.exit(1);
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
const spinner = p.spinner();
|
|
30
|
-
try {
|
|
31
|
-
spinner.start("Collecting source files...");
|
|
32
|
-
const filesOutput = execSync("git ls-files -z --cached --others --exclude-standard", {
|
|
33
|
-
encoding: "utf8",
|
|
34
|
-
maxBuffer: 10 * 1024 * 1024,
|
|
35
|
-
});
|
|
36
|
-
const files = filesOutput.split("\0").filter(Boolean);
|
|
37
|
-
if (files.length === 0) {
|
|
38
|
-
spinner.stop("No files to deploy");
|
|
39
|
-
p.cancel("No tracked or untracked files found. Ensure you are in a git repository with files to deploy.");
|
|
40
|
-
this.exit(1);
|
|
41
|
-
}
|
|
42
|
-
spinner.stop(`Collected ${files.length} file${files.length === 1 ? "" : "s"}`);
|
|
43
|
-
spinner.start("Creating archive...");
|
|
44
|
-
const tmpDir = mkdtempSync(join(tmpdir(), "alpic-deploy-"));
|
|
45
|
-
const archivePath = join(tmpDir, "source.tar.gz");
|
|
46
|
-
await tarCreate({
|
|
47
|
-
gzip: true,
|
|
48
|
-
file: archivePath,
|
|
49
|
-
cwd: process.cwd(),
|
|
50
|
-
}, files);
|
|
51
|
-
spinner.stop("Archive created");
|
|
52
|
-
spinner.start("Getting upload URL...");
|
|
53
|
-
const uploadRes = await fetch(`${getApiBaseUrl()}/v1/deployments/upload`, {
|
|
54
|
-
method: "POST",
|
|
55
|
-
headers: {
|
|
56
|
-
Authorization: `Bearer ${apiKey}`,
|
|
57
|
-
},
|
|
58
|
-
});
|
|
59
|
-
if (!uploadRes.ok) {
|
|
60
|
-
const errBody = await uploadRes.text();
|
|
61
|
-
spinner.stop("Failed to get upload URL");
|
|
62
|
-
p.cancel(`API request failed: ${uploadRes.status} ${uploadRes.statusText} - ${errBody}`);
|
|
63
|
-
this.exit(1);
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
const { uploadUrl, objectKey } = (await uploadRes.json());
|
|
67
|
-
spinner.stop("Upload URL received");
|
|
68
|
-
spinner.start("Uploading source...");
|
|
69
|
-
const archiveBuffer = readFileSync(archivePath);
|
|
70
|
-
rmSync(tmpDir, { recursive: true });
|
|
71
|
-
const putRes = await fetch(uploadUrl, {
|
|
72
|
-
method: "PUT",
|
|
73
|
-
headers: {
|
|
74
|
-
"Content-Type": "application/gzip",
|
|
75
|
-
"Content-Length": String(archiveBuffer.byteLength),
|
|
76
|
-
},
|
|
77
|
-
body: archiveBuffer,
|
|
78
|
-
});
|
|
79
|
-
if (!putRes.ok) {
|
|
80
|
-
spinner.stop("Upload failed");
|
|
81
|
-
p.cancel(`Upload failed: ${putRes.status} ${putRes.statusText}`);
|
|
82
|
-
this.exit(1);
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
spinner.stop("Upload complete");
|
|
86
|
-
p.outro("Source code uploaded successfully.");
|
|
87
|
-
p.note(objectKey, "Artifact key (use this when triggering a deployment)");
|
|
88
|
-
}
|
|
89
|
-
catch (error) {
|
|
90
|
-
spinner.stop("Deploy failed");
|
|
91
|
-
p.cancel(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
92
|
-
this.exit(1);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
//# sourceMappingURL=deploy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,KAAK,CAAC;AAE1C,MAAM,aAAa,GAAG;IACpB,KAAK,EAAE,uBAAuB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C,CAAC,CAAC,CAAC;QACf,CAAC;IACH,CAAC"}
|
package/dist/types/api.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export interface LatestDeployment {
|
|
2
|
-
id: string;
|
|
3
|
-
status: "ongoing" | "deployed" | "failed" | "canceled";
|
|
4
|
-
sourceCommitId: string;
|
|
5
|
-
sourceCommitMessage: string;
|
|
6
|
-
completedAt: Date | null;
|
|
7
|
-
}
|
|
8
|
-
export interface Environment {
|
|
9
|
-
id: string;
|
|
10
|
-
name: string;
|
|
11
|
-
sourceBranch: string;
|
|
12
|
-
mcpServerUrl: string;
|
|
13
|
-
createdAt: Date;
|
|
14
|
-
projectId: string;
|
|
15
|
-
latestDeployment: LatestDeployment | null;
|
|
16
|
-
}
|
|
17
|
-
export interface Project {
|
|
18
|
-
id: string;
|
|
19
|
-
name: string;
|
|
20
|
-
sourceRepository: string;
|
|
21
|
-
runtime: "python3.13" | "node22" | "node24";
|
|
22
|
-
rootDirectory: string | null;
|
|
23
|
-
buildCommand: string | null;
|
|
24
|
-
buildOutputDir: string | null;
|
|
25
|
-
installCommand: string | null;
|
|
26
|
-
startCommand: string | null;
|
|
27
|
-
productionEnvironment: Environment | null;
|
|
28
|
-
environments: Environment[];
|
|
29
|
-
createdAt: Date;
|
|
30
|
-
}
|
package/dist/types/api.js
DELETED
package/dist/types/api.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/types/api.ts"],"names":[],"mappings":""}
|