@insforge/cli 0.1.37 → 0.1.39
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/index.js +146 -10
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -456,6 +456,21 @@ async function getProjectApiKey(projectId, apiUrl) {
|
|
|
456
456
|
const data = await res.json();
|
|
457
457
|
return data.access_api_key;
|
|
458
458
|
}
|
|
459
|
+
async function reportAgentConnected(payload, apiUrl) {
|
|
460
|
+
const baseUrl = getPlatformApiUrl(apiUrl);
|
|
461
|
+
const headers = {
|
|
462
|
+
"Content-Type": "application/json"
|
|
463
|
+
};
|
|
464
|
+
const token = getAccessToken();
|
|
465
|
+
if (token) {
|
|
466
|
+
headers.Authorization = `Bearer ${token}`;
|
|
467
|
+
}
|
|
468
|
+
await fetch(`${baseUrl}/tracking/v1/agent-connected`, {
|
|
469
|
+
method: "POST",
|
|
470
|
+
headers,
|
|
471
|
+
body: JSON.stringify(payload)
|
|
472
|
+
});
|
|
473
|
+
}
|
|
459
474
|
async function createProject(orgId, name, region, apiUrl) {
|
|
460
475
|
const body = { name };
|
|
461
476
|
if (region) body.region = region;
|
|
@@ -720,13 +735,13 @@ ${missing.join("\n")}
|
|
|
720
735
|
async function installSkills(json) {
|
|
721
736
|
try {
|
|
722
737
|
if (!json) clack5.log.info("Installing InsForge agent skills...");
|
|
723
|
-
await execAsync("npx skills add insforge/agent-skills -y -
|
|
738
|
+
await execAsync("npx skills add insforge/agent-skills -y -a antigravity -a augment -a claude-code -a cline -a codex -a cursor -a gemini-cli -a github-copilot -a kilo -a qoder -a qwen-code -a roo -a trae -a windsurf", {
|
|
724
739
|
cwd: process.cwd(),
|
|
725
740
|
timeout: 6e4
|
|
726
741
|
});
|
|
727
742
|
if (!json) clack5.log.success("InsForge agent skills installed.");
|
|
728
743
|
} catch {
|
|
729
|
-
if (!json) clack5.log.warn("Failed to install agent skills. You can run manually: npx skills add insforge/agent-skills
|
|
744
|
+
if (!json) clack5.log.warn("Failed to install agent skills. You can run manually: npx skills add insforge/agent-skills");
|
|
730
745
|
}
|
|
731
746
|
try {
|
|
732
747
|
if (!json) clack5.log.info("Installing find-skills...");
|
|
@@ -818,6 +833,13 @@ function registerProjectLinkCommand(program2) {
|
|
|
818
833
|
}
|
|
819
834
|
await installSkills(json);
|
|
820
835
|
await reportCliUsage("cli.link_direct", true, 6);
|
|
836
|
+
try {
|
|
837
|
+
const urlMatch = opts.apiBaseUrl.match(/^https?:\/\/([^.]+)\.[^.]+\.insforge\.app/);
|
|
838
|
+
if (urlMatch) {
|
|
839
|
+
await reportAgentConnected({ app_key: urlMatch[1] }, apiUrl);
|
|
840
|
+
}
|
|
841
|
+
} catch {
|
|
842
|
+
}
|
|
821
843
|
return;
|
|
822
844
|
} catch (err) {
|
|
823
845
|
await reportCliUsage("cli.link_direct", false);
|
|
@@ -901,6 +923,10 @@ function registerProjectLinkCommand(program2) {
|
|
|
901
923
|
}
|
|
902
924
|
await installSkills(json);
|
|
903
925
|
await reportCliUsage("cli.link", true, 6);
|
|
926
|
+
try {
|
|
927
|
+
await reportAgentConnected({ project_id: project.id }, apiUrl);
|
|
928
|
+
} catch {
|
|
929
|
+
}
|
|
904
930
|
} catch (err) {
|
|
905
931
|
await reportCliUsage("cli.link", false);
|
|
906
932
|
handleError(err, json);
|
|
@@ -1901,7 +1927,7 @@ import * as fs2 from "fs/promises";
|
|
|
1901
1927
|
import * as clack9 from "@clack/prompts";
|
|
1902
1928
|
import archiver from "archiver";
|
|
1903
1929
|
var POLL_INTERVAL_MS = 5e3;
|
|
1904
|
-
var POLL_TIMEOUT_MS =
|
|
1930
|
+
var POLL_TIMEOUT_MS = 3e5;
|
|
1905
1931
|
var EXCLUDE_PATTERNS = [
|
|
1906
1932
|
"node_modules",
|
|
1907
1933
|
".git",
|
|
@@ -1911,7 +1937,23 @@ var EXCLUDE_PATTERNS = [
|
|
|
1911
1937
|
"dist",
|
|
1912
1938
|
"build",
|
|
1913
1939
|
".DS_Store",
|
|
1914
|
-
".insforge"
|
|
1940
|
+
".insforge",
|
|
1941
|
+
// IDE and AI agent configs
|
|
1942
|
+
".claude",
|
|
1943
|
+
".agents",
|
|
1944
|
+
".augment",
|
|
1945
|
+
".kilocode",
|
|
1946
|
+
".kiro",
|
|
1947
|
+
".qoder",
|
|
1948
|
+
".qwen",
|
|
1949
|
+
".roo",
|
|
1950
|
+
".trae",
|
|
1951
|
+
".windsurf",
|
|
1952
|
+
".vercel",
|
|
1953
|
+
".turbo",
|
|
1954
|
+
".cache",
|
|
1955
|
+
"skills",
|
|
1956
|
+
"coverage"
|
|
1915
1957
|
];
|
|
1916
1958
|
function shouldExclude(name) {
|
|
1917
1959
|
const normalized = name.replace(/\\/g, "/");
|
|
@@ -2041,7 +2083,7 @@ function registerDeploymentsDeployCommand(deploymentsCmd2) {
|
|
|
2041
2083
|
outputJson({ id: result.deploymentId, status: result.deployment?.status ?? "building", timedOut: true });
|
|
2042
2084
|
} else {
|
|
2043
2085
|
clack9.log.info(`Deployment ID: ${result.deploymentId}`);
|
|
2044
|
-
clack9.log.warn("Deployment did not finish within
|
|
2086
|
+
clack9.log.warn("Deployment did not finish within 5 minutes.");
|
|
2045
2087
|
clack9.log.info(`Check status with: npx @insforge/cli deployments status ${result.deploymentId}`);
|
|
2046
2088
|
}
|
|
2047
2089
|
}
|
|
@@ -2697,6 +2739,83 @@ function registerDeploymentsCancelCommand(deploymentsCmd2) {
|
|
|
2697
2739
|
});
|
|
2698
2740
|
}
|
|
2699
2741
|
|
|
2742
|
+
// src/commands/deployments/env-vars.ts
|
|
2743
|
+
function registerDeploymentsEnvVarsCommand(deploymentsCmd2) {
|
|
2744
|
+
const envCmd = deploymentsCmd2.command("env").description("Manage deployment environment variables");
|
|
2745
|
+
envCmd.command("list").description("List all deployment environment variables").action(async (_opts, cmd) => {
|
|
2746
|
+
const { json } = getRootOpts(cmd);
|
|
2747
|
+
try {
|
|
2748
|
+
await requireAuth();
|
|
2749
|
+
if (!getProjectConfig()) throw new ProjectNotLinkedError();
|
|
2750
|
+
const res = await ossFetch("/api/deployments/env-vars");
|
|
2751
|
+
const data = await res.json();
|
|
2752
|
+
const envVars = data.envVars ?? [];
|
|
2753
|
+
if (json) {
|
|
2754
|
+
outputJson(data);
|
|
2755
|
+
} else {
|
|
2756
|
+
if (!envVars.length) {
|
|
2757
|
+
console.log("No environment variables found.");
|
|
2758
|
+
return;
|
|
2759
|
+
}
|
|
2760
|
+
outputTable(
|
|
2761
|
+
["ID", "Key", "Type", "Updated At"],
|
|
2762
|
+
envVars.map((v) => [
|
|
2763
|
+
v.id,
|
|
2764
|
+
v.key,
|
|
2765
|
+
v.type,
|
|
2766
|
+
new Date(v.updatedAt).toLocaleString()
|
|
2767
|
+
])
|
|
2768
|
+
);
|
|
2769
|
+
}
|
|
2770
|
+
await reportCliUsage("cli.deployments.env.list", true);
|
|
2771
|
+
} catch (err) {
|
|
2772
|
+
await reportCliUsage("cli.deployments.env.list", false);
|
|
2773
|
+
handleError(err, json);
|
|
2774
|
+
}
|
|
2775
|
+
});
|
|
2776
|
+
envCmd.command("set <key> <value>").description("Create or update a deployment environment variable").action(async (key, value, _opts, cmd) => {
|
|
2777
|
+
const { json } = getRootOpts(cmd);
|
|
2778
|
+
try {
|
|
2779
|
+
await requireAuth();
|
|
2780
|
+
if (!getProjectConfig()) throw new ProjectNotLinkedError();
|
|
2781
|
+
const res = await ossFetch("/api/deployments/env-vars", {
|
|
2782
|
+
method: "POST",
|
|
2783
|
+
body: JSON.stringify({ envVars: [{ key, value }] })
|
|
2784
|
+
});
|
|
2785
|
+
const data = await res.json();
|
|
2786
|
+
if (json) {
|
|
2787
|
+
outputJson(data);
|
|
2788
|
+
} else {
|
|
2789
|
+
outputSuccess(data.message);
|
|
2790
|
+
}
|
|
2791
|
+
await reportCliUsage("cli.deployments.env.set", true);
|
|
2792
|
+
} catch (err) {
|
|
2793
|
+
await reportCliUsage("cli.deployments.env.set", false);
|
|
2794
|
+
handleError(err, json);
|
|
2795
|
+
}
|
|
2796
|
+
});
|
|
2797
|
+
envCmd.command("delete <id>").description("Delete a deployment environment variable by ID").action(async (id, _opts, cmd) => {
|
|
2798
|
+
const { json } = getRootOpts(cmd);
|
|
2799
|
+
try {
|
|
2800
|
+
await requireAuth();
|
|
2801
|
+
if (!getProjectConfig()) throw new ProjectNotLinkedError();
|
|
2802
|
+
const res = await ossFetch(`/api/deployments/env-vars/${encodeURIComponent(id)}`, {
|
|
2803
|
+
method: "DELETE"
|
|
2804
|
+
});
|
|
2805
|
+
const data = await res.json();
|
|
2806
|
+
if (json) {
|
|
2807
|
+
outputJson(data);
|
|
2808
|
+
} else {
|
|
2809
|
+
outputSuccess(data.message);
|
|
2810
|
+
}
|
|
2811
|
+
await reportCliUsage("cli.deployments.env.delete", true);
|
|
2812
|
+
} catch (err) {
|
|
2813
|
+
await reportCliUsage("cli.deployments.env.delete", false);
|
|
2814
|
+
handleError(err, json);
|
|
2815
|
+
}
|
|
2816
|
+
});
|
|
2817
|
+
}
|
|
2818
|
+
|
|
2700
2819
|
// src/commands/docs.ts
|
|
2701
2820
|
var FEATURES = ["db", "storage", "functions", "auth", "ai", "realtime"];
|
|
2702
2821
|
var LANGUAGES = ["typescript", "swift", "kotlin", "rest-api"];
|
|
@@ -3139,10 +3258,18 @@ function registerSchedulesLogsCommand(schedulesCmd2) {
|
|
|
3139
3258
|
}
|
|
3140
3259
|
|
|
3141
3260
|
// src/commands/logs.ts
|
|
3142
|
-
var VALID_SOURCES = ["insforge.logs", "postgREST.logs", "postgres.logs", "function.logs"];
|
|
3261
|
+
var VALID_SOURCES = ["insforge.logs", "postgREST.logs", "postgres.logs", "function.logs", "function-deploy.logs"];
|
|
3143
3262
|
var SOURCE_LOOKUP = new Map(VALID_SOURCES.map((s) => [s.toLowerCase(), s]));
|
|
3263
|
+
var SOURCE_PATH = {
|
|
3264
|
+
"function-deploy.logs": "/api/logs/functions/build-logs"
|
|
3265
|
+
};
|
|
3266
|
+
function getLogPath(source, limit) {
|
|
3267
|
+
const custom = SOURCE_PATH[source];
|
|
3268
|
+
if (custom) return `${custom}?limit=${limit}`;
|
|
3269
|
+
return `/api/logs/${encodeURIComponent(source)}?limit=${limit}`;
|
|
3270
|
+
}
|
|
3144
3271
|
function registerLogsCommand(program2) {
|
|
3145
|
-
program2.command("logs <source>").description("Fetch backend container logs (insforge.logs | postgREST.logs | postgres.logs | function.logs)").option("--limit <n>", "Number of log entries to return", "20").action(async (source, opts, cmd) => {
|
|
3272
|
+
program2.command("logs <source>").description("Fetch backend container logs (insforge.logs | postgREST.logs | postgres.logs | function.logs | function-deploy.logs)").option("--limit <n>", "Number of log entries to return", "20").action(async (source, opts, cmd) => {
|
|
3146
3273
|
const { json } = getRootOpts(cmd);
|
|
3147
3274
|
try {
|
|
3148
3275
|
await requireAuth();
|
|
@@ -3151,7 +3278,7 @@ function registerLogsCommand(program2) {
|
|
|
3151
3278
|
throw new CLIError(`Invalid log source "${source}". Valid sources: ${VALID_SOURCES.join(", ")}`);
|
|
3152
3279
|
}
|
|
3153
3280
|
const limit = parseInt(opts.limit, 10) || 20;
|
|
3154
|
-
const res = await ossFetch(
|
|
3281
|
+
const res = await ossFetch(getLogPath(resolved, limit));
|
|
3155
3282
|
const data = await res.json();
|
|
3156
3283
|
if (json) {
|
|
3157
3284
|
outputJson(data);
|
|
@@ -3628,8 +3755,11 @@ function registerDiagnoseDbCommand(diagnoseCmd2) {
|
|
|
3628
3755
|
}
|
|
3629
3756
|
|
|
3630
3757
|
// src/commands/diagnose/logs.ts
|
|
3631
|
-
var LOG_SOURCES = ["insforge.logs", "postgREST.logs", "postgres.logs", "function.logs"];
|
|
3758
|
+
var LOG_SOURCES = ["insforge.logs", "postgREST.logs", "postgres.logs", "function.logs", "function-deploy.logs"];
|
|
3632
3759
|
var ERROR_PATTERN = /\b(error|fatal|panic)\b/i;
|
|
3760
|
+
var SOURCE_PATH2 = {
|
|
3761
|
+
"function-deploy.logs": "/api/logs/functions/build-logs"
|
|
3762
|
+
};
|
|
3633
3763
|
function parseLogEntry(entry) {
|
|
3634
3764
|
if (typeof entry === "string") {
|
|
3635
3765
|
return { ts: "", msg: entry };
|
|
@@ -3639,8 +3769,13 @@ function parseLogEntry(entry) {
|
|
|
3639
3769
|
const msg = String(e.message ?? e.msg ?? e.log ?? JSON.stringify(e));
|
|
3640
3770
|
return { ts, msg };
|
|
3641
3771
|
}
|
|
3772
|
+
function getLogPath2(source, limit) {
|
|
3773
|
+
const custom = SOURCE_PATH2[source];
|
|
3774
|
+
if (custom) return `${custom}?limit=${limit}`;
|
|
3775
|
+
return `/api/logs/${encodeURIComponent(source)}?limit=${limit}`;
|
|
3776
|
+
}
|
|
3642
3777
|
async function fetchSourceLogs(source, limit) {
|
|
3643
|
-
const res = await ossFetch(
|
|
3778
|
+
const res = await ossFetch(getLogPath2(source, limit));
|
|
3644
3779
|
const data = await res.json();
|
|
3645
3780
|
const logs = Array.isArray(data) ? data : data.logs ?? [];
|
|
3646
3781
|
const errors = [];
|
|
@@ -3910,6 +4045,7 @@ registerDeploymentsDeployCommand(deploymentsCmd);
|
|
|
3910
4045
|
registerDeploymentsListCommand(deploymentsCmd);
|
|
3911
4046
|
registerDeploymentsStatusCommand(deploymentsCmd);
|
|
3912
4047
|
registerDeploymentsCancelCommand(deploymentsCmd);
|
|
4048
|
+
registerDeploymentsEnvVarsCommand(deploymentsCmd);
|
|
3913
4049
|
var secretsCmd = program.command("secrets").description("Manage secrets");
|
|
3914
4050
|
registerSecretsListCommand(secretsCmd);
|
|
3915
4051
|
registerSecretsGetCommand(secretsCmd);
|