@nomac/cli 0.1.2 → 0.2.0
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/package.json +1 -1
- package/src/cli.mjs +47 -4
- package/src/config.mjs +1 -1
package/package.json
CHANGED
package/src/cli.mjs
CHANGED
|
@@ -50,7 +50,12 @@ export async function main(argv) {
|
|
|
50
50
|
}
|
|
51
51
|
case "whoami": {
|
|
52
52
|
const me = await api("GET", "/api/v1/me");
|
|
53
|
-
|
|
53
|
+
const o = me.org ?? {};
|
|
54
|
+
console.log(`org: ${o.name ?? "?"} (${o.id ?? "?"})`);
|
|
55
|
+
console.log(`plan: ${o.tier ?? "?"}`);
|
|
56
|
+
console.log(`projects: ${me.projects ?? 0}`);
|
|
57
|
+
console.log(`connections: ${me.connections ?? 0}`);
|
|
58
|
+
console.log(`auth: ${me.auth?.via ?? "?"}${me.auth?.key_id ? ` (${me.auth.key_id})` : ""}`);
|
|
54
59
|
return;
|
|
55
60
|
}
|
|
56
61
|
case undefined:
|
|
@@ -79,14 +84,52 @@ async function push() {
|
|
|
79
84
|
console.log("packing working tree (respecting .gitignore, secrets excluded)…");
|
|
80
85
|
const { tarball, files } = await packTarball(process.cwd());
|
|
81
86
|
console.log(`${files.length} files, ${(tarball.length / 1024).toFixed(0)} KB compressed`);
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
87
|
+
|
|
88
|
+
// preferred: direct-to-storage upload (no ~4MB API body limit), then confirm.
|
|
89
|
+
// Servers without the uploads route get the legacy inline body instead.
|
|
90
|
+
let grant = null;
|
|
91
|
+
try {
|
|
92
|
+
grant = await api("POST", `/api/v1/projects/${state.project_id}/snapshots/uploads`);
|
|
93
|
+
} catch {
|
|
94
|
+
grant = null;
|
|
95
|
+
}
|
|
96
|
+
let res;
|
|
97
|
+
if (grant) {
|
|
98
|
+
if (tarball.length > grant.max_bytes) {
|
|
99
|
+
throw new CliError(
|
|
100
|
+
"tarball too large",
|
|
101
|
+
`Packed source is ${(tarball.length / 1048576).toFixed(1)} MB; the limit is ${(grant.max_bytes / 1048576).toFixed(0)} MB. Check .gitignore: build artifacts are recreated on the build VM.`,
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
const up = await fetch(grant.upload_url, {
|
|
105
|
+
method: "PUT",
|
|
106
|
+
headers: { "content-type": "application/gzip" },
|
|
107
|
+
body: tarball,
|
|
108
|
+
});
|
|
109
|
+
if (!up.ok) throw new CliError(`upload failed (HTTP ${up.status})`);
|
|
110
|
+
res = await api("POST", `/api/v1/projects/${state.project_id}/snapshots`, {
|
|
111
|
+
body: { upload_key: grant.upload_key },
|
|
112
|
+
});
|
|
113
|
+
} else {
|
|
114
|
+
res = await api("POST", `/api/v1/projects/${state.project_id}/snapshots`, {
|
|
115
|
+
raw: tarball,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
85
118
|
console.log(`✅ snapshot ${res.snapshot_id} (commit ${res.commit.slice(0, 8)})`);
|
|
86
119
|
const d = res.detected ?? {};
|
|
87
120
|
console.log(
|
|
88
121
|
` detected: ${d.xcodeproj ?? "?"} · scheme ${d.scheme ?? "?"} · ${d.bundle_id ?? "no bundle id"}${d.marketing_version ? ` · v${d.marketing_version}` : ""}`,
|
|
89
122
|
);
|
|
123
|
+
if (res.lint) {
|
|
124
|
+
const icon = res.lint.grade === "green" ? "🟢" : res.lint.grade === "yellow" ? "🟡" : "🔴";
|
|
125
|
+
const n = res.lint.findings ?? 0;
|
|
126
|
+
console.log(
|
|
127
|
+
` review lint: ${icon} ${res.lint.grade}${n ? ` — ${n} finding${n === 1 ? "" : "s"}` : ""}`,
|
|
128
|
+
);
|
|
129
|
+
if (res.lint.grade === "red") {
|
|
130
|
+
console.log(" ⚠ red findings will block publish — fix them before `nomac build`/publish.");
|
|
131
|
+
}
|
|
132
|
+
}
|
|
90
133
|
if (res.warning) console.log(`⚠ ${res.warning}`);
|
|
91
134
|
saveProjectState({ ...state, last_snapshot: res.snapshot_id });
|
|
92
135
|
}
|
package/src/config.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { homedir } from "node:os";
|
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
|
|
5
5
|
export const DEFAULT_API_URL =
|
|
6
|
-
process.env.NOMAC_API_URL ?? "https://
|
|
6
|
+
process.env.NOMAC_API_URL ?? "https://nomac.app";
|
|
7
7
|
|
|
8
8
|
const CONFIG_DIR = join(homedir(), ".nomac");
|
|
9
9
|
const CREDENTIALS = join(CONFIG_DIR, "credentials.json");
|