@insforge/cli 0.1.38 → 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 +127 -7
- 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);
|
|
@@ -2713,6 +2739,83 @@ function registerDeploymentsCancelCommand(deploymentsCmd2) {
|
|
|
2713
2739
|
});
|
|
2714
2740
|
}
|
|
2715
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
|
+
|
|
2716
2819
|
// src/commands/docs.ts
|
|
2717
2820
|
var FEATURES = ["db", "storage", "functions", "auth", "ai", "realtime"];
|
|
2718
2821
|
var LANGUAGES = ["typescript", "swift", "kotlin", "rest-api"];
|
|
@@ -3155,10 +3258,18 @@ function registerSchedulesLogsCommand(schedulesCmd2) {
|
|
|
3155
3258
|
}
|
|
3156
3259
|
|
|
3157
3260
|
// src/commands/logs.ts
|
|
3158
|
-
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"];
|
|
3159
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
|
+
}
|
|
3160
3271
|
function registerLogsCommand(program2) {
|
|
3161
|
-
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) => {
|
|
3162
3273
|
const { json } = getRootOpts(cmd);
|
|
3163
3274
|
try {
|
|
3164
3275
|
await requireAuth();
|
|
@@ -3167,7 +3278,7 @@ function registerLogsCommand(program2) {
|
|
|
3167
3278
|
throw new CLIError(`Invalid log source "${source}". Valid sources: ${VALID_SOURCES.join(", ")}`);
|
|
3168
3279
|
}
|
|
3169
3280
|
const limit = parseInt(opts.limit, 10) || 20;
|
|
3170
|
-
const res = await ossFetch(
|
|
3281
|
+
const res = await ossFetch(getLogPath(resolved, limit));
|
|
3171
3282
|
const data = await res.json();
|
|
3172
3283
|
if (json) {
|
|
3173
3284
|
outputJson(data);
|
|
@@ -3644,8 +3755,11 @@ function registerDiagnoseDbCommand(diagnoseCmd2) {
|
|
|
3644
3755
|
}
|
|
3645
3756
|
|
|
3646
3757
|
// src/commands/diagnose/logs.ts
|
|
3647
|
-
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"];
|
|
3648
3759
|
var ERROR_PATTERN = /\b(error|fatal|panic)\b/i;
|
|
3760
|
+
var SOURCE_PATH2 = {
|
|
3761
|
+
"function-deploy.logs": "/api/logs/functions/build-logs"
|
|
3762
|
+
};
|
|
3649
3763
|
function parseLogEntry(entry) {
|
|
3650
3764
|
if (typeof entry === "string") {
|
|
3651
3765
|
return { ts: "", msg: entry };
|
|
@@ -3655,8 +3769,13 @@ function parseLogEntry(entry) {
|
|
|
3655
3769
|
const msg = String(e.message ?? e.msg ?? e.log ?? JSON.stringify(e));
|
|
3656
3770
|
return { ts, msg };
|
|
3657
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
|
+
}
|
|
3658
3777
|
async function fetchSourceLogs(source, limit) {
|
|
3659
|
-
const res = await ossFetch(
|
|
3778
|
+
const res = await ossFetch(getLogPath2(source, limit));
|
|
3660
3779
|
const data = await res.json();
|
|
3661
3780
|
const logs = Array.isArray(data) ? data : data.logs ?? [];
|
|
3662
3781
|
const errors = [];
|
|
@@ -3926,6 +4045,7 @@ registerDeploymentsDeployCommand(deploymentsCmd);
|
|
|
3926
4045
|
registerDeploymentsListCommand(deploymentsCmd);
|
|
3927
4046
|
registerDeploymentsStatusCommand(deploymentsCmd);
|
|
3928
4047
|
registerDeploymentsCancelCommand(deploymentsCmd);
|
|
4048
|
+
registerDeploymentsEnvVarsCommand(deploymentsCmd);
|
|
3929
4049
|
var secretsCmd = program.command("secrets").description("Manage secrets");
|
|
3930
4050
|
registerSecretsListCommand(secretsCmd);
|
|
3931
4051
|
registerSecretsGetCommand(secretsCmd);
|