cdalkit 0.1.7 → 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/LICENSE.md +14 -0
- package/README.md +14 -22
- package/dist/chunk-22BBUYVB.js +132 -0
- package/dist/cli.d.ts +6 -2
- package/dist/cli.js +60 -1396
- package/dist/index.d.ts +34 -4
- package/dist/index.js +20 -6
- package/package.json +7 -22
- package/LICENSE +0 -176
- package/dist/cli.js.map +0 -1
- package/dist/index.js.map +0 -1
package/LICENSE.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# CDAL Free Tools License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Michał Sznurowski (CDAL Kit). All rights reserved.
|
|
4
|
+
|
|
5
|
+
You may use this software free of charge, for any purpose, including
|
|
6
|
+
commercial projects: run the CDAL audit and install CDAL Pro if you hold a
|
|
7
|
+
license. You may not modify, publish, sell, sublicense or redistribute it,
|
|
8
|
+
except as part of a project that depends on it through a package manager.
|
|
9
|
+
|
|
10
|
+
The software is provided "as is", without warranty of any kind. The full terms
|
|
11
|
+
are at https://cdalkit.tech/legal/terms.
|
|
12
|
+
|
|
13
|
+
Versions of this package published before this license (0.1.x) remain
|
|
14
|
+
available under the Apache License 2.0 under which they were released.
|
package/README.md
CHANGED
|
@@ -1,36 +1,28 @@
|
|
|
1
|
-
#
|
|
1
|
+
# cdalkit
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
CDAL is a ready-made method for building apps with AI agents in Claude Code, Cursor, Windsurf and Antigravity. You describe the idea; the agent plans it with you, asks before it guesses, and builds it step by step with tests it can't fake.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This package gives you two things.
|
|
6
|
+
|
|
7
|
+
## The free audit
|
|
6
8
|
|
|
7
9
|
```bash
|
|
8
10
|
npx cdalkit audit
|
|
9
11
|
```
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
Scans your repository offline in about 15 seconds and scores how safely AI agents work in it (0–100), with concrete fixes. Your code never leaves your machine.
|
|
14
|
+
|
|
15
|
+
## The CDAL Pro installer
|
|
12
16
|
|
|
13
|
-
|
|
17
|
+
After buying CDAL Pro at [cdalkit.tech](https://cdalkit.tech/pricing), run this in your project. An empty folder works too:
|
|
14
18
|
|
|
15
19
|
```bash
|
|
16
|
-
npx cdalkit
|
|
17
|
-
npx cdalkit
|
|
20
|
+
npx cdalkit pro install # CDAL Pro Solo
|
|
21
|
+
npx cdalkit pro install --team # CDAL Pro Team
|
|
18
22
|
```
|
|
19
23
|
|
|
20
|
-
|
|
21
|
-
|---|---|
|
|
22
|
-
| `cdal validate` | Check contract invariants |
|
|
23
|
-
| `cdal codegen` | Generate TypeScript types and docs from contracts (`--check` for drift) |
|
|
24
|
-
| `cdal trace --enforce` | Fail unless every requirement has a test tagged `// @REQ: <ID>` |
|
|
25
|
-
| `cdal selftest` | Mutation-test the gates: every rule must fire red |
|
|
26
|
-
| `cdal phase` | Check the git diff against the current loop phase (contract, red, green) |
|
|
27
|
-
| `cdal sync` | Generate agent roles, commands and hooks for each runtime |
|
|
28
|
-
| `cdal doctor` | Diagnose installation and hook wiring |
|
|
29
|
-
|
|
30
|
-
## Links
|
|
24
|
+
It downloads CDAL from the private repository you got access to, installs it into the project (`.cdal/vendor/`), sets it up and connects it to your editor. Commit the result so your teammates get the same setup.
|
|
31
25
|
|
|
32
|
-
|
|
33
|
-
- Getting started: https://cdalkit.tech/docs/getting-started
|
|
34
|
-
- CLI reference: https://cdalkit.tech/docs/cli-reference
|
|
26
|
+
Questions: contact@cdalkit.tech
|
|
35
27
|
|
|
36
|
-
Apache-2.0
|
|
28
|
+
License: CDAL Free Tools License (see LICENSE.md). Versions 0.1.x were published under Apache-2.0.
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
// src/bootstrap.ts
|
|
2
|
+
import { execFileSync } from "child_process";
|
|
3
|
+
import {
|
|
4
|
+
copyFileSync,
|
|
5
|
+
existsSync,
|
|
6
|
+
mkdirSync,
|
|
7
|
+
mkdtempSync,
|
|
8
|
+
readFileSync,
|
|
9
|
+
readdirSync,
|
|
10
|
+
rmSync,
|
|
11
|
+
writeFileSync
|
|
12
|
+
} from "fs";
|
|
13
|
+
import { tmpdir } from "os";
|
|
14
|
+
import { basename, join, resolve } from "path";
|
|
15
|
+
var PRO_REPOSITORY_URL = "https://github.com/cdalkit/cdal-pro.git";
|
|
16
|
+
var VENDOR_DIR = ".cdal/vendor";
|
|
17
|
+
var BootstrapError = class extends Error {
|
|
18
|
+
};
|
|
19
|
+
var defaultExec = (command, args, cwd) => {
|
|
20
|
+
execFileSync(command, args, { cwd, stdio: "inherit" });
|
|
21
|
+
};
|
|
22
|
+
function readVendorManifest(sourceDir) {
|
|
23
|
+
const file = join(sourceDir, "vendor/manifest.json");
|
|
24
|
+
if (!existsSync(file)) {
|
|
25
|
+
throw new BootstrapError(
|
|
26
|
+
`${file} not found. This copy of CDAL Pro does not include the CDAL core; update it or contact contact@cdalkit.tech.`
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
const manifest = JSON.parse(readFileSync(file, "utf8"));
|
|
30
|
+
for (const tarball of Object.values(manifest.packages)) {
|
|
31
|
+
if (basename(tarball) !== tarball || !tarball.endsWith(".tgz")) {
|
|
32
|
+
throw new BootstrapError(`Invalid tarball name in vendor/manifest.json: ${tarball}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return manifest;
|
|
36
|
+
}
|
|
37
|
+
function vendorCore(sourceDir, projectDir) {
|
|
38
|
+
const manifest = readVendorManifest(sourceDir);
|
|
39
|
+
const vendorDir = join(projectDir, VENDOR_DIR);
|
|
40
|
+
mkdirSync(vendorDir, { recursive: true });
|
|
41
|
+
const wanted = new Set(Object.values(manifest.packages));
|
|
42
|
+
for (const file of readdirSync(vendorDir)) {
|
|
43
|
+
if (file.endsWith(".tgz") && !wanted.has(file)) rmSync(join(vendorDir, file));
|
|
44
|
+
}
|
|
45
|
+
for (const tarball of wanted) {
|
|
46
|
+
copyFileSync(join(sourceDir, "vendor", tarball), join(vendorDir, tarball));
|
|
47
|
+
}
|
|
48
|
+
const pkgPath = join(projectDir, "package.json");
|
|
49
|
+
const pkg = existsSync(pkgPath) ? JSON.parse(readFileSync(pkgPath, "utf8")) : {
|
|
50
|
+
name: basename(projectDir).toLowerCase().replace(/[^a-z0-9-]+/g, "-"),
|
|
51
|
+
private: true,
|
|
52
|
+
type: "module"
|
|
53
|
+
};
|
|
54
|
+
pkg.devDependencies = { ...pkg.devDependencies };
|
|
55
|
+
for (const [name, tarball] of Object.entries(manifest.packages)) {
|
|
56
|
+
pkg.devDependencies[name] = `file:${VENDOR_DIR}/${tarball}`;
|
|
57
|
+
}
|
|
58
|
+
pkg.devDependencies = Object.fromEntries(
|
|
59
|
+
Object.entries(pkg.devDependencies).sort(([a], [b]) => a.localeCompare(b))
|
|
60
|
+
);
|
|
61
|
+
writeFileSync(pkgPath, `${JSON.stringify(pkg, null, 2)}
|
|
62
|
+
`);
|
|
63
|
+
return manifest;
|
|
64
|
+
}
|
|
65
|
+
function detectPackageManager(projectDir) {
|
|
66
|
+
if (existsSync(join(projectDir, "pnpm-lock.yaml"))) return "pnpm";
|
|
67
|
+
if (existsSync(join(projectDir, "yarn.lock"))) return "yarn";
|
|
68
|
+
return "npm";
|
|
69
|
+
}
|
|
70
|
+
function localCli(projectDir) {
|
|
71
|
+
return join(
|
|
72
|
+
projectDir,
|
|
73
|
+
"node_modules/.bin",
|
|
74
|
+
process.platform === "win32" ? "cdalkit.cmd" : "cdalkit"
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
function cloneSource(from) {
|
|
78
|
+
const local = resolve(from);
|
|
79
|
+
if (existsSync(local)) return { dir: local, cleanup: () => {
|
|
80
|
+
} };
|
|
81
|
+
const dir = mkdtempSync(join(tmpdir(), "cdal-pro-"));
|
|
82
|
+
const cleanup = () => rmSync(dir, { recursive: true, force: true });
|
|
83
|
+
try {
|
|
84
|
+
execFileSync("git", ["clone", "--depth", "1", "--quiet", from, dir], {
|
|
85
|
+
stdio: ["ignore", "ignore", "pipe"]
|
|
86
|
+
});
|
|
87
|
+
} catch {
|
|
88
|
+
cleanup();
|
|
89
|
+
throw new BootstrapError(
|
|
90
|
+
`Could not download CDAL Pro from ${from}.
|
|
91
|
+
CDAL Pro is delivered as a private GitHub repository: accept the invitation sent after your purchase, make sure git can access GitHub as that account, then run this command again.
|
|
92
|
+
Not a customer yet? https://cdalkit.tech/pricing`
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
return { dir, cleanup };
|
|
96
|
+
}
|
|
97
|
+
function installProWithCore(options) {
|
|
98
|
+
const exec = options.exec ?? defaultExec;
|
|
99
|
+
const log = options.log ?? (() => {
|
|
100
|
+
});
|
|
101
|
+
const cwd = resolve(options.cwd);
|
|
102
|
+
const source = cloneSource(options.from ?? PRO_REPOSITORY_URL);
|
|
103
|
+
try {
|
|
104
|
+
const manifest = vendorCore(source.dir, cwd);
|
|
105
|
+
log(`Installing the CDAL core ${manifest.version}\u2026`);
|
|
106
|
+
const pm = detectPackageManager(cwd);
|
|
107
|
+
exec(pm, ["install"], cwd);
|
|
108
|
+
const cli = localCli(cwd);
|
|
109
|
+
if (!existsSync(join(cwd, "cdal.config.mjs"))) exec(cli, ["init", "--yes"], cwd);
|
|
110
|
+
const force = options.force ? ["--force"] : [];
|
|
111
|
+
exec(cli, ["pro", "install", "--from", source.dir, ...force], cwd);
|
|
112
|
+
if (options.team) {
|
|
113
|
+
const teamFrom = options.teamFrom ? ["--from", options.teamFrom] : [];
|
|
114
|
+
exec(cli, ["pro", "install", "--team", ...teamFrom, ...force], cwd);
|
|
115
|
+
}
|
|
116
|
+
exec(cli, ["sync"], cwd);
|
|
117
|
+
return manifest;
|
|
118
|
+
} finally {
|
|
119
|
+
source.cleanup();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export {
|
|
124
|
+
PRO_REPOSITORY_URL,
|
|
125
|
+
VENDOR_DIR,
|
|
126
|
+
BootstrapError,
|
|
127
|
+
readVendorManifest,
|
|
128
|
+
vendorCore,
|
|
129
|
+
detectPackageManager,
|
|
130
|
+
localCli,
|
|
131
|
+
installProWithCore
|
|
132
|
+
};
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import * as citty from 'citty';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/** Commands that belong to the paid CDAL core explain where they come from. */
|
|
4
|
+
declare function proOnly(name: string): citty.CommandDef<citty.ArgsDef>;
|
|
5
|
+
declare const runMain: () => Promise<void>;
|
|
6
|
+
|
|
7
|
+
export { proOnly, runMain };
|