oche-cli 0.1.0 → 0.1.2
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/LICENSE +21 -0
- package/README.md +3 -3
- package/dist/index.js +45 -7
- package/package.json +3 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Samso9th
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# oche-cli
|
|
2
2
|
|
|
3
|
-
`oche` from your terminal. It talks to your Oche server with a token you create in the dashboard under Settings → CLI tokens.
|
|
3
|
+
`oche` from your terminal. It talks to your Oche server with a token you create in the dashboard under Settings → CLI tokens. Self-hosting? Run `oche login https://your-server` once.
|
|
4
4
|
|
|
5
5
|
```sh
|
|
6
|
-
npm install
|
|
6
|
+
npm install -g oche-cli # installs the `oche` command
|
|
7
7
|
|
|
8
|
-
oche login
|
|
8
|
+
oche login # paste a CLI token from ship.oche.io/settings
|
|
9
9
|
oche ship # commit what's changed, push, then feature → dev → staging → main
|
|
10
10
|
oche ship staging # stop at staging
|
|
11
11
|
oche ship prod --direct # dev → main, then Oche syncs staging
|
package/dist/index.js
CHANGED
|
@@ -3371,8 +3371,9 @@ var program = new Command();
|
|
|
3371
3371
|
// package.json
|
|
3372
3372
|
var package_default = {
|
|
3373
3373
|
name: "oche-cli",
|
|
3374
|
-
version: "0.1.
|
|
3374
|
+
version: "0.1.2",
|
|
3375
3375
|
description: "Command-line client for Oche: promote dev \u2192 staging \u2192 main from your terminal.",
|
|
3376
|
+
license: "MIT",
|
|
3376
3377
|
repository: {
|
|
3377
3378
|
type: "git",
|
|
3378
3379
|
url: "git+https://github.com/Samso9th/oche-cli.git"
|
|
@@ -3470,6 +3471,38 @@ var Client = class {
|
|
|
3470
3471
|
commitMessage(body) {
|
|
3471
3472
|
return this.request("POST", "/v1/ai/commit-message", body, 9e4);
|
|
3472
3473
|
}
|
|
3474
|
+
/* ---- Coolify ---- */
|
|
3475
|
+
deployments(r) {
|
|
3476
|
+
return this.request("GET", `${repoPath(r)}/deployments`);
|
|
3477
|
+
}
|
|
3478
|
+
/** One deployment with its build log, the failure excerpt and a pasteable report. */
|
|
3479
|
+
deployment(r, app, deployment) {
|
|
3480
|
+
return this.request("GET", `${repoPath(r)}/deployments/${encodeURIComponent(app)}/${encodeURIComponent(deployment)}`);
|
|
3481
|
+
}
|
|
3482
|
+
/** The running container's log, not the build log. */
|
|
3483
|
+
appLogs(r, app, lines) {
|
|
3484
|
+
return this.request("GET", `${repoPath(r)}/apps/${encodeURIComponent(app)}/logs?lines=${lines}`);
|
|
3485
|
+
}
|
|
3486
|
+
/** The server asks its AI model what broke, so the CLI needs no AI key. */
|
|
3487
|
+
explainDeployment(r, app, deployment) {
|
|
3488
|
+
const path2 = `${repoPath(r)}/deployments/${encodeURIComponent(app)}/${encodeURIComponent(deployment)}/explain`;
|
|
3489
|
+
return this.request("POST", path2, void 0, 12e4);
|
|
3490
|
+
}
|
|
3491
|
+
deploy(r, app, force) {
|
|
3492
|
+
return this.request("POST", `${repoPath(r)}/apps/${encodeURIComponent(app)}/deploy`, { force });
|
|
3493
|
+
}
|
|
3494
|
+
rollbackOptions(r, app) {
|
|
3495
|
+
return this.request("GET", `${repoPath(r)}/apps/${encodeURIComponent(app)}/rollback`);
|
|
3496
|
+
}
|
|
3497
|
+
rollback(r, app, commit2) {
|
|
3498
|
+
return this.request("POST", `${repoPath(r)}/apps/${encodeURIComponent(app)}/rollback`, { commit: commit2 });
|
|
3499
|
+
}
|
|
3500
|
+
envs(r) {
|
|
3501
|
+
return this.request("GET", `${repoPath(r)}/envs`);
|
|
3502
|
+
}
|
|
3503
|
+
preflight(r, to) {
|
|
3504
|
+
return this.request("GET", `${repoPath(r)}/preflight?to=${to}`);
|
|
3505
|
+
}
|
|
3473
3506
|
events(repo, limit) {
|
|
3474
3507
|
const q = new URLSearchParams({ limit: String(limit) });
|
|
3475
3508
|
if (repo) q.set("repo", `${repo.owner}/${repo.repo}`);
|
|
@@ -3534,6 +3567,8 @@ function networkError(e, baseUrl, timeoutMs = TIMEOUT_MS) {
|
|
|
3534
3567
|
import { chmod, mkdir, readFile, rm, writeFile } from "fs/promises";
|
|
3535
3568
|
import { homedir } from "os";
|
|
3536
3569
|
import { dirname, join } from "path";
|
|
3570
|
+
var DEFAULT_SERVER_URL = "https://deploy.oche.io";
|
|
3571
|
+
var DEFAULT_TOKEN_PAGE = "https://ship.oche.io/settings";
|
|
3537
3572
|
function configPath(env = process.env) {
|
|
3538
3573
|
const base = env.XDG_CONFIG_HOME?.trim() || join(homedir(), ".config");
|
|
3539
3574
|
return join(base, "oche", "config.json");
|
|
@@ -4518,10 +4553,13 @@ function eventLines(events, showRepo) {
|
|
|
4518
4553
|
}
|
|
4519
4554
|
async function login(urlArg) {
|
|
4520
4555
|
const saved = await loadConfig().catch(() => null);
|
|
4521
|
-
const
|
|
4522
|
-
const
|
|
4523
|
-
|
|
4524
|
-
|
|
4556
|
+
const url = normalizeUrl(urlArg ?? process.env.OCHE_URL ?? saved?.url ?? DEFAULT_SERVER_URL);
|
|
4557
|
+
const where = url === DEFAULT_SERVER_URL ? DEFAULT_TOKEN_PAGE : "your Oche dashboard under Settings";
|
|
4558
|
+
process.stderr.write(`Logging in to ${c.bold(url)}
|
|
4559
|
+
`);
|
|
4560
|
+
process.stderr.write(c.dim(`Create a CLI token at ${where}, then paste it here.
|
|
4561
|
+
`));
|
|
4562
|
+
const token = await askHidden("CLI token");
|
|
4525
4563
|
if (!token) throw new CliError("No token entered.");
|
|
4526
4564
|
const me = await new Client(url, token, "config").me().catch((e) => {
|
|
4527
4565
|
if (e instanceof ApiRequestError && e.status === 401) {
|
|
@@ -4541,7 +4579,7 @@ async function logout() {
|
|
|
4541
4579
|
const saved = await loadConfig().catch(() => null);
|
|
4542
4580
|
if (await deleteConfig()) {
|
|
4543
4581
|
ok(`Logged out${saved?.url ? ` of ${saved.url}` : ""}.`);
|
|
4544
|
-
print(c.dim("The token keeps working until you revoke it in the dashboard (Settings \u2192
|
|
4582
|
+
print(c.dim("The token keeps working until you revoke it in the dashboard (Settings \u2192 CLI tokens)."));
|
|
4545
4583
|
} else {
|
|
4546
4584
|
print("Not logged in.");
|
|
4547
4585
|
}
|
|
@@ -4751,7 +4789,7 @@ function buildProgram() {
|
|
|
4751
4789
|
const program2 = new Command().name("oche").description("Promote dev \u2192 staging \u2192 main from your terminal.").version(package_default.version, "-v, --version").showSuggestionAfterError();
|
|
4752
4790
|
const repoArg = "[owner/repo]";
|
|
4753
4791
|
const repoHelp = "defaults to the GitHub repo of git remote origin";
|
|
4754
|
-
program2.command("login").description("
|
|
4792
|
+
program2.command("login").description("Sign in with a CLI token from the dashboard").argument("[url]", "Oche server URL (only if you self-host)").action(login);
|
|
4755
4793
|
program2.command("logout").description("Forget the saved login").action(logout);
|
|
4756
4794
|
program2.command("status").description("Branches, pending commits, promotion PRs and recent events").argument(repoArg, repoHelp).option("--json", "print raw JSON").action(status);
|
|
4757
4795
|
program2.command("repos").description("List repos, managed first").option("--json", "print raw JSON").action(repos);
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oche-cli",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Command-line client for Oche: promote dev → staging
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Command-line client for Oche: promote dev → staging → main from your terminal.",
|
|
5
|
+
"license": "MIT",
|
|
5
6
|
"repository": {
|
|
6
7
|
"type": "git",
|
|
7
8
|
"url": "git+https://github.com/Samso9th/oche-cli.git"
|