Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ my-dapp/

## Packages

| Package | Role |
| ------------------ | ------------------------------------------------------------------------------------------------------- |
| Package | Role |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `@caatinga/cli` | `caatinga` / `ctg` command — init, build, deploy, upgrade, dev, doctor, generate, invoke, read, status, migrate, rollback, estimate, inspect, wire, sync-env, smoke, regression, ci, identity, zk, version |
| `@caatinga/core` | Config, shell orchestration, Stellar CLI adapters, error catalog |
| `@caatinga/client` | Browser/Node contract client, wallet adapters, React hooks |
| `@caatinga/core` | Config, shell orchestration, Stellar CLI adapters, error catalog |
| `@caatinga/client` | Browser/Node contract client, wallet adapters, React hooks |

Full export map: [Packages](./docs/packages.md). Public errors use stable `CAATINGA_*` codes — see [Errors](./docs/errors.md).

Expand Down
5 changes: 1 addition & 4 deletions packages/cli/src/commands/identity.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ async function assertNoPathTraversal(archiveFile: string, targetDir: string): Pr
}

const resolvedEntry = path.resolve(resolvedTarget, entry);
if (
resolvedEntry !== resolvedTarget &&
!resolvedEntry.startsWith(resolvedTarget + path.sep)
) {
if (resolvedEntry !== resolvedTarget && !resolvedEntry.startsWith(resolvedTarget + path.sep)) {
throw new Error(
`Refusing to import archive: entry "${entry}" would extract outside ${resolvedTarget}`
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,7 @@ describe("buildGenerateNetworkArgs", () => {
it("defaults an unrecognized passphrase to --network localnet and adds --allow-http for http RPCs", () => {
expect(
buildGenerateNetworkArgs(
network(
"local",
"http://localhost:8000/soroban/rpc",
"Standalone Network ; February 2017"
)
network("local", "http://localhost:8000/soroban/rpc", "Standalone Network ; February 2017")
)
).toEqual([
"--network",
Expand Down
8 changes: 5 additions & 3 deletions packages/core/src/contracts/estimate-deploy-cost.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,12 @@ describe("estimateDeployCost", () => {
});

it("should_throw_ESTIMATE_FAILED_when_build_only_fails", async () => {
const original = new CaatingaError("build failed", CaatingaErrorCode.ESTIMATE_FAILED, "fix wasm");
runCommand.mockRejectedValue(
original
const original = new CaatingaError(
"build failed",
CaatingaErrorCode.ESTIMATE_FAILED,
"fix wasm"
);
runCommand.mockRejectedValue(original);

await expect(
estimateDeployCost({
Expand Down
7 changes: 3 additions & 4 deletions packages/core/src/contracts/estimate-deploy-cost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,9 @@ export async function estimateDeployCost(
resourceFeeStroops,
totalFeeStroops,
simulation,
advisory:
simulation.ok
? "Advisory estimate only — actual fees may differ under network congestion or contract complexity."
: "Fee estimate unavailable — simulation did not produce a parseable inclusion fee.",
advisory: simulation.ok
? "Advisory estimate only — actual fees may differ under network congestion or contract complexity."
: "Fee estimate unavailable — simulation did not produce a parseable inclusion fee.",
rawOutput,
};
}
6 changes: 3 additions & 3 deletions packages/core/src/contracts/wasm.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ describe("isMissingRustWasmTargetError", () => {
});

it("should_return_false_when_the_phrase_matches_but_the_target_is_not_named", () => {
expect(
isMissingRustWasmTargetError(buildFailure({ message: "linker `cc` not found" }))
).toBe(false);
expect(isMissingRustWasmTargetError(buildFailure({ message: "linker `cc` not found" }))).toBe(
false
);
});
});
49 changes: 47 additions & 2 deletions packages/core/src/shell/check-binary.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, expect, it, vi } from "vitest";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { CaatingaErrorCode } from "../errors/CaatingaError.js";

const runCommand = vi.hoisted(() => vi.fn());
Expand All @@ -10,13 +10,58 @@ vi.mock("./run-command.js", () => ({
import { checkBinary } from "./check-binary.js";

describe("checkBinary", () => {
beforeEach(() => {
runCommand.mockReset();
});

it("should_throw_RUST_NOT_FOUND_when_rustc_is_missing", async () => {
runCommand.mockRejectedValueOnce(new Error("not found"));

await expect(checkBinary("rustc", "hint")).rejects.toMatchObject({
code: CaatingaErrorCode.RUST_NOT_FOUND,
});

expect(runCommand).toHaveBeenCalledWith("rustc", ["--version"], {});
expect(runCommand).toHaveBeenCalledWith("rustc", ["--version"], {
skipStellarVersionCheck: undefined,
});
});

it("passes skipStellarVersionCheck: true when checking the stellar binary", async () => {
runCommand.mockResolvedValueOnce({
stdout: "stellar 25.2.0",
stderr: "",
all: "stellar 25.2.0",
});

await checkBinary("stellar", "hint");

expect(runCommand).toHaveBeenCalledWith("stellar", ["--version"], {
skipStellarVersionCheck: true,
});
});

it("preserves explicit skipStellarVersionCheck for non-stellar binaries", async () => {
runCommand.mockResolvedValueOnce({ stdout: "rustc 1.85.0", stderr: "", all: "rustc 1.85.0" });

await checkBinary("rustc", "hint", { skipStellarVersionCheck: false });

expect(runCommand).toHaveBeenCalledWith("rustc", ["--version"], {
skipStellarVersionCheck: false,
});
});

it("ignores explicit skipStellarVersionCheck: false for stellar binary", async () => {
runCommand.mockResolvedValueOnce({
stdout: "stellar 25.2.0",
stderr: "",
all: "stellar 25.2.0",
});

await checkBinary("stellar", "hint", { skipStellarVersionCheck: false });

// Stellar always skips version check; explicit false is overridden.
expect(runCommand).toHaveBeenCalledWith("stellar", ["--version"], {
skipStellarVersionCheck: true,
});
});
});
4 changes: 3 additions & 1 deletion packages/core/src/shell/check-binary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ export async function checkBinary(
options: CheckBinaryOptions = {}
): Promise<void> {
try {
await runCommand(binary, ["--version"], options);
await runCommand(binary, ["--version"], {
skipStellarVersionCheck: binary === "stellar" ? true : options.skipStellarVersionCheck,
});
} catch (error) {
if (error instanceof CaatingaError) {
throw error;
Expand Down
Loading