@kargobuild/kargo 0.7.0 → 0.8.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.
Files changed (3) hide show
  1. package/README.md +130 -0
  2. package/bin/kargo.js +105 -105
  3. package/package.json +6 -6
package/README.md ADDED
@@ -0,0 +1,130 @@
1
+ # Kargo
2
+
3
+ A fast, modern build and dependency management tool for Kotlin, written in Rust.
4
+
5
+ Inspired by [Cargo](https://doc.rust-lang.org/cargo/), Kargo replaces Gradle's
6
+ complexity with a single declarative `Kargo.toml` manifest while staying fully
7
+ compatible with the Maven ecosystem.
8
+
9
+ **[Documentation](https://kargo.build/)** ·
10
+ [Getting Started](https://kargo.build/getting-started/installation.html) ·
11
+ [Commands](https://kargo.build/reference/commands.html) ·
12
+ [Status](https://kargo.build/status.html) ·
13
+ [GitHub](https://github.com/kargobuild/kargo)
14
+
15
+ > **Status:** Pre-1.0 and under active development. Project scaffolding,
16
+ > toolchain management, Maven resolution, and JVM compilation work today;
17
+ > multiplatform builds, flavors, linting, and publishing are in progress. The
18
+ > [Implementation Status](https://kargo.build/status.html) page tracks every
19
+ > feature.
20
+
21
+ ## Install
22
+
23
+ ```sh
24
+ npm i -g @kargobuild/kargo
25
+ kargo --version
26
+ ```
27
+
28
+ Or without installing:
29
+
30
+ ```sh
31
+ npx @kargobuild/kargo new hello
32
+ ```
33
+
34
+ This package contains no binary of its own. It declares one
35
+ `optionalDependencies` entry per platform, each tagged with `os` and `cpu`, so
36
+ npm installs the one matching your machine and skips the rest:
37
+
38
+ | Host | Package |
39
+ |---|---|
40
+ | Linux, x86-64 | `@kargobuild/kargo-linux-x64` |
41
+ | Linux, ARM64 | `@kargobuild/kargo-linux-arm64` |
42
+ | macOS, Apple silicon | `@kargobuild/kargo-darwin-arm64` |
43
+ | macOS, Intel | `@kargobuild/kargo-darwin-x64` |
44
+ | Windows, x86-64 | `@kargobuild/kargo-win32-x64` |
45
+
46
+ Two things to know about this channel specifically:
47
+
48
+ - **`kargo` starts through Node here.** What lands on your `PATH` is a small
49
+ launcher that execs the native binary, costing tens of milliseconds per
50
+ invocation that a direct install does not. For a command you run all day,
51
+ prefer the [prebuilt
52
+ archive](https://kargo.build/getting-started/installation.html).
53
+ - **`--omit=optional` breaks it**, since it skips the platform package. musl
54
+ systems, Alpine included, are not covered either: the Linux packages declare
55
+ `"libc": ["glibc"]`.
56
+
57
+ Update with `npm i -g @kargobuild/kargo@latest` rather than `kargo self update`,
58
+ which would replace the binary inside the platform package and be overwritten by
59
+ the next `npm install`.
60
+
61
+ ## Why Kargo
62
+
63
+ | | Gradle | Kargo |
64
+ |---|--------|-------|
65
+ | **Config** | Kotlin/Groovy DSL scripts | Declarative TOML |
66
+ | **Startup** | JVM boot + script compilation | Native binary, no configuration phase |
67
+ | **Toolchain** | You install Kotlin and the JDK | Auto-downloaded and pinned per project |
68
+ | **Deps** | Maven repos via custom resolution | Maven repos via standard protocol |
69
+ | **KMP** | First-class, plugin-configured | First-class, declared in the manifest |
70
+ | **Compose** | Plugin | Built in |
71
+ | **Flavors** | Android-only | Every target |
72
+ | **Lint & format** | Third-party plugins | Built in |
73
+
74
+ ## Kargo.toml
75
+
76
+ ```toml
77
+ [package]
78
+ name = "my-app"
79
+ group = "com.example"
80
+ version = "0.1.0"
81
+ kotlin = "2.4.21"
82
+ main-class = "com.example.MainKt"
83
+
84
+ [targets.jvm]
85
+ java-target = "25"
86
+
87
+ [dependencies]
88
+ kotlinx-coroutines-core = "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.0"
89
+
90
+ [dev-dependencies]
91
+ kotlin-test = "org.jetbrains.kotlin:kotlin-test:2.4.21"
92
+ ```
93
+
94
+ ## Templates
95
+
96
+ ```sh
97
+ kargo new my-app # JVM application (default)
98
+ kargo new my-lib --template lib # JVM library
99
+ kargo new my-kmp --template kmp # Kotlin Multiplatform (JVM + iOS)
100
+ kargo new my-cmp --template cmp # Compose Multiplatform
101
+ kargo new my-droid --template android # Android
102
+ ```
103
+
104
+ ## Common commands
105
+
106
+ ```sh
107
+ kargo build --release # build
108
+ kargo test --filter MyTest # test
109
+ kargo check # type-check only
110
+ kargo tree --why some-dep # why is this dependency here?
111
+ kargo audit # scan for known vulnerabilities
112
+ kargo toolchain list # manage Kotlin versions
113
+ ```
114
+
115
+ Full details in the [Command
116
+ Reference](https://kargo.build/reference/commands.html).
117
+
118
+ ## Contributing
119
+
120
+ Issues and pull requests are welcome at
121
+ [kargobuild/kargo](https://github.com/kargobuild/kargo). The
122
+ [contributor guide](https://kargo.build/contributing/index.html) covers the
123
+ layout, the conventions and how the tests are organised.
124
+
125
+ ## License
126
+
127
+ Dual-licensed under
128
+ [MIT](https://github.com/kargobuild/kargo/blob/main/LICENSE-MIT) or
129
+ [Apache-2.0](https://github.com/kargobuild/kargo/blob/main/LICENSE-APACHE), at
130
+ your option.
package/bin/kargo.js CHANGED
@@ -1,105 +1,105 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
-
4
- const { spawn } = require("node:child_process");
5
- const { constants } = require("node:os");
6
-
7
- const PACKAGES = {
8
- "darwin arm64": "@kargobuild/kargo-darwin-arm64",
9
- "darwin x64": "@kargobuild/kargo-darwin-x64",
10
- "linux arm64": "@kargobuild/kargo-linux-arm64",
11
- "linux x64": "@kargobuild/kargo-linux-x64",
12
- "win32 x64": "@kargobuild/kargo-win32-x64",
13
- };
14
-
15
- // crates/kargo-cli/src/signals.rs handles SIGTERM and nothing else, so a
16
- // supervisor's stop request has to reach the binary rather than stop here.
17
- const FORWARDED = ["SIGINT", "SIGTERM", "SIGHUP", "SIGBREAK"].filter(
18
- (signal) => signal in constants.signals
19
- );
20
-
21
- function fail(message) {
22
- process.stderr.write(`kargo: ${message}\n`);
23
- process.exit(1);
24
- }
25
-
26
- function resolveBinary() {
27
- const host = `${process.platform} ${process.arch}`;
28
- const pkg = PACKAGES[host];
29
-
30
- if (pkg === undefined) {
31
- fail(
32
- `no prebuilt binary for ${host}.\n` +
33
- " Supported: " +
34
- Object.keys(PACKAGES).join(", ") +
35
- ".\n" +
36
- " Build from source instead: https://kargo.build/getting-started/installation.html"
37
- );
38
- }
39
-
40
- const exe = process.platform === "win32" ? "kargo.exe" : "kargo";
41
- let binary;
42
- let found;
43
- try {
44
- binary = require.resolve(`${pkg}/bin/${exe}`);
45
- found = require(`${pkg}/package.json`).version;
46
- } catch {
47
- fail(
48
- `${pkg} is not installed.\n` +
49
- " It is an optional dependency, so --no-optional and --omit=optional skip it.\n" +
50
- " Reinstall with optional dependencies enabled, or install the binary directly:\n" +
51
- " https://kargo.build/getting-started/installation.html"
52
- );
53
- }
54
-
55
- // Node resolves by walking up node_modules, so a hoisted copy from another
56
- // install can answer instead of the pinned optional dependency.
57
- const expected = require("../package.json").version;
58
- if (found !== expected) {
59
- fail(
60
- `${pkg} is ${found}, but this launcher is ${expected}.\n` +
61
- ` Resolved: ${binary}\n` +
62
- " A copy from another install is shadowing the pinned one. Reinstall\n" +
63
- " @kargobuild/kargo, or deduplicate the tree with `npm dedupe`."
64
- );
65
- }
66
-
67
- return binary;
68
- }
69
-
70
- const child = spawn(resolveBinary(), process.argv.slice(2), { stdio: "inherit" });
71
-
72
- for (const signal of FORWARDED) {
73
- process.on(signal, () => {
74
- if (child.exitCode === null && child.signalCode === null) {
75
- try {
76
- child.kill(signal);
77
- } catch {
78
- // The child can exit between that check and here, and Windows rejects
79
- // console signals it cannot deliver. Keep waiting for it either way.
80
- }
81
- }
82
- });
83
- }
84
-
85
- child.on("error", (error) => fail(error.message));
86
-
87
- child.on("exit", (code, signal) => {
88
- for (const forwarded of FORWARDED) {
89
- process.removeAllListeners(forwarded);
90
- }
91
-
92
- // Exiting 1 on a signal would make Ctrl+C read as a build failure to whatever
93
- // is watching the status, and would lose which signal stopped the build.
94
- if (signal) {
95
- process.kill(process.pid, signal);
96
-
97
- // Re-raising is only fatal while the disposition still is, and Node ignores
98
- // some signals with no way to reset that from JS. Returning here would then
99
- // drain the loop and exit 0, reporting a signalled build as a success.
100
- const number = constants.signals[signal];
101
- process.exit(number === undefined ? 1 : 128 + number);
102
- }
103
-
104
- process.exit(code === null ? 1 : code);
105
- });
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const { spawn } = require("node:child_process");
5
+ const { constants } = require("node:os");
6
+
7
+ const PACKAGES = {
8
+ "darwin arm64": "@kargobuild/kargo-darwin-arm64",
9
+ "darwin x64": "@kargobuild/kargo-darwin-x64",
10
+ "linux arm64": "@kargobuild/kargo-linux-arm64",
11
+ "linux x64": "@kargobuild/kargo-linux-x64",
12
+ "win32 x64": "@kargobuild/kargo-win32-x64",
13
+ };
14
+
15
+ // crates/kargo-cli/src/signals.rs handles SIGTERM and nothing else, so a
16
+ // supervisor's stop request has to reach the binary rather than stop here.
17
+ const FORWARDED = ["SIGINT", "SIGTERM", "SIGHUP", "SIGBREAK"].filter(
18
+ (signal) => signal in constants.signals
19
+ );
20
+
21
+ function fail(message) {
22
+ process.stderr.write(`kargo: ${message}\n`);
23
+ process.exit(1);
24
+ }
25
+
26
+ function resolveBinary() {
27
+ const host = `${process.platform} ${process.arch}`;
28
+ const pkg = PACKAGES[host];
29
+
30
+ if (pkg === undefined) {
31
+ fail(
32
+ `no prebuilt binary for ${host}.\n` +
33
+ " Supported: " +
34
+ Object.keys(PACKAGES).join(", ") +
35
+ ".\n" +
36
+ " Build from source instead: https://kargo.build/getting-started/installation.html"
37
+ );
38
+ }
39
+
40
+ const exe = process.platform === "win32" ? "kargo.exe" : "kargo";
41
+ let binary;
42
+ let found;
43
+ try {
44
+ binary = require.resolve(`${pkg}/bin/${exe}`);
45
+ found = require(`${pkg}/package.json`).version;
46
+ } catch {
47
+ fail(
48
+ `${pkg} is not installed.\n` +
49
+ " It is an optional dependency, so --no-optional and --omit=optional skip it.\n" +
50
+ " Reinstall with optional dependencies enabled, or install the binary directly:\n" +
51
+ " https://kargo.build/getting-started/installation.html"
52
+ );
53
+ }
54
+
55
+ // Node resolves by walking up node_modules, so a hoisted copy from another
56
+ // install can answer instead of the pinned optional dependency.
57
+ const expected = require("../package.json").version;
58
+ if (found !== expected) {
59
+ fail(
60
+ `${pkg} is ${found}, but this launcher is ${expected}.\n` +
61
+ ` Resolved: ${binary}\n` +
62
+ " A copy from another install is shadowing the pinned one. Reinstall\n" +
63
+ " @kargobuild/kargo, or deduplicate the tree with `npm dedupe`."
64
+ );
65
+ }
66
+
67
+ return binary;
68
+ }
69
+
70
+ const child = spawn(resolveBinary(), process.argv.slice(2), { stdio: "inherit" });
71
+
72
+ for (const signal of FORWARDED) {
73
+ process.on(signal, () => {
74
+ if (child.exitCode === null && child.signalCode === null) {
75
+ try {
76
+ child.kill(signal);
77
+ } catch {
78
+ // The child can exit between that check and here, and Windows rejects
79
+ // console signals it cannot deliver. Keep waiting for it either way.
80
+ }
81
+ }
82
+ });
83
+ }
84
+
85
+ child.on("error", (error) => fail(error.message));
86
+
87
+ child.on("exit", (code, signal) => {
88
+ for (const forwarded of FORWARDED) {
89
+ process.removeAllListeners(forwarded);
90
+ }
91
+
92
+ // Exiting 1 on a signal would make Ctrl+C read as a build failure to whatever
93
+ // is watching the status, and would lose which signal stopped the build.
94
+ if (signal) {
95
+ process.kill(process.pid, signal);
96
+
97
+ // Re-raising is only fatal while the disposition still is, and Node ignores
98
+ // some signals with no way to reset that from JS. Returning here would then
99
+ // drain the loop and exit 0, reporting a signalled build as a success.
100
+ const number = constants.signals[signal];
101
+ process.exit(number === undefined ? 1 : 128 + number);
102
+ }
103
+
104
+ process.exit(code === null ? 1 : code);
105
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kargobuild/kargo",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "A fast, modern build and dependency management tool for Kotlin, written in Rust.",
5
5
  "keywords": [
6
6
  "kotlin",
@@ -28,10 +28,10 @@
28
28
  "node": ">=18"
29
29
  },
30
30
  "optionalDependencies": {
31
- "@kargobuild/kargo-darwin-arm64": "0.7.0",
32
- "@kargobuild/kargo-darwin-x64": "0.7.0",
33
- "@kargobuild/kargo-linux-arm64": "0.7.0",
34
- "@kargobuild/kargo-linux-x64": "0.7.0",
35
- "@kargobuild/kargo-win32-x64": "0.7.0"
31
+ "@kargobuild/kargo-darwin-arm64": "0.8.0",
32
+ "@kargobuild/kargo-darwin-x64": "0.8.0",
33
+ "@kargobuild/kargo-linux-arm64": "0.8.0",
34
+ "@kargobuild/kargo-linux-x64": "0.8.0",
35
+ "@kargobuild/kargo-win32-x64": "0.8.0"
36
36
  }
37
37
  }