cdalkit 0.1.7 → 0.2.1

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/dist/index.d.ts CHANGED
@@ -1,4 +1,34 @@
1
- export * from '@cdal/core';
2
- export * from '@cdal/kinds';
3
- export * from '@cdal/adapters';
4
- export * from '@cdal/audit';
1
+ declare const PRO_REPOSITORY_URL = "https://github.com/cdalkit/cdal-pro.git";
2
+ /** Where the CDAL core packages live inside a project, committed so teammates get them too. */
3
+ declare const VENDOR_DIR = ".cdal/vendor";
4
+ declare class BootstrapError extends Error {
5
+ }
6
+ /** vendor/manifest.json in the cdal-pro repository: package name → tarball file. */
7
+ interface VendorManifest {
8
+ version: string;
9
+ packages: Record<string, string>;
10
+ }
11
+ type PackageManager = 'pnpm' | 'yarn' | 'npm';
12
+ type Exec = (command: string, args: string[], cwd: string) => void;
13
+ declare function readVendorManifest(sourceDir: string): VendorManifest;
14
+ /**
15
+ * Copies the core tarballs into the project and points package.json at them.
16
+ * Creates a minimal package.json in an empty folder, so a beginner can start from nothing.
17
+ */
18
+ declare function vendorCore(sourceDir: string, projectDir: string): VendorManifest;
19
+ declare function detectPackageManager(projectDir: string): PackageManager;
20
+ /** The project's own cdalkit binary: the full CLI once the core is installed. */
21
+ declare function localCli(projectDir: string): string;
22
+ interface ProInstallOptions {
23
+ cwd: string;
24
+ from?: string;
25
+ team?: boolean;
26
+ teamFrom?: string;
27
+ force?: boolean;
28
+ exec?: Exec;
29
+ log?: (line: string) => void;
30
+ }
31
+ /** Installs the CDAL core from cdal-pro, then lets the full CLI install the Pro content. */
32
+ declare function installProWithCore(options: ProInstallOptions): VendorManifest;
33
+
34
+ export { BootstrapError, type Exec, PRO_REPOSITORY_URL, type PackageManager, type ProInstallOptions, VENDOR_DIR, type VendorManifest, detectPackageManager, installProWithCore, localCli, readVendorManifest, vendorCore };
package/dist/index.js CHANGED
@@ -1,6 +1,20 @@
1
- // src/index.ts
2
- export * from "@cdal/core";
3
- export * from "@cdal/kinds";
4
- export * from "@cdal/adapters";
5
- export * from "@cdal/audit";
6
- //# sourceMappingURL=index.js.map
1
+ import {
2
+ BootstrapError,
3
+ PRO_REPOSITORY_URL,
4
+ VENDOR_DIR,
5
+ detectPackageManager,
6
+ installProWithCore,
7
+ localCli,
8
+ readVendorManifest,
9
+ vendorCore
10
+ } from "./chunk-22BBUYVB.js";
11
+ export {
12
+ BootstrapError,
13
+ PRO_REPOSITORY_URL,
14
+ VENDOR_DIR,
15
+ detectPackageManager,
16
+ installProWithCore,
17
+ localCli,
18
+ readVendorManifest,
19
+ vendorCore
20
+ };
package/package.json CHANGED
@@ -1,18 +1,10 @@
1
1
  {
2
2
  "name": "cdalkit",
3
- "version": "0.1.7",
4
- "description": "Command-line interface and hook router for CDAL (Contract-Driven Agentic Loop)",
5
- "license": "Apache-2.0",
3
+ "version": "0.2.1",
4
+ "description": "CDAL: the free repository audit and the CDAL Pro installer",
5
+ "license": "SEE LICENSE IN LICENSE.md",
6
6
  "author": "Michał Sznurowski",
7
7
  "homepage": "https://cdalkit.tech",
8
- "repository": {
9
- "type": "git",
10
- "url": "git+https://github.com/aiprojectmanagersznurowski-afk/cdal.git",
11
- "directory": "packages/cli"
12
- },
13
- "bugs": {
14
- "url": "https://github.com/aiprojectmanagersznurowski-afk/cdal/issues"
15
- },
16
8
  "keywords": [
17
9
  "ai",
18
10
  "agents",
@@ -20,9 +12,7 @@
20
12
  "cursor",
21
13
  "windsurf",
22
14
  "antigravity",
23
- "quality-gates",
24
- "contracts",
25
- "testing",
15
+ "audit",
26
16
  "vibecoding"
27
17
  ],
28
18
  "type": "module",
@@ -31,7 +21,6 @@
31
21
  "cdalkit": "./bin/cdal.mjs"
32
22
  },
33
23
  "main": "./dist/index.js",
34
- "module": "./dist/index.js",
35
24
  "types": "./dist/index.d.ts",
36
25
  "exports": {
37
26
  ".": {
@@ -41,17 +30,13 @@
41
30
  },
42
31
  "files": [
43
32
  "dist",
44
- "bin"
33
+ "bin",
34
+ "LICENSE.md"
45
35
  ],
46
36
  "dependencies": {
47
- "@clack/prompts": "^0.9.1",
48
37
  "citty": "^0.1.6",
49
38
  "picocolors": "^1.1.1",
50
- "tinyglobby": "^0.2.10",
51
- "@cdal/adapters": "0.1.4",
52
- "@cdal/audit": "0.1.2",
53
- "@cdal/core": "0.1.2",
54
- "@cdal/kinds": "0.1.2"
39
+ "@cdal/audit": "0.3.0"
55
40
  },
56
41
  "devDependencies": {
57
42
  "tsup": "^8.3.6",
package/LICENSE DELETED
@@ -1,176 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
package/dist/cli.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/cli.ts","../src/commands/audit.ts","../src/commands/codegen.ts","../src/kinds.ts","../src/commands/doctor.ts","../src/commands/hook.ts","../src/commands/init.ts","../src/commands/phase.ts","../src/commands/pro.ts","../src/pro/install.ts","../src/commands/selftest.ts","../src/commands/sync.ts","../src/commands/trace.ts","../src/commands/validate.ts","../src/commands/verify.ts","../src/commands/window.ts"],"sourcesContent":["import { createRequire } from 'node:module';\nimport { runMain as cittyRunMain, defineCommand } from 'citty';\nimport { auditCommand } from './commands/audit.js';\nimport { codegenCommand } from './commands/codegen.js';\nimport { doctorCommand } from './commands/doctor.js';\nimport { hookCommand } from './commands/hook.js';\nimport { initCommand } from './commands/init.js';\nimport { phaseCommand } from './commands/phase.js';\nimport { proCommand } from './commands/pro.js';\nimport { selftestCommand } from './commands/selftest.js';\nimport { syncCommand } from './commands/sync.js';\nimport { traceCommand } from './commands/trace.js';\nimport { validateCommand } from './commands/validate.js';\nimport { verifyCommand } from './commands/verify.js';\nimport { windowCommand } from './commands/window.js';\n\n// Read the version from package.json so `--version` always matches the published package.\nconst { version } = createRequire(import.meta.url)('../package.json') as { version: string };\n\nconst main = defineCommand({\n meta: {\n name: 'cdal',\n version,\n description: 'Contract-Driven Agentic Loop (CDAL) Quality Gates & Audit CLI',\n },\n subCommands: {\n init: initCommand,\n validate: validateCommand,\n codegen: codegenCommand,\n window: windowCommand,\n trace: traceCommand,\n phase: phaseCommand,\n selftest: selftestCommand,\n sync: syncCommand,\n verify: verifyCommand,\n doctor: doctorCommand,\n hook: hookCommand,\n audit: auditCommand,\n pro: proCommand,\n },\n});\n\nexport function runMain() {\n cittyRunMain(main);\n}\n","import { writeFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport { renderHtmlReport, renderTerminalReport, runAudit } from '@cdal/audit';\nimport type { AuditLanguage } from '@cdal/audit';\nimport { defineCommand } from 'citty';\nimport pc from 'picocolors';\n\nexport const auditCommand = defineCommand({\n meta: {\n name: 'audit',\n description:\n 'Audit repository for AI agent hygiene, type silencing, test isolation and gates (100% offline)',\n },\n args: {\n path: {\n type: 'positional',\n description: 'Path to repository root to audit',\n required: false,\n default: '.',\n },\n html: {\n type: 'string',\n description: 'Path to save standalone single-file HTML report (e.g. audit-report.html)',\n required: false,\n },\n json: {\n type: 'boolean',\n description: 'Output machine-readable JSON report (schema: audit.v1)',\n default: false,\n },\n lang: {\n type: 'string',\n description: 'Report language (en or pl)',\n default: 'en',\n },\n failUnder: {\n type: 'string',\n description: 'Exit with code 1 if audit score is below this threshold (0-100)',\n required: false,\n },\n },\n async run({ args }) {\n const targetDir = resolve(args.path || '.');\n const lang = (args.lang === 'pl' ? 'pl' : 'en') as AuditLanguage;\n\n if (!args.json) {\n console.log(pc.bold(pc.cyan('\\n🔍 Running CDAL Repository AI Hygiene Audit...\\n')));\n }\n\n const report = await runAudit({\n cwd: targetDir,\n lang,\n });\n\n if (args.html) {\n const htmlContent = renderHtmlReport(report, lang);\n const outPath = resolve(args.html);\n writeFileSync(outPath, htmlContent, 'utf8');\n if (!args.json) {\n console.log(pc.green(` ✔ Wygenerowano raport HTML: ${outPath}`));\n }\n }\n\n if (args.json) {\n console.log(JSON.stringify(report, null, 2));\n } else {\n console.log(renderTerminalReport(report, lang));\n }\n\n if (args.failUnder) {\n const threshold = Number.parseInt(args.failUnder, 10);\n if (!Number.isNaN(threshold) && report.score < threshold) {\n console.error(\n pc.red(\n `\\n❌ Audit score ${report.score} is below threshold ${threshold}. Failing quality gate.`,\n ),\n );\n process.exit(1);\n }\n }\n },\n});\n","import { runCodegen } from '@cdal/core';\nimport { defineCommand } from 'citty';\nimport pc from 'picocolors';\nimport { resolveCommandKinds } from '../kinds.js';\n\nexport const codegenCommand = defineCommand({\n meta: {\n name: 'codegen',\n description:\n 'Emit TypeScript types and documentation from contracts (with --check drift detection)',\n },\n args: {\n check: {\n type: 'boolean',\n description: 'Check for drift between contracts and generated files without modifying disk',\n default: false,\n },\n dir: {\n type: 'string',\n description: 'Custom path to contracts directory',\n },\n },\n async run({ args }) {\n try {\n const kinds = await resolveCommandKinds();\n\n const res = await runCodegen({\n contractsDir: args.dir,\n check: Boolean(args.check),\n kinds,\n });\n\n if (args.check) {\n if (!res.drift) {\n console.log(pc.green('✅ Codegen check: all generated files are in sync byte-for-byte.'));\n } else {\n console.error(pc.red('❌ Codegen check failed: drift detected in generated files:'));\n for (const f of res.files) {\n if (f.status === 'drift') {\n console.error(pc.red(` - [DRIFT] ${f.path} (${f.fullPath})`));\n } else if (f.status === 'missing') {\n console.error(pc.red(` - [MISSING] ${f.path} (${f.fullPath})`));\n }\n }\n console.error(\n pc.yellow('\\nRun `cdal codegen` to synchronize generated files with contracts.'),\n );\n process.exit(1);\n }\n } else {\n console.log(pc.green(`✅ Emitted ${res.files.length} contract artifact(s):`));\n for (const f of res.files) {\n console.log(pc.cyan(` - ${f.path} -> ${f.fullPath}`));\n }\n }\n } catch (err: unknown) {\n const msg = err instanceof Error ? err.message : String(err);\n console.error(pc.red(`❌ Fatal error during codegen: ${msg}`));\n process.exit(1);\n }\n },\n});\n","import { type ContractKind, loadConfig } from '@cdal/core';\nimport { policies, requirements, stateMachine } from '@cdal/kinds';\n\n/**\n * Contract kinds for validate/codegen: the ones registered in cdal.config.mjs\n * (built-in, CDAL Pro or custom), or the built-in kinds when the config registers none.\n */\nexport async function resolveCommandKinds(cwd: string = process.cwd()): Promise<ContractKind[]> {\n const { config } = await loadConfig(cwd);\n const configured = (config.kinds ?? []).filter(\n (kind): kind is ContractKind => typeof (kind as Partial<ContractKind>).load === 'function',\n );\n if (configured.length > 0) return configured;\n return [requirements(), stateMachine(), policies()] as ContractKind[];\n}\n","import { spawnSync } from 'node:child_process';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { join } from 'node:path';\nimport { syncAdapters } from '@cdal/adapters';\nimport { type ContractKind, type ResolvedCdalConfig, loadConfig, runCodegen } from '@cdal/core';\nimport { defineCommand } from 'citty';\nimport pc from 'picocolors';\n\nexport interface DoctorCheckResult {\n name: string;\n status: 'ok' | 'warn' | 'error';\n message: string;\n recommendation?: string;\n}\n\n/**\n * Claude Code only runs hooks declared as matcher groups with typed handlers:\n * { matcher, hooks: [{ type: 'command', command }] }. A `command` placed\n * directly on the group is silently ignored.\n */\nfunction inspectClaudeHooks(settings: {\n hooks?: Record<string, unknown>;\n}): 'ok' | 'legacy-format' | 'missing' {\n const groups = settings.hooks?.PreToolUse;\n if (!Array.isArray(groups)) return 'missing';\n let legacy = false;\n for (const group of groups as Array<Record<string, unknown>>) {\n if (typeof group.command === 'string' && /cdal(kit)? hook/.test(group.command)) legacy = true;\n const handlers = Array.isArray(group.hooks)\n ? (group.hooks as Array<Record<string, unknown>>)\n : [];\n for (const handler of handlers) {\n if (\n handler.type === 'command' &&\n typeof handler.command === 'string' &&\n /cdal(kit)? hook guard-paths/.test(handler.command)\n ) {\n return 'ok';\n }\n }\n }\n return legacy ? 'legacy-format' : 'missing';\n}\n\nexport function runDoctorChecks(\n cwd: string,\n customConfig?: string,\n): {\n checks: DoctorCheckResult[];\n healthy: boolean;\n} {\n const checks: DoctorCheckResult[] = [];\n\n // 1. Node version check (requires >= 20.9.0)\n const nodeVer = process.version;\n const match = /^v(\\d+)\\.(\\d+)\\./.exec(nodeVer);\n const major = match?.[1] ? Number.parseInt(match[1], 10) : 0;\n const minor = match?.[2] ? Number.parseInt(match[2], 10) : 0;\n\n if (major > 20 || (major === 20 && minor >= 9)) {\n checks.push({\n name: 'Node.js Runtime',\n status: 'ok',\n message: `Node ${nodeVer} satisfies engines.node >= 20.9.0 LTS`,\n });\n } else {\n checks.push({\n name: 'Node.js Runtime',\n status: 'error',\n message: `Current Node ${nodeVer} is below required >= 20.9.0`,\n recommendation: 'Upgrade Node.js to Node 22 LTS or Node 20.9+.',\n });\n }\n\n // 2. Git installation and repository check\n const gitVersionRes = spawnSync('git', ['--version'], { encoding: 'utf8' });\n if (gitVersionRes.status !== 0) {\n checks.push({\n name: 'Git Binary',\n status: 'error',\n message: 'git binary is not available in PATH',\n recommendation: 'Install Git or add it to PATH.',\n });\n } else {\n checks.push({\n name: 'Git Binary',\n status: 'ok',\n message: `Git is available (${gitVersionRes.stdout.trim()})`,\n });\n\n const gitRepoRes = spawnSync('git', ['rev-parse', '--is-inside-work-tree'], {\n cwd,\n encoding: 'utf8',\n });\n if (gitRepoRes.status !== 0) {\n checks.push({\n name: 'Git Repository',\n status: 'error',\n message: 'Current directory is not inside a git working tree',\n recommendation: 'Initialize git with `git init`.',\n });\n } else {\n checks.push({\n name: 'Git Repository',\n status: 'ok',\n message: 'Inside active git working tree',\n });\n }\n }\n\n // 3. Configuration check\n let configObj: ResolvedCdalConfig | null = null;\n try {\n const loaded = loadConfigSync(cwd, customConfig);\n configObj = loaded.config;\n checks.push({\n name: 'Configuration',\n status: 'ok',\n message: `Configuration loaded cleanly (${loaded.filepath ? loaded.filepath : 'default config'})`,\n });\n } catch (err: unknown) {\n const msg = err instanceof Error ? err.message : String(err);\n checks.push({\n name: 'Configuration',\n status: 'error',\n message: `Failed to load cdal.config.mjs: ${msg}`,\n recommendation: 'Run `cdal init` or fix configuration errors.',\n });\n }\n\n // 4. Hook wiring check in .claude/settings.json\n const settingsPath = join(cwd, '.claude/settings.json');\n if (existsSync(settingsPath)) {\n try {\n const settings = JSON.parse(readFileSync(settingsPath, 'utf8')) as {\n hooks?: Record<string, unknown>;\n };\n const wiring = inspectClaudeHooks(settings);\n if (wiring === 'ok') {\n checks.push({\n name: 'Claude Code Hooks',\n status: 'ok',\n message: '.claude/settings.json correctly wires CDAL pre-tool hooks',\n });\n } else {\n checks.push({\n name: 'Claude Code Hooks',\n status: 'warn',\n message:\n wiring === 'legacy-format'\n ? '.claude/settings.json uses a hook format Claude Code ignores, so the CDAL gates never run'\n : '.claude/settings.json exists but does not wire the CDAL guard-paths hook',\n recommendation: 'Run `npx cdalkit sync` to regenerate the hook wiring.',\n });\n }\n } catch {\n checks.push({\n name: 'Claude Code Hooks',\n status: 'warn',\n message: 'Could not read .claude/settings.json',\n });\n }\n } else {\n checks.push({\n name: 'Claude Code Hooks',\n status: 'warn',\n message: 'No .claude/settings.json found in workspace',\n recommendation: 'Run `cdal init` or `cdal sync` to generate hook wiring.',\n });\n }\n\n // 5. Adapter drift check\n if (configObj) {\n try {\n const syncRes = syncAdapters({ cwd, config: configObj, check: true });\n if (syncRes.inSync) {\n checks.push({\n name: 'Runtime Adapters Sync',\n status: 'ok',\n message: `All ${syncRes.totalFiles} adapter file(s) are in sync without drift`,\n });\n } else {\n checks.push({\n name: 'Runtime Adapters Sync',\n status: 'error',\n message: `${syncRes.driftedFiles.length} adapter file(s) drifted from configuration: ${syncRes.driftedFiles.join(', ')}`,\n recommendation: 'Run `cdal sync` to synchronize runtime files.',\n });\n }\n } catch (err: unknown) {\n checks.push({\n name: 'Runtime Adapters Sync',\n status: 'warn',\n message: `Could not check adapter sync: ${String(err)}`,\n });\n }\n }\n\n const healthy = checks.every((c) => c.status !== 'error');\n return { checks, healthy };\n}\n\nfunction loadConfigSync(cwd: string, customConfig?: string) {\n const configPath = customConfig || join(cwd, 'cdal.config.mjs');\n if (existsSync(configPath)) {\n return { config: null, filepath: configPath };\n }\n return { config: null, filepath: null };\n}\n\nexport const doctorCommand = defineCommand({\n meta: {\n name: 'doctor',\n description:\n 'Diagnose CDAL installation, environment health, hook wiring, and configuration drift',\n },\n args: {\n config: {\n type: 'string',\n description: 'Path to cdal.config.mjs',\n },\n cwd: {\n type: 'string',\n description: 'Working directory path',\n },\n },\n async run({ args }) {\n const cwd = args.cwd || process.cwd();\n console.log(pc.bold(pc.cyan('\\n🩺 Running CDAL Diagnostic Doctor...\\n')));\n\n let resolvedConfig: ResolvedCdalConfig | null = null;\n try {\n const loaded = await loadConfig(args.config || cwd);\n resolvedConfig = loaded.config;\n } catch (err: unknown) {\n console.error(pc.red(`⚠️ Configuration error: ${String(err)}`));\n }\n\n const { checks, healthy } = runDoctorChecks(cwd, args.config);\n\n // If we loaded config, also test runCodegen drift\n if (resolvedConfig) {\n try {\n const codegenRes = await runCodegen({\n contractsDir: resolvedConfig.contractsDir,\n kinds: resolvedConfig.kinds as unknown as ContractKind<unknown>[],\n check: true,\n });\n if (!codegenRes.drift) {\n checks.push({\n name: 'Contract Codegen Sync',\n status: 'ok',\n message: 'Generated contract artifacts match contracts byte-for-byte',\n });\n } else {\n checks.push({\n name: 'Contract Codegen Sync',\n status: 'error',\n message: 'Generated contract code drifted from contract sources',\n recommendation: 'Run `cdal codegen` to regenerate artifacts.',\n });\n }\n } catch {\n // ignore codegen errors in doctor if contractsDir empty\n }\n }\n\n for (const check of checks) {\n if (check.status === 'ok') {\n console.log(pc.green(` ✓ [OK] ${pc.bold(check.name)}: ${check.message}`));\n } else if (check.status === 'warn') {\n console.log(pc.yellow(` ⚠️ [WARN] ${pc.bold(check.name)}: ${check.message}`));\n if (check.recommendation) {\n console.log(pc.dim(` Recommendation: ${check.recommendation}`));\n }\n } else {\n console.log(pc.red(` ❌ [FAIL] ${pc.bold(check.name)}: ${check.message}`));\n if (check.recommendation) {\n console.log(pc.yellow(` Recommendation: ${check.recommendation}`));\n }\n }\n }\n\n if (healthy) {\n console.log(\n pc.bold(pc.green('\\n✅ Doctor report: Environment and CDAL quality gates are healthy!\\n')),\n );\n } else {\n console.log(pc.bold(pc.red('\\n❌ Doctor report: Some critical diagnostic checks failed.\\n')));\n process.exit(1);\n }\n },\n});\n","import fs from 'node:fs';\nimport { type HookName, executeHook } from '@cdal/adapters';\nimport { loadConfig } from '@cdal/core';\nimport { defineCommand } from 'citty';\n\nconst VALID_HOOKS = new Set([\n 'guard-paths',\n 'guard-forbidden',\n 'guard-bash',\n 'session-context',\n 'log-subagent',\n]);\n\nexport const hookCommand = defineCommand({\n meta: {\n name: 'hook',\n description: 'Entrypoint for agent runtime hooks (Claude Code, Antigravity, etc.)',\n },\n args: {\n name: {\n type: 'positional',\n description:\n 'Hook name to execute: guard-paths, guard-forbidden, guard-bash, session-context, log-subagent',\n required: true,\n },\n role: {\n type: 'positional',\n description: 'Fallback agent role name if not specified in hook payload',\n required: false,\n },\n runtime: {\n type: 'string',\n description: 'Target runtime adapter (claude-code, antigravity)',\n default: 'claude-code',\n },\n config: {\n type: 'string',\n description: 'Path to cdal.config.mjs',\n },\n },\n async run({ args }) {\n const hookName = args.name as HookName;\n if (!VALID_HOOKS.has(hookName)) {\n process.stderr.write(\n `Unknown hook name \"${hookName}\". Valid hooks: ${Array.from(VALID_HOOKS).join(', ')}\\n`,\n );\n process.exit(1);\n }\n\n let rawPayload = '';\n try {\n rawPayload = fs.readFileSync(0, 'utf8');\n } catch {\n // stdin was not piped or not accessible\n }\n\n const cwd = process.cwd();\n const { config } = await loadConfig(args.config);\n\n const result = await executeHook(hookName, rawPayload, {\n cwd,\n config,\n fallbackRole: args.role,\n runtime: args.runtime as 'claude-code' | 'antigravity' | 'generic',\n });\n\n if (result.stdout) {\n process.stdout.write(`${result.stdout}\\n`);\n }\n\n if (result.stderr) {\n process.stderr.write(result.stderr);\n }\n\n process.exit(result.exitCode);\n },\n});\n","import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport { join } from 'node:path';\nimport { syncAdapters } from '@cdal/adapters';\nimport { resolveConfig } from '@cdal/core';\nimport { defineCommand } from 'citty';\nimport pc from 'picocolors';\n\nexport const initCommand = defineCommand({\n meta: {\n name: 'init',\n description:\n 'Initialize CDAL quality gates, starter contracts, and runtime adapters in the repository',\n },\n args: {\n yes: {\n type: 'boolean',\n description: 'Accept default recommendations non-interactively',\n alias: 'y',\n default: false,\n },\n preset: {\n type: 'string',\n description: 'Preset configuration to apply (e.g. typescript-strict, nextjs, node-service)',\n default: 'typescript-strict',\n },\n runtime: {\n type: 'string',\n description: 'Comma-separated runtimes to enable (claude-code, agents-md, antigravity)',\n default: 'claude-code,agents-md',\n },\n cwd: {\n type: 'string',\n description: 'Target directory to initialize',\n },\n },\n async run({ args }) {\n const cwd = args.cwd || process.cwd();\n console.log(pc.bold(pc.cyan('\\n🚀 Initializing Contract-Driven Agentic Loop (CDAL)...\\n')));\n\n const preset = args.preset || 'typescript-strict';\n const rawRuntimes = (args.runtime || 'claude-code,agents-md')\n .split(',')\n .map((r) => r.trim())\n .filter(Boolean);\n\n // 1. Create contracts directory and sample contract if missing\n const contractsDir = join(cwd, 'contracts');\n if (!existsSync(contractsDir)) {\n mkdirSync(contractsDir, { recursive: true });\n }\n\n const sampleContractPath = join(contractsDir, 'requirements.contract.mjs');\n if (!existsSync(sampleContractPath)) {\n const sampleContractContent = `// @origin: cdal init\nexport const REQUIREMENTS = [\n {\n id: 'REQ-CORE-INIT-1',\n statement: 'System must initialize workspace with contract-driven quality gates.',\n acceptance: [\n 'cdal validate succeeds without errors',\n 'Test cases are marked with @REQ tags',\n ],\n status: 'TODO',\n priority: 'CRITICAL',\n source: 'cdal.config.mjs',\n },\n {\n id: 'REQ-CORE-INIT-2',\n statement: 'Every implemented requirement is proven by a test tagged with its ID.',\n acceptance: ['cdal trace --enforce passes'],\n status: 'TODO',\n priority: 'HIGH',\n source: 'cdal.config.mjs',\n },\n];\n`;\n writeFileSync(sampleContractPath, sampleContractContent, 'utf8');\n console.log(\n pc.green(` ✓ Created starter contract: ${pc.bold('contracts/requirements.contract.mjs')}`),\n );\n }\n\n // 2. Create cdal.config.mjs if missing\n const configPath = join(cwd, 'cdal.config.mjs');\n if (!existsSync(configPath)) {\n const runtimesFormatted = rawRuntimes.map((r) => `'${r}'`).join(', ');\n const configContent = `import { defineConfig } from '@cdal/core';\nimport { policies, requirements, stateMachine } from '@cdal/kinds';\n\nexport default defineConfig({\n contractsDir: 'contracts',\n generated: {\n ts: 'src/generated/contracts',\n docs: 'docs/generated',\n },\n kinds: [requirements(), stateMachine(), policies()],\n presets: ['${preset}'],\n runtimes: [${runtimesFormatted}],\n verify: [\n 'cdal validate --strict',\n 'cdal codegen --check',\n 'cdal trace --enforce',\n 'cdal selftest',\n ],\n});\n`;\n writeFileSync(configPath, configContent, 'utf8');\n console.log(pc.green(` ✓ Created configuration: ${pc.bold('cdal.config.mjs')}`));\n } else {\n console.log(\n pc.dim(' ℹ cdal.config.mjs already exists (preserving existing configuration).'),\n );\n }\n\n // 3. Update package.json scripts if package.json exists\n const pkgPath = join(cwd, 'package.json');\n if (existsSync(pkgPath)) {\n try {\n const pkgRaw = readFileSync(pkgPath, 'utf8');\n const pkg = JSON.parse(pkgRaw);\n pkg.scripts = pkg.scripts || {};\n let updated = false;\n\n if (!pkg.scripts.verify) {\n pkg.scripts.verify = 'cdal verify';\n updated = true;\n }\n if (!pkg.scripts.selftest) {\n pkg.scripts.selftest = 'cdal selftest';\n updated = true;\n }\n if (!pkg.scripts.trace) {\n pkg.scripts.trace = 'cdal trace';\n updated = true;\n }\n\n if (updated) {\n writeFileSync(pkgPath, `${JSON.stringify(pkg, null, 2)}\\n`, 'utf8');\n console.log(\n pc.green(` ✓ Added verify/selftest/trace scripts to ${pc.bold('package.json')}`),\n );\n }\n } catch {\n console.log(pc.yellow(' ⚠️ Could not update package.json scripts automatically.'));\n }\n }\n\n // 4. Synchronize adapter files across selected runtimes\n const resolvedConfig = resolveConfig({\n presets: [preset],\n runtimes: rawRuntimes,\n });\n\n const syncRes = syncAdapters({\n cwd,\n config: resolvedConfig,\n check: false,\n });\n\n console.log(\n pc.green(\n ` ✓ Generated ${syncRes.updatedFiles.length} runtime adapter file(s) across [${rawRuntimes.join(', ')}].`,\n ),\n );\n\n console.log(pc.bold(pc.green('\\n🎉 CDAL initialized successfully!')));\n console.log(pc.cyan('Next steps:'));\n console.log(pc.dim(' 1. Review contracts in contracts/*.contract.mjs'));\n console.log(pc.dim(' 2. Run `npx cdalkit doctor` to verify environment health'));\n console.log(pc.dim(' 3. Run `npx cdalkit verify` to test the loop gate\\n'));\n },\n});\n","import { type PhaseType, checkPhase, loadConfig } from '@cdal/core';\nimport { defineCommand } from 'citty';\nimport pc from 'picocolors';\n\nexport const phaseCommand = defineCommand({\n meta: {\n name: 'phase',\n description: 'Verify git diff against active loop phase (contract, red, green)',\n },\n args: {\n phase: {\n type: 'positional',\n description: 'Phase to verify: contract, red, green',\n required: true,\n },\n base: {\n type: 'string',\n description: 'Base git reference to compare against (e.g. main or origin/main)',\n },\n json: {\n type: 'boolean',\n description: 'Output as JSON payload',\n default: false,\n },\n config: {\n type: 'string',\n description: 'Path to cdal.config.mjs',\n },\n },\n async run({ args }) {\n const rawPhase = (args.phase || '').toLowerCase();\n if (!['contract', 'red', 'green'].includes(rawPhase)) {\n console.error(pc.red(`Invalid phase \"${rawPhase}\". Valid phases are: contract, red, green.`));\n process.exit(2);\n }\n const phase = rawPhase as PhaseType;\n\n const cwd = process.cwd();\n const { config: resolvedConfig } = await loadConfig(args.config);\n\n const result = checkPhase(phase, {\n cwd,\n base: args.base,\n protectedPaths: resolvedConfig?.protectedPaths,\n });\n\n if (args.json) {\n console.log(JSON.stringify(result, null, 2));\n process.exit(result.ok ? 0 : 1);\n }\n\n console.log(pc.bold(`\\n Phase: ${result.label}`));\n console.log(` Modified files in diff: ${result.files.length}\\n`);\n\n if (result.violations.length === 0) {\n if (result.files.length === 0) {\n if (phase === 'red') {\n console.log(\n pc.yellow(\n ' ⚠ No changes found in working tree. Phase RED requires at least one test.',\n ),\n );\n process.exit(1);\n }\n console.log(pc.dim(' No changes found in working tree.'));\n process.exit(0);\n }\n console.log(pc.green(' ✔ All changes are within active phase scopes.'));\n process.exit(0);\n }\n\n console.log(\n pc.red(` ✗ ${result.violations.length} file(s) outside of permitted phase scope:\\n`),\n );\n for (const v of result.violations) {\n console.log(` - ${v}`);\n }\n console.log(pc.dim(`\\n ${result.why}\\n`));\n process.exit(1);\n },\n});\n","import { execFileSync } from 'node:child_process';\nimport { existsSync, mkdtempSync, rmSync } from 'node:fs';\nimport { tmpdir } from 'node:os';\nimport { join, resolve } from 'node:path';\nimport { defineCommand } from 'citty';\nimport pc from 'picocolors';\nimport { ProInstallError, installPro } from '../pro/install.js';\n\nexport const PRO_REPOSITORY_URL = 'https://github.com/cdalkit/cdal-pro.git';\nexport const PRO_TEAM_REPOSITORY_URL = 'https://github.com/cdalkit/cdal-pro-team.git';\n\n/** The private repository to install from: cdal-pro, or cdal-pro-team with --team. */\nexport function proRepositoryUrl(team: boolean): string {\n return team ? PRO_TEAM_REPOSITORY_URL : PRO_REPOSITORY_URL;\n}\n\n/** Clones a git source into a temp directory; local directories are used as-is. */\nfunction resolveSource(from: string): { dir: string; cleanup: () => void } {\n const local = resolve(from);\n if (existsSync(local)) return { dir: local, cleanup: () => {} };\n\n const dir = mkdtempSync(join(tmpdir(), 'cdal-pro-'));\n const cleanup = () => rmSync(dir, { recursive: true, force: true });\n try {\n execFileSync('git', ['clone', '--depth', '1', '--quiet', from, dir], {\n stdio: ['ignore', 'ignore', 'pipe'],\n });\n } catch {\n cleanup();\n throw new ProInstallError(\n `Could not clone ${from}.\\n 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.`,\n );\n }\n return { dir, cleanup };\n}\n\nconst installCommand = defineCommand({\n meta: {\n name: 'install',\n description: 'Install CDAL Pro content (agent roles, templates, presets) into this project',\n },\n args: {\n from: {\n type: 'string',\n description:\n 'Local copy or git URL of the Pro repository (default: cdal-pro, or cdal-pro-team with --team)',\n },\n team: {\n type: 'boolean',\n description: 'Install CDAL Pro Team (editor guards, presets, playbook) from cdal-pro-team',\n default: false,\n },\n cwd: {\n type: 'string',\n description: 'Project directory to install into',\n default: '.',\n },\n force: {\n type: 'boolean',\n description: 'Overwrite files that already exist in the project',\n default: false,\n },\n dryRun: {\n type: 'boolean',\n description: 'Show what would be installed without writing anything',\n default: false,\n },\n },\n run({ args }) {\n let source: { dir: string; cleanup: () => void } | undefined;\n try {\n source = resolveSource(args.from || proRepositoryUrl(args.team));\n const result = installPro({\n sourceDir: source.dir,\n targetDir: resolve(args.cwd),\n force: args.force,\n dryRun: args.dryRun,\n });\n\n const verb = args.dryRun ? 'Would install' : 'Installed';\n console.log(pc.green(`✔ ${verb} ${result.name} ${result.version}`));\n console.log(` ${result.written.length} file(s) ${args.dryRun ? 'to write' : 'written'}`);\n if (result.skipped.length > 0) {\n console.log(\n pc.yellow(\n ` ${result.skipped.length} existing file(s) kept — rerun with --force to overwrite:`,\n ),\n );\n for (const file of result.skipped) console.log(pc.dim(` ${file}`));\n }\n if (!args.dryRun) {\n console.log(pc.dim(' Run `npx cdalkit sync` to wire the new roles into your runtimes.'));\n }\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n console.error(pc.red(`✖ ${message}`));\n process.exit(1);\n } finally {\n source?.cleanup();\n }\n },\n});\n\nexport const proCommand = defineCommand({\n meta: {\n name: 'pro',\n description: 'CDAL Pro: install licensed agent roles, templates and presets',\n },\n subCommands: {\n install: installCommand,\n },\n});\n","import {\n copyFileSync,\n existsSync,\n mkdirSync,\n readFileSync,\n readdirSync,\n statSync,\n writeFileSync,\n} from 'node:fs';\nimport { dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';\n\nexport const PRO_MANIFEST_FILE = 'pro.manifest.json';\nexport const PRO_RECORD_FILE = '.cdal/pro.json';\n\n/** Where an installed Pro package records its version: .cdal/pro.json for cdal-pro, .cdal/<name>.json otherwise. */\nexport function proRecordFile(name: string): string {\n return name === 'cdal-pro' ? PRO_RECORD_FILE : `.cdal/${name.replace(/^cdal-/, '')}.json`;\n}\n\n// Files carrying these markers were generated by `cdalkit sync`/`init` and can be regenerated,\n// so Pro content may replace them; anything else in the project is user-owned.\nconst GENERATED_MARKERS = ['CDAL GENERATED', 'GENERATED by cdal sync'];\n\nfunction isGeneratedFile(path: string): boolean {\n const content = readFileSync(path, 'utf8');\n return GENERATED_MARKERS.some((marker) => content.includes(marker));\n}\n\nexport class ProInstallError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'ProInstallError';\n }\n}\n\nexport interface ProManifest {\n name: string;\n version: string;\n install: Array<{ from: string; to: string }>;\n}\n\nexport interface ProInstallOptions {\n /** Directory containing pro.manifest.json (a clone of cdal-pro or a local copy). */\n sourceDir: string;\n /** Project root to install into. */\n targetDir: string;\n /** Overwrite files that already exist in the project. */\n force?: boolean;\n /** Report what would be written without touching the project. */\n dryRun?: boolean;\n}\n\nexport interface ProInstallResult {\n name: string;\n version: string;\n /** Project-relative paths written (or, in dry-run mode, that would be written). */\n written: string[];\n /** Project-relative paths left untouched because they already exist. */\n skipped: string[];\n}\n\nfunction toPosix(path: string): string {\n return path.split(sep).join('/');\n}\n\n/** Resolves `rel` under `root`, refusing absolute paths and anything that escapes `root`. */\nfunction resolveInside(root: string, rel: string, label: string): string {\n if (typeof rel !== 'string' || rel.length === 0 || isAbsolute(rel)) {\n throw new ProInstallError(`Invalid ${label} path in ${PRO_MANIFEST_FILE}: \"${rel}\"`);\n }\n const full = resolve(root, rel);\n const fromRoot = relative(root, full);\n if (fromRoot.startsWith('..') || isAbsolute(fromRoot)) {\n throw new ProInstallError(`${label} path \"${rel}\" escapes its directory`);\n }\n return full;\n}\n\nexport function readProManifest(sourceDir: string): ProManifest {\n const manifestPath = join(sourceDir, PRO_MANIFEST_FILE);\n if (!existsSync(manifestPath)) {\n throw new ProInstallError(`No ${PRO_MANIFEST_FILE} found in ${sourceDir}`);\n }\n let manifest: ProManifest;\n try {\n manifest = JSON.parse(readFileSync(manifestPath, 'utf8')) as ProManifest;\n } catch (err) {\n throw new ProInstallError(\n `${PRO_MANIFEST_FILE} is not valid JSON: ${err instanceof Error ? err.message : String(err)}`,\n );\n }\n if (!manifest.name || !manifest.version || !Array.isArray(manifest.install)) {\n throw new ProInstallError(`${PRO_MANIFEST_FILE} must define name, version and install[]`);\n }\n return manifest;\n}\n\nfunction listFiles(dir: string): string[] {\n const files: string[] = [];\n for (const entry of readdirSync(dir, { withFileTypes: true })) {\n const full = join(dir, entry.name);\n if (entry.isDirectory()) files.push(...listFiles(full));\n else if (entry.isFile()) files.push(full);\n }\n return files;\n}\n\nexport function installPro(options: ProInstallOptions): ProInstallResult {\n const sourceDir = resolve(options.sourceDir);\n const targetDir = resolve(options.targetDir);\n const manifest = readProManifest(sourceDir);\n\n // Resolve every mapping before writing anything, so a bad entry aborts cleanly.\n const plan: Array<{ src: string; dest: string; rel: string }> = [];\n for (const mapping of manifest.install) {\n const from = resolveInside(sourceDir, mapping.from, 'from');\n const to = resolveInside(targetDir, mapping.to, 'to');\n if (!existsSync(from)) {\n throw new ProInstallError(`Manifest source \"${mapping.from}\" does not exist`);\n }\n const sources = statSync(from).isDirectory() ? listFiles(from) : [from];\n for (const src of sources) {\n const dest = statSync(from).isDirectory() ? join(to, relative(from, src)) : to;\n plan.push({ src, dest, rel: toPosix(relative(targetDir, dest)) });\n }\n }\n\n const written: string[] = [];\n const skipped: string[] = [];\n for (const { src, dest, rel } of plan) {\n if (existsSync(dest) && !options.force && !isGeneratedFile(dest)) {\n skipped.push(rel);\n continue;\n }\n written.push(rel);\n if (!options.dryRun) {\n mkdirSync(dirname(dest), { recursive: true });\n copyFileSync(src, dest);\n }\n }\n\n if (!options.dryRun) {\n const recordPath = join(targetDir, proRecordFile(manifest.name));\n mkdirSync(dirname(recordPath), { recursive: true });\n writeFileSync(\n recordPath,\n `${JSON.stringify(\n {\n name: manifest.name,\n version: manifest.version,\n installedAt: new Date().toISOString(),\n files: plan.map((p) => p.rel).sort(),\n },\n null,\n 2,\n )}\\n`,\n 'utf8',\n );\n }\n\n return { name: manifest.name, version: manifest.version, written, skipped };\n}\n","import { loadConfig, runSelftest } from '@cdal/core';\nimport { defineCommand } from 'citty';\nimport pc from 'picocolors';\n\nexport const selftestCommand = defineCommand({\n meta: {\n name: 'selftest',\n description: 'Run mutation testing on contract invariant rules and content guardrails',\n },\n args: {\n json: {\n type: 'boolean',\n description: 'Output as JSON payload (selftest.v1)',\n default: false,\n },\n config: {\n type: 'string',\n description: 'Path to cdal.config.mjs',\n },\n },\n async run({ args }) {\n const cwd = process.cwd();\n const { config: resolvedConfig } = await loadConfig(args.config);\n\n if (!args.json) {\n console.log(pc.bold(pc.cyan('\\n cdal selftest — mutation testing of quality gates')));\n console.log(\n pc.dim(' Testing whether validator and guardrails actually fire red when violated\\n'),\n );\n }\n\n const report = await runSelftest({\n cwd,\n config: resolvedConfig,\n });\n\n if (args.json) {\n console.log(JSON.stringify(report, null, 2));\n process.exit(report.ok ? 0 : 1);\n }\n\n // Display mutation results\n if (report.mutationResults.length > 0) {\n console.log(\n pc.bold(\n ` Contract Invariant Mutations (${report.mutationsPassed}/${report.mutationsTotal}):`,\n ),\n );\n for (const m of report.mutationResults) {\n if (m.passed) {\n console.log(\n ` ${pc.green('✔')} ${pc.cyan(m.rule.padEnd(26))} detected in ${pc.dim(m.file)}`,\n );\n } else {\n console.log(\n ` ${pc.red('✗')} ${pc.red(m.rule.padEnd(26))} ${pc.bold('MISSED')}: ${m.error ?? 'rule dead'}`,\n );\n }\n }\n console.log('');\n }\n\n // Display content probe results\n if (report.probeResults.length > 0) {\n console.log(\n pc.bold(` Forbidden Content Probes (${report.probesPassed}/${report.probesTotal}):`),\n );\n for (const p of report.probeResults) {\n const action = p.fires ? 'detected' : 'allowed';\n if (p.passed) {\n console.log(\n ` ${pc.green('✔')} ${pc.cyan(p.rule.padEnd(30))} ${pc.green(action)}: ${p.desc}`,\n );\n } else {\n console.log(\n ` ${pc.red('✗')} ${pc.red(p.rule.padEnd(30))} ${pc.bold('FAILED')}: ${p.error ?? 'unexpected behavior'}`,\n );\n }\n }\n console.log('');\n }\n\n // Summary\n console.log(\n pc.bold(\n ` Summary: ${report.mutationsPassed}/${report.mutationsTotal} contract rules verified via mutation.`,\n ),\n );\n console.log(\n pc.bold(\n ` ${report.probesPassed}/${report.probesTotal} content guardrail probes verified.\\n`,\n ),\n );\n if (report.skippedKinds.length > 0) {\n console.log(pc.dim(` Skipped (no contract file yet): ${report.skippedKinds.join(', ')}\\n`));\n }\n\n if (report.failures.length > 0) {\n console.log(pc.bold(pc.red(' CRITICAL GATE FAILURES:')));\n for (const f of report.failures) {\n console.log(` - ${pc.red(f)}`);\n }\n console.log('');\n process.exit(1);\n }\n\n console.log(pc.green(pc.bold(' ✔ Every quality gate rule is verified active and firing.\\n')));\n process.exit(0);\n },\n});\n","import { syncAdapters } from '@cdal/adapters';\nimport { loadConfig } from '@cdal/core';\nimport { defineCommand } from 'citty';\nimport pc from 'picocolors';\n\nexport const syncCommand = defineCommand({\n meta: {\n name: 'sync',\n description:\n 'Synchronize agent definitions, commands, hooks and rules across configured runtimes (with --check drift detection)',\n },\n args: {\n check: {\n type: 'boolean',\n description:\n 'Check for drift between cdal.config.mjs and runtime files without modifying disk',\n default: false,\n },\n config: {\n type: 'string',\n description: 'Custom path to cdal.config.mjs',\n },\n cwd: {\n type: 'string',\n description: 'Working directory path',\n },\n },\n async run({ args }) {\n try {\n const cwd = args.cwd || process.cwd();\n const { config } = await loadConfig(args.config || cwd);\n\n const res = syncAdapters({\n cwd,\n config,\n check: Boolean(args.check),\n });\n\n if (args.check) {\n if (res.inSync) {\n console.log(\n pc.green(\n `✅ Sync check passed: all ${res.totalFiles} adapter file(s) are in sync across [${config.runtimes.join(', ')}].`,\n ),\n );\n } else {\n console.error(\n pc.red(\n `❌ Sync check failed: ${res.driftedFiles.length} adapter file(s) drifted from configuration:`,\n ),\n );\n for (const file of res.driftedFiles) {\n console.error(pc.red(` - [DRIFT] ${file}`));\n }\n console.error(\n pc.yellow(\n '\\nRun `npx cdalkit sync` to synchronize runtime files with cdal.config.mjs.',\n ),\n );\n process.exit(1);\n }\n } else {\n console.log(\n pc.green(\n `✅ Synchronized ${res.updatedFiles.length} adapter file(s) across [${config.runtimes.join(', ')}]:`,\n ),\n );\n for (const file of res.updatedFiles) {\n console.log(pc.cyan(` - ${file}`));\n }\n if (res.updatedFiles.length === 0) {\n console.log(pc.dim(' (All files were already up-to-date)'));\n }\n }\n if (res.preservedFiles.length > 0) {\n console.log(\n pc.dim(\n ` ${res.preservedFiles.length} file(s) marked cdal:preserve were left untouched.`,\n ),\n );\n }\n } catch (err: unknown) {\n const msg = err instanceof Error ? err.message : String(err);\n console.error(pc.red(`❌ Fatal error during sync: ${msg}`));\n process.exit(1);\n }\n },\n});\n","import path from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport {\n type TraceRequirement,\n formatTraceMarkdown,\n formatTraceText,\n loadConfig,\n scanTrace,\n} from '@cdal/core';\nimport { defineCommand } from 'citty';\nimport pc from 'picocolors';\n\nexport const traceCommand = defineCommand({\n meta: {\n name: 'trace',\n description: 'Inspect requirement-to-test traceability matrix (@REQ tags)',\n },\n args: {\n enforce: {\n type: 'boolean',\n description:\n 'Exit with code 1 if any implementing/done requirement lacks tests, tests fail, or unknown @REQ tags exist',\n default: false,\n },\n markdown: {\n type: 'boolean',\n description: 'Output as Markdown table ready for pull request description',\n default: false,\n },\n json: {\n type: 'boolean',\n description: 'Output as structured JSON (trace.v1)',\n default: false,\n },\n results: {\n type: 'string',\n description: 'Path to test execution JSON results file (vitest or playwright json reporter)',\n },\n config: {\n type: 'string',\n description: 'Path to cdal.config.mjs',\n },\n },\n async run({ args }) {\n const cwd = process.cwd();\n const { config: resolvedConfig } = await loadConfig(args.config);\n\n const contractsDir = resolvedConfig?.contractsDir ?? 'contracts';\n const reqContractPath = path.resolve(cwd, contractsDir, 'requirements.contract.mjs');\n\n let requirements: TraceRequirement[] = [];\n try {\n const imported = await import(pathToFileURL(reqContractPath).href);\n requirements = (imported.REQUIREMENTS ||\n imported.default?.REQUIREMENTS ||\n imported.default ||\n []) as TraceRequirement[];\n } catch (err: unknown) {\n const errorMsg = err instanceof Error ? err.message : String(err);\n console.error(pc.red(`Failed to load requirements from \"${reqContractPath}\": ${errorMsg}`));\n process.exit(1);\n }\n\n if (!Array.isArray(requirements) || requirements.length === 0) {\n console.warn(pc.yellow(`No requirements found in \"${reqContractPath}\".`));\n if (args.enforce) process.exit(1);\n return;\n }\n\n const report = scanTrace(requirements, {\n cwd,\n resultsFile: args.results,\n });\n\n if (args.json) {\n console.log(JSON.stringify(report, null, 2));\n } else if (args.markdown) {\n console.log(formatTraceMarkdown(report));\n } else {\n console.log(formatTraceText(report));\n }\n\n if (args.enforce && !report.ok) {\n process.exit(1);\n }\n },\n});\n","import { formatFindingsText, runValidation } from '@cdal/core';\nimport { defineCommand } from 'citty';\nimport pc from 'picocolors';\nimport { resolveCommandKinds } from '../kinds.js';\n\nexport const validateCommand = defineCommand({\n meta: {\n name: 'validate',\n description: 'Validate contract invariants across all registered contract kinds',\n },\n args: {\n strict: {\n type: 'boolean',\n description: 'Treat warnings as failures (exit 1)',\n default: false,\n },\n json: {\n type: 'boolean',\n description: 'Output findings using machine-readable findings.v1 JSON schema',\n default: false,\n },\n dir: {\n type: 'string',\n description: 'Custom path to contracts directory',\n },\n },\n async run({ args }) {\n try {\n const kinds = await resolveCommandKinds();\n\n const report = await runValidation({\n contractsDir: args.dir,\n strict: Boolean(args.strict),\n kinds,\n });\n\n if (args.json) {\n console.log(JSON.stringify(report, null, 2));\n } else {\n const text = formatFindingsText(report, Boolean(args.strict));\n if (report.valid) {\n console.log(pc.green(text));\n } else {\n console.error(pc.red(text));\n }\n }\n\n if (!report.valid) {\n process.exit(1);\n }\n } catch (err: unknown) {\n const msg = err instanceof Error ? err.message : String(err);\n console.error(pc.red(`❌ Fatal error during contract validation: ${msg}`));\n process.exit(1);\n }\n },\n});\n","import { spawnSync } from 'node:child_process';\nimport { loadConfig } from '@cdal/core';\nimport { defineCommand } from 'citty';\nimport pc from 'picocolors';\n\nexport const verifyCommand = defineCommand({\n meta: {\n name: 'verify',\n description: 'Run deterministic CDAL verification pipeline defined in configuration',\n },\n args: {\n fast: {\n type: 'boolean',\n description: 'Run fast subset of verification steps (contract checks & selftest)',\n default: false,\n },\n full: {\n type: 'boolean',\n description: 'Force execution of all verification steps',\n default: false,\n },\n clean: {\n type: 'boolean',\n description: 'Clear temporary caches before running verification',\n default: false,\n },\n config: {\n type: 'string',\n description: 'Path to cdal.config.mjs',\n },\n cwd: {\n type: 'string',\n description: 'Working directory path',\n },\n },\n async run({ args }) {\n const cwd = args.cwd || process.cwd();\n const { config } = await loadConfig(args.config || cwd);\n\n let steps = [...config.verify];\n\n if (args.fast) {\n // In fast mode, run contract validation, codegen drift check, and selftest\n steps = steps.filter(\n (s) =>\n s.includes('validate') ||\n s.includes('codegen') ||\n s.includes('selftest') ||\n s.includes('typecheck'),\n );\n if (steps.length === 0) {\n steps = [config.verify[0] ?? 'cdal validate --strict'];\n }\n }\n\n console.log(\n pc.bold(pc.cyan(`\\n⚡ Running CDAL Verification Pipeline (${steps.length} step(s))...\\n`)),\n );\n\n for (let i = 0; i < steps.length; i++) {\n const step = steps[i];\n if (!step) continue;\n console.log(pc.bold(pc.blue(`[${i + 1}/${steps.length}] ▶ ${step}`)));\n\n const start = Date.now();\n const res = spawnSync(step, {\n cwd,\n shell: true,\n stdio: 'inherit',\n });\n const duration = Date.now() - start;\n\n if (res.status !== 0) {\n console.error(\n pc.bold(\n pc.red(\n `\\n❌ Verification failed at step: \"${step}\" (exit code ${res.status ?? 1}, took ${duration}ms)`,\n ),\n ),\n );\n process.exit(res.status ?? 1);\n }\n\n console.log(pc.green(` ✓ Step passed in ${duration}ms\\n`));\n }\n\n console.log(\n pc.bold(\n pc.green(`✅ Full verification pipeline succeeded (${steps.length} step(s) passed).`),\n ),\n );\n },\n});\n","import { closeContractWindow, getContractWindowStatus, openContractWindow } from '@cdal/core';\nimport { defineCommand } from 'citty';\nimport pc from 'picocolors';\n\nexport const windowCommand = defineCommand({\n meta: {\n name: 'window',\n description: 'Manage contract window for protected path modifications',\n },\n args: {\n action: {\n type: 'positional',\n description: 'Action to perform: open, close, status',\n required: true,\n },\n ticket: {\n type: 'positional',\n description: 'Ticket or reason ID (required for open)',\n required: false,\n },\n duration: {\n type: 'string',\n description: 'Window duration in minutes (default: 60)',\n default: '60',\n },\n },\n run({ args }) {\n const action = args.action.toLowerCase();\n\n if (action === 'open') {\n const ticket = args.ticket;\n if (!ticket) {\n console.error(\n pc.red(\n 'Error: \"cdal window open\" requires a ticket or work order argument. Example: cdal window open WO-123',\n ),\n );\n process.exit(1);\n }\n const durationMinutes = Number.parseInt(args.duration, 10) || 60;\n const status = openContractWindow(ticket, { durationMinutes });\n console.log(pc.green(`✔ Contract window opened for ticket: ${pc.bold(status.ticket)}`));\n console.log(pc.dim(` Expires at: ${status.expiresAt}`));\n return;\n }\n\n if (action === 'close') {\n closeContractWindow();\n console.log(pc.green('✔ Contract window closed. Protected paths are locked.'));\n return;\n }\n\n if (action === 'status') {\n const status = getContractWindowStatus();\n if (status.open) {\n console.log(pc.green(`Contract window is ${pc.bold('OPEN')}`));\n console.log(` Ticket: ${status.ticket ?? 'none'}`);\n console.log(` Opened at: ${status.openedAt ?? 'unknown'}`);\n console.log(` Expires at: ${status.expiresAt ?? 'unknown'}`);\n } else {\n console.log(pc.yellow(`Contract window is ${pc.bold('CLOSED')}`));\n }\n return;\n }\n\n console.error(pc.red(`Unknown action \"${action}\". Available actions: open, close, status`));\n process.exit(1);\n },\n});\n"],"mappings":";AAAA,SAAS,qBAAqB;AAC9B,SAAS,WAAW,cAAc,iBAAAA,uBAAqB;;;ACDvD,SAAS,qBAAqB;AAC9B,SAAS,eAAe;AACxB,SAAS,kBAAkB,sBAAsB,gBAAgB;AAEjE,SAAS,qBAAqB;AAC9B,OAAO,QAAQ;AAER,IAAM,eAAe,cAAc;AAAA,EACxC,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,aACE;AAAA,EACJ;AAAA,EACA,MAAM;AAAA,IACJ,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,aAAa;AAAA,MACb,UAAU;AAAA,MACV,SAAS;AAAA,IACX;AAAA,IACA,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,aAAa;AAAA,MACb,UAAU;AAAA,IACZ;AAAA,IACA,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,aAAa;AAAA,MACb,SAAS;AAAA,IACX;AAAA,IACA,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,aAAa;AAAA,MACb,SAAS;AAAA,IACX;AAAA,IACA,WAAW;AAAA,MACT,MAAM;AAAA,MACN,aAAa;AAAA,MACb,UAAU;AAAA,IACZ;AAAA,EACF;AAAA,EACA,MAAM,IAAI,EAAE,KAAK,GAAG;AAClB,UAAM,YAAY,QAAQ,KAAK,QAAQ,GAAG;AAC1C,UAAM,OAAQ,KAAK,SAAS,OAAO,OAAO;AAE1C,QAAI,CAAC,KAAK,MAAM;AACd,cAAQ,IAAI,GAAG,KAAK,GAAG,KAAK,2DAAoD,CAAC,CAAC;AAAA,IACpF;A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AAEA,QAAI,WAAW,SAAS;AACtB,0BAAoB;AACpB,cAAQ,IAAIA,KAAG,MAAM,4DAAuD,CAAC;AAC7E;AAAA,IACF;AAEA,QAAI,WAAW,UAAU;AACvB,YAAM,SAAS,wBAAwB;AACvC,UAAI,OAAO,MAAM;AACf,gBAAQ,IAAIA,KAAG,MAAM,sBAAsBA,KAAG,KAAK,MAAM,CAAC,EAAE,CAAC;AAC7D,gBAAQ,IAAI,iBAAiB,OAAO,UAAU,MAAM,EAAE;AACtD,gBAAQ,IAAI,iBAAiB,OAAO,YAAY,SAAS,EAAE;AAC3D,gBAAQ,IAAI,iBAAiB,OAAO,aAAa,SAAS,EAAE;AAAA,MAC9D,OAAO;AACL,gBAAQ,IAAIA,KAAG,OAAO,sBAAsBA,KAAG,KAAK,QAAQ,CAAC,EAAE,CAAC;AAAA,MAClE;AACA;AAAA,IACF;AAEA,YAAQ,MAAMA,KAAG,IAAI,mBAAmB,MAAM,2CAA2C,CAAC;AAC1F,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF,CAAC;;;AfnDD,IAAM,EAAE,QAAQ,IAAI,cAAc,YAAY,GAAG,EAAE,iBAAiB;AAEpE,IAAM,OAAOC,gBAAc;AAAA,EACzB,MAAM;AAAA,IACJ,MAAM;AAAA,IACN;AAAA,IACA,aAAa;AAAA,EACf;AAAA,EACA,aAAa;AAAA,IACX,MAAM;AAAA,IACN,UAAU;AAAA,IACV,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,OAAO;AAAA,IACP,UAAU;AAAA,IACV,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,OAAO;AAAA,IACP,KAAK;AAAA,EACP;AACF,CAAC;AAEM,SAAS,UAAU;AACxB,eAAa,IAAI;AACnB;","names":["defineCommand","defineCommand","pc","defineCommand","pc","loadConfig","runCodegen","defineCommand","pc","loadConfig","defineCommand","existsSync","readFileSync","writeFileSync","join","syncAdapters","defineCommand","pc","loadConfig","defineCommand","pc","existsSync","join","resolve","defineCommand","pc","existsSync","mkdirSync","readFileSync","writeFileSync","join","resolve","path","resolve","existsSync","join","defineCommand","pc","loadConfig","defineCommand","pc","syncAdapters","loadConfig","defineCommand","pc","loadConfig","defineCommand","pc","requirements","defineCommand","pc","defineCommand","pc","spawnSync","loadConfig","defineCommand","pc","defineCommand","pc","defineCommand"]}
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * cdal CLI package exports\n */\n\nexport * from '@cdal/core';\nexport * from '@cdal/kinds';\nexport * from '@cdal/adapters';\nexport * from '@cdal/audit';\n"],"mappings":";AAIA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}