@combric/cli 1.0.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 +21 -0
- package/README.md +98 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +4 -0
- package/dist/bin.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +192 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +15 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +87 -0
- package/dist/config.js.map +1 -0
- package/dist/doctor.d.ts +3 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +79 -0
- package/dist/doctor.js.map +1 -0
- package/dist/execute.d.ts +3 -0
- package/dist/execute.d.ts.map +1 -0
- package/dist/execute.js +87 -0
- package/dist/execute.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/inspect.d.ts +9 -0
- package/dist/inspect.d.ts.map +1 -0
- package/dist/inspect.js +236 -0
- package/dist/inspect.js.map +1 -0
- package/dist/model.d.ts +54 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/model.js +10 -0
- package/dist/model.js.map +1 -0
- package/dist/plan.d.ts +8 -0
- package/dist/plan.d.ts.map +1 -0
- package/dist/plan.js +128 -0
- package/dist/plan.js.map +1 -0
- package/dist/requirements.d.ts +4 -0
- package/dist/requirements.d.ts.map +1 -0
- package/dist/requirements.js +19 -0
- package/dist/requirements.js.map +1 -0
- package/package.json +36 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Combric contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# `@combric/cli`
|
|
2
|
+
|
|
3
|
+
The optional `combric` command configures an **existing** package project and
|
|
4
|
+
reports its detected state. Applications can install and use Combric packages
|
|
5
|
+
without it. This repository is prepared for release, but does not claim that the
|
|
6
|
+
package has been published to npm.
|
|
7
|
+
|
|
8
|
+
After publication, install it with `npm install --save-dev @combric/cli`.
|
|
9
|
+
Node.js 24 or newer is required. The public entry points are the `combric`
|
|
10
|
+
executable and the package-root TypeScript/ESM declarations.
|
|
11
|
+
|
|
12
|
+
## Commands
|
|
13
|
+
|
|
14
|
+
| Command | Effect |
|
|
15
|
+
| ------------------------- | ----------------------------------------------- |
|
|
16
|
+
| `combric --help` | List the supported commands and options. |
|
|
17
|
+
| `combric --version` | Print the version from this package's metadata. |
|
|
18
|
+
| `combric info [--json]` | Read-only project facts. |
|
|
19
|
+
| `combric doctor [--json]` | Read-only health checks. |
|
|
20
|
+
| `combric init` | Configure an existing project after planning. |
|
|
21
|
+
|
|
22
|
+
Use `--project <directory>` to select an existing package directory. Otherwise
|
|
23
|
+
the CLI searches upward from the current directory for `package.json`. `info`
|
|
24
|
+
and `doctor` never change project files. JSON output has `schemaVersion: 1` and
|
|
25
|
+
stable named fields; errors in JSON mode contain `error.code`, `error.message`,
|
|
26
|
+
and `exitCode`.
|
|
27
|
+
|
|
28
|
+
## Setup
|
|
29
|
+
|
|
30
|
+
Choose a mode and an **existing** CSS entry explicitly:
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
combric init --mode css --css-file src/styles.css --dry-run
|
|
34
|
+
combric init --mode css --css-file src/styles.css --yes
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Supported modes:
|
|
38
|
+
|
|
39
|
+
- `css`: declare `@combric/tokens` and import `@combric/tokens/css`.
|
|
40
|
+
- `react`: declare `@combric/react`, React 19 and React DOM 19; import
|
|
41
|
+
`@combric/react/css`.
|
|
42
|
+
- `tailwind`: require existing compatible Tailwind CSS `>=4.3 <5`; declare the
|
|
43
|
+
optional adapter and import `tailwindcss` plus `@combric/tailwind`.
|
|
44
|
+
- `react-tailwind`: combine the React and optional Tailwind paths.
|
|
45
|
+
|
|
46
|
+
The CLI uses detected pnpm, npm, yarn, or bun evidence. If none exists, pass
|
|
47
|
+
`--package-manager <name>`. Conflicting metadata or lockfiles require manual
|
|
48
|
+
resolution. The CLI does not install a package manager, convert Tailwind
|
|
49
|
+
versions, guess a CSS file, or scaffold an application. If this is a workspace
|
|
50
|
+
root and packages are missing, select the intended member package with
|
|
51
|
+
`--project` so installation has a clear scope.
|
|
52
|
+
|
|
53
|
+
`--dry-run` returns the same operation plan used by `--yes` and makes no
|
|
54
|
+
persistent changes. `--dry-run --json` emits the plan for automation. An init
|
|
55
|
+
without `--yes` or `--dry-run` stops without prompting. Repeating a completed
|
|
56
|
+
init makes no changes.
|
|
57
|
+
|
|
58
|
+
Before publication, if a selected package is missing from an external project,
|
|
59
|
+
package-manager installation will fail until publication or a local
|
|
60
|
+
tarball/workspace is supplied. The CLI reports that failure and does not write
|
|
61
|
+
Combric CSS or config afterward. Local project fixtures and packed tarballs
|
|
62
|
+
verify this flow without public npm availability. On Windows, run setup through
|
|
63
|
+
the chosen package manager (for example, `pnpm exec combric`) so its JavaScript
|
|
64
|
+
entry is available for safe process spawning.
|
|
65
|
+
|
|
66
|
+
## Project config
|
|
67
|
+
|
|
68
|
+
Successful setup writes `combric.config.json`:
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"schemaVersion": 1,
|
|
73
|
+
"packageManager": "pnpm",
|
|
74
|
+
"mode": "react",
|
|
75
|
+
"cssFile": "src/styles.css"
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
The schema version is independent of the package version. Unknown schema
|
|
80
|
+
versions fail with guidance. `info` and `doctor` can report unknown fields;
|
|
81
|
+
`init` will not rewrite a config containing them. CSS target paths must stay
|
|
82
|
+
inside the project, exist already, and resolve inside it even through links.
|
|
83
|
+
Existing conflicting Combric imports are not overwritten.
|
|
84
|
+
|
|
85
|
+
## Exit behavior
|
|
86
|
+
|
|
87
|
+
- `0`: success; doctor may include warnings.
|
|
88
|
+
- `1`: invalid request, unsupported/conflicting setup, or doctor error checks.
|
|
89
|
+
- `2`: operational failure, including package-manager failure or partial init.
|
|
90
|
+
|
|
91
|
+
The CLI uses no telemetry, update check, component copying, or runtime
|
|
92
|
+
dependency in framework packages.
|
|
93
|
+
|
|
94
|
+
## Project and license
|
|
95
|
+
|
|
96
|
+
Source and full documentation:
|
|
97
|
+
[Combric/combric](https://github.com/Combric/combric). Licensed under the
|
|
98
|
+
[MIT License](../../LICENSE).
|
package/dist/bin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":""}
|
package/dist/bin.js
ADDED
package/dist/bin.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,CAAC,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAgFA,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CA6J5D"}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
import { parseArgs } from "node:util";
|
|
4
|
+
import { diagnose } from "./doctor.js";
|
|
5
|
+
import { executePlan } from "./execute.js";
|
|
6
|
+
import { inspectProject } from "./inspect.js";
|
|
7
|
+
import { CliError } from "./model.js";
|
|
8
|
+
import { planInit } from "./plan.js";
|
|
9
|
+
const help = `Combric CLI — optional setup and diagnostics for package-based Combric projects.
|
|
10
|
+
|
|
11
|
+
Usage: combric <command> [options]
|
|
12
|
+
|
|
13
|
+
Commands:
|
|
14
|
+
init Configure an existing project (no app scaffolding)
|
|
15
|
+
doctor Check project health without changing files
|
|
16
|
+
info Show detected project state without changing files
|
|
17
|
+
|
|
18
|
+
Global options:
|
|
19
|
+
--help Show help
|
|
20
|
+
--version Show CLI package version
|
|
21
|
+
--project <path> Inspect an explicit existing project directory
|
|
22
|
+
|
|
23
|
+
Run combric <command> --help for command options.
|
|
24
|
+
Packages can be installed and used manually without this CLI.`;
|
|
25
|
+
const commandHelp = {
|
|
26
|
+
init: `Usage: combric init --mode <css|react|tailwind|react-tailwind> --css-file <relative.css> [options]
|
|
27
|
+
|
|
28
|
+
Configure an existing package project. The CSS file must already exist.
|
|
29
|
+
--package-manager <pnpm|npm|yarn|bun> Required if project evidence is absent
|
|
30
|
+
--dry-run Print the plan without changing files
|
|
31
|
+
--yes Apply the plan without prompts
|
|
32
|
+
--json Machine-readable plan/result
|
|
33
|
+
--project <path> Explicit existing project directory
|
|
34
|
+
--help Show this help`,
|
|
35
|
+
doctor: `Usage: combric doctor [--json] [--project <path>]
|
|
36
|
+
|
|
37
|
+
Read-only diagnostics. Exit 0 for pass/warnings, 1 for detected errors, 2 for operational failure.`,
|
|
38
|
+
info: `Usage: combric info [--json] [--project <path>]
|
|
39
|
+
|
|
40
|
+
Read-only project facts. Exit 0 on success, 1 for user/configuration error, 2 for operational failure.`,
|
|
41
|
+
};
|
|
42
|
+
const optionDefinitions = {
|
|
43
|
+
help: { type: "boolean" },
|
|
44
|
+
version: { type: "boolean" },
|
|
45
|
+
project: { type: "string" },
|
|
46
|
+
json: { type: "boolean" },
|
|
47
|
+
yes: { type: "boolean" },
|
|
48
|
+
"dry-run": { type: "boolean" },
|
|
49
|
+
mode: { type: "string" },
|
|
50
|
+
"css-file": { type: "string" },
|
|
51
|
+
"package-manager": { type: "string" },
|
|
52
|
+
};
|
|
53
|
+
function emitJson(value) {
|
|
54
|
+
process.stdout.write(`${JSON.stringify(value, null, 2)}\n`);
|
|
55
|
+
}
|
|
56
|
+
function publicPlan(plan) {
|
|
57
|
+
return {
|
|
58
|
+
schemaVersion: 1,
|
|
59
|
+
projectRoot: plan.projectRoot,
|
|
60
|
+
packageManager: plan.packageManager,
|
|
61
|
+
mode: plan.mode,
|
|
62
|
+
cssFile: plan.cssFile,
|
|
63
|
+
actions: plan.actions.map(({ type, target, reason, changesState, packages }) => ({
|
|
64
|
+
type,
|
|
65
|
+
target,
|
|
66
|
+
reason,
|
|
67
|
+
changesState,
|
|
68
|
+
...(packages ? { packages } : {}),
|
|
69
|
+
})),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
export async function runCli(argv) {
|
|
73
|
+
let jsonRequested = argv.includes("--json");
|
|
74
|
+
try {
|
|
75
|
+
const parsed = (() => {
|
|
76
|
+
try {
|
|
77
|
+
return parseArgs({
|
|
78
|
+
args: argv,
|
|
79
|
+
options: optionDefinitions,
|
|
80
|
+
allowPositionals: true,
|
|
81
|
+
strict: true,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
throw new CliError(error instanceof Error ? error.message : String(error), "INVALID_ARGUMENTS");
|
|
86
|
+
}
|
|
87
|
+
})();
|
|
88
|
+
const command = parsed.positionals[0];
|
|
89
|
+
const options = parsed.values;
|
|
90
|
+
jsonRequested = options.json ?? false;
|
|
91
|
+
if (options.version) {
|
|
92
|
+
if (command)
|
|
93
|
+
throw new CliError("--version is a global option.", "INVALID_ARGUMENTS");
|
|
94
|
+
const manifest = JSON.parse(await readFile(new URL("../package.json", import.meta.url), "utf8"));
|
|
95
|
+
process.stdout.write(`${manifest.version}\n`);
|
|
96
|
+
return 0;
|
|
97
|
+
}
|
|
98
|
+
if (options.help || !command) {
|
|
99
|
+
process.stdout.write(`${command && commandHelp[command] ? commandHelp[command] : help}\n`);
|
|
100
|
+
return 0;
|
|
101
|
+
}
|
|
102
|
+
if (!(command in commandHelp))
|
|
103
|
+
throw new CliError(`Unknown command ${command}. Run combric --help.`, "UNKNOWN_COMMAND");
|
|
104
|
+
if (parsed.positionals.length > 1)
|
|
105
|
+
throw new CliError("Only one command is supported. Run combric --help.", "INVALID_ARGUMENTS");
|
|
106
|
+
if (command !== "init" &&
|
|
107
|
+
(options.yes ||
|
|
108
|
+
options["dry-run"] ||
|
|
109
|
+
options.mode ||
|
|
110
|
+
options["css-file"] ||
|
|
111
|
+
options["package-manager"])) {
|
|
112
|
+
throw new CliError(`These options are only supported by init. Run combric ${command} --help.`, "INVALID_ARGUMENTS");
|
|
113
|
+
}
|
|
114
|
+
const project = await inspectProject(options.project ? resolve(options.project) : process.cwd(), Boolean(options.project));
|
|
115
|
+
if (command === "info") {
|
|
116
|
+
const data = {
|
|
117
|
+
schemaVersion: 1,
|
|
118
|
+
cliVersion: JSON.parse(await readFile(new URL("../package.json", import.meta.url), "utf8")).version,
|
|
119
|
+
nodeVersion: project.nodeVersion,
|
|
120
|
+
projectRoot: project.projectRoot,
|
|
121
|
+
packageManager: project.packageManager,
|
|
122
|
+
packageManagerEvidence: project.packageManagerEvidence,
|
|
123
|
+
packageManagerConflict: project.packageManagerConflict,
|
|
124
|
+
workspace: project.workspace,
|
|
125
|
+
workspaceRoot: project.workspaceRoot,
|
|
126
|
+
react: project.react,
|
|
127
|
+
tailwind: project.tailwind,
|
|
128
|
+
combricPackages: project.combricPackages,
|
|
129
|
+
installed: project.installed,
|
|
130
|
+
config: project.config,
|
|
131
|
+
configError: project.configError,
|
|
132
|
+
cssImports: project.cssImports,
|
|
133
|
+
};
|
|
134
|
+
if (options.json)
|
|
135
|
+
emitJson(data);
|
|
136
|
+
else
|
|
137
|
+
process.stdout.write(`Project: ${data.projectRoot}\nNode: ${data.nodeVersion}\nPackage manager: ${data.packageManager ?? "unknown"}\nReact: ${data.react ?? "absent"}\nTailwind: ${data.tailwind ?? "absent"}\nCombric packages: ${Object.keys(data.combricPackages).join(", ") || "none"}\nConfig: ${data.config ? `${data.config.mode} (${data.config.cssFile})` : data.configError ? `invalid: ${data.configError}` : "absent"}\n`);
|
|
138
|
+
return 0;
|
|
139
|
+
}
|
|
140
|
+
if (command === "doctor") {
|
|
141
|
+
const checks = diagnose(project);
|
|
142
|
+
const status = checks.some((item) => item.severity === "error")
|
|
143
|
+
? "error"
|
|
144
|
+
: "ok";
|
|
145
|
+
if (options.json)
|
|
146
|
+
emitJson({
|
|
147
|
+
schemaVersion: 1,
|
|
148
|
+
projectRoot: project.projectRoot,
|
|
149
|
+
status,
|
|
150
|
+
checks,
|
|
151
|
+
});
|
|
152
|
+
else
|
|
153
|
+
process.stdout.write(`Combric doctor: ${status}\n${checks.map((item) => `[${item.severity}] ${item.code}: ${item.message}`).join("\n")}\n`);
|
|
154
|
+
return status === "error" ? 1 : 0;
|
|
155
|
+
}
|
|
156
|
+
const plan = await planInit(project, {
|
|
157
|
+
mode: options.mode,
|
|
158
|
+
cssFile: options["css-file"],
|
|
159
|
+
packageManager: options["package-manager"],
|
|
160
|
+
});
|
|
161
|
+
if (options["dry-run"]) {
|
|
162
|
+
if (options.json)
|
|
163
|
+
emitJson({ ...publicPlan(plan), dryRun: true });
|
|
164
|
+
else
|
|
165
|
+
process.stdout.write(`Combric init dry run: ${plan.mode}\n${plan.actions.length ? plan.actions.map((action) => `- ${action.type}: ${action.target} — ${action.reason}${action.packages ? ` (${action.packages.join(", ")})` : ""}`).join("\n") : "No changes required."}\n`);
|
|
166
|
+
return 0;
|
|
167
|
+
}
|
|
168
|
+
if (plan.actions.length && !options.yes)
|
|
169
|
+
throw new CliError("Pass --yes to apply this plan, or --dry-run to inspect it. No prompt will be opened.", "CONFIRMATION_REQUIRED");
|
|
170
|
+
const changed = await executePlan(plan);
|
|
171
|
+
if (options.json)
|
|
172
|
+
emitJson({ ...publicPlan(plan), dryRun: false, changed });
|
|
173
|
+
else
|
|
174
|
+
process.stdout.write(`Combric init: ${changed.length ? changed.join("; ") : "no changes required"}.\n`);
|
|
175
|
+
return 0;
|
|
176
|
+
}
|
|
177
|
+
catch (error) {
|
|
178
|
+
const known = error instanceof CliError
|
|
179
|
+
? error
|
|
180
|
+
: new CliError(error instanceof Error ? error.message : String(error), "OPERATION_FAILED", 2);
|
|
181
|
+
if (jsonRequested)
|
|
182
|
+
emitJson({
|
|
183
|
+
schemaVersion: 1,
|
|
184
|
+
error: { code: known.code, message: known.message },
|
|
185
|
+
exitCode: known.exitCode,
|
|
186
|
+
});
|
|
187
|
+
else
|
|
188
|
+
process.stderr.write(`Combric: ${known.message}\n`);
|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uBAAuB,CACxB,CAAC;QACJ,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,IAAI,CAAC,CAAC;QACxC,IAAI,OAAO,CAAC,IAAI;YAAE,QAAQ,CAAC,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;;YAE1E,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,iBAAiB,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,qBAAqB,KAAK,CAClF,CAAC;QACJ,OAAO,CAAC,CAAC;IACX,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,KAAK,GACT,KAAK,YAAY,QAAQ;YACvB,CAAC,CAAC,KAAK;YACP,CAAC,CAAC,IAAI,QAAQ,CACV,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EACtD,kBAAkB,EAClB,CAAC,CACF,CAAC;QACR,IAAI,aAAa;YACf,QAAQ,CAAC;gBACP,aAAa,EAAE,CAAC;gBAChB,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE;gBACnD,QAAQ,EAAE,KAAK,CAAC,QAAQ;aACzB,CAAC,CAAC;;YACA,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;QACzD,OAAO,KAAK,CAAC,QAAQ,CAAC;IACxB,CAAC;AACH,CAAC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type CliConfig, type Mode, type PackageManager } from "./model.js";
|
|
2
|
+
export declare const CONFIG_FILE = "combric.config.json";
|
|
3
|
+
export declare const MODES: readonly Mode[];
|
|
4
|
+
export declare const MANAGERS: readonly PackageManager[];
|
|
5
|
+
export declare function parseConfig(value: unknown): {
|
|
6
|
+
config: CliConfig;
|
|
7
|
+
unknownFields: string[];
|
|
8
|
+
};
|
|
9
|
+
export declare function readConfig(root: string): Promise<{
|
|
10
|
+
config: CliConfig | null;
|
|
11
|
+
error: string | null;
|
|
12
|
+
unknownFields: string[];
|
|
13
|
+
}>;
|
|
14
|
+
export declare function serializeConfig(config: CliConfig): string;
|
|
15
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,IAAI,EACT,KAAK,cAAc,EACpB,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,WAAW,wBAAwB,CAAC;AACjD,eAAO,MAAM,KAAK,EAAE,SAAS,IAAI,EAKhC,CAAC;AACF,eAAO,MAAM,QAAQ,EAAE,SAAS,cAAc,EAK7C,CAAC;AAEF,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG;IAC3C,MAAM,EAAE,SAAS,CAAC;IAClB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB,CAyCA;AAED,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACtD,MAAM,EAAE,SAAS,GAAG,IAAI,CAAC;IACzB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB,CAAC,CAuCD;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAEzD"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { readFile, realpath } from "node:fs/promises";
|
|
2
|
+
import { isAbsolute, join, relative, sep } from "node:path";
|
|
3
|
+
import { CliError, } from "./model.js";
|
|
4
|
+
export const CONFIG_FILE = "combric.config.json";
|
|
5
|
+
export const MODES = [
|
|
6
|
+
"css",
|
|
7
|
+
"react",
|
|
8
|
+
"tailwind",
|
|
9
|
+
"react-tailwind",
|
|
10
|
+
];
|
|
11
|
+
export const MANAGERS = [
|
|
12
|
+
"pnpm",
|
|
13
|
+
"npm",
|
|
14
|
+
"yarn",
|
|
15
|
+
"bun",
|
|
16
|
+
];
|
|
17
|
+
export function parseConfig(value) {
|
|
18
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
19
|
+
throw new CliError("Combric config must be a JSON object.", "INVALID_CONFIG");
|
|
20
|
+
}
|
|
21
|
+
const fields = value;
|
|
22
|
+
if (fields.schemaVersion !== 1) {
|
|
23
|
+
throw new CliError(`Unsupported Combric config schemaVersion ${String(fields.schemaVersion)}. Use a compatible CLI or review the config manually.`, "UNSUPPORTED_CONFIG_SCHEMA");
|
|
24
|
+
}
|
|
25
|
+
if (!MANAGERS.includes(fields.packageManager)) {
|
|
26
|
+
throw new CliError("Combric config has an invalid packageManager.", "INVALID_CONFIG");
|
|
27
|
+
}
|
|
28
|
+
if (!MODES.includes(fields.mode)) {
|
|
29
|
+
throw new CliError("Combric config has an invalid mode.", "INVALID_CONFIG");
|
|
30
|
+
}
|
|
31
|
+
if (typeof fields.cssFile !== "string" || !fields.cssFile.trim()) {
|
|
32
|
+
throw new CliError("Combric config needs a relative cssFile.", "INVALID_CONFIG");
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
config: {
|
|
36
|
+
schemaVersion: 1,
|
|
37
|
+
packageManager: fields.packageManager,
|
|
38
|
+
mode: fields.mode,
|
|
39
|
+
cssFile: fields.cssFile,
|
|
40
|
+
},
|
|
41
|
+
unknownFields: Object.keys(fields).filter((key) => !["schemaVersion", "packageManager", "mode", "cssFile"].includes(key)),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export async function readConfig(root) {
|
|
45
|
+
let contents;
|
|
46
|
+
try {
|
|
47
|
+
const resolved = await realpath(join(root, CONFIG_FILE));
|
|
48
|
+
const inside = relative(root, resolved);
|
|
49
|
+
if (!inside ||
|
|
50
|
+
inside === ".." ||
|
|
51
|
+
inside.startsWith(`..${sep}`) ||
|
|
52
|
+
isAbsolute(inside)) {
|
|
53
|
+
return {
|
|
54
|
+
config: null,
|
|
55
|
+
error: "Combric config resolves outside the project root.",
|
|
56
|
+
unknownFields: [],
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
contents = await readFile(resolved, "utf8");
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
if (error.code === "ENOENT") {
|
|
63
|
+
return { config: null, error: null, unknownFields: [] };
|
|
64
|
+
}
|
|
65
|
+
throw error;
|
|
66
|
+
}
|
|
67
|
+
try {
|
|
68
|
+
const parsed = JSON.parse(contents);
|
|
69
|
+
const result = parseConfig(parsed);
|
|
70
|
+
return {
|
|
71
|
+
config: result.config,
|
|
72
|
+
error: null,
|
|
73
|
+
unknownFields: result.unknownFields,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
return {
|
|
78
|
+
config: null,
|
|
79
|
+
error: error instanceof Error ? error.message : String(error),
|
|
80
|
+
unknownFields: [],
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
export function serializeConfig(config) {
|
|
85
|
+
return `${JSON.stringify(config, null, 2)}\n`;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAE5D,OAAO,EACL,QAAQ,GAIT,MAAM,YAAY,CAAC;AAEpB,MAAM,CAAC,MAAM,WAAW,GAA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G,WAAW,CAAC,MAAM,CAAC,CAAC;QACnC,OAAO;YACL,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,KAAK,EAAE,IAAI;YACX,aAAa,EAAE,MAAM,CAAC,aAAa;SACpC,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,MAAM,EAAE,IAAI;YACZ,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;YAC7D,aAAa,EAAE,EAAE;SAClB,CAAC;IACJ,CAAC;AACH,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,MAAiB;IAC/C,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;AAChD,CAAC"}
|
package/dist/doctor.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../src/doctor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE1D,wBAAgB,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,UAAU,EAAE,CAiI3D"}
|
package/dist/doctor.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { requiredImports, requiredPackages } from "./requirements.js";
|
|
2
|
+
import { supportsReact19, supportsTailwind4 } from "./inspect.js";
|
|
3
|
+
export function diagnose(project) {
|
|
4
|
+
const checks = [];
|
|
5
|
+
const add = (severity, code, message) => checks.push({ severity, code, message });
|
|
6
|
+
if (Number(project.nodeVersion.split(".")[0]) < 24) {
|
|
7
|
+
add("error", "NODE_UNSUPPORTED", "Node 24 or newer is required.");
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
add("pass", "NODE_SUPPORTED", `Node ${project.nodeVersion} is supported.`);
|
|
11
|
+
}
|
|
12
|
+
if (project.packageManagerConflict) {
|
|
13
|
+
add("error", "PACKAGE_MANAGER_CONFLICT", `Conflicting package-manager evidence: ${project.packageManagerEvidence.join(", ")}. Resolve it before init.`);
|
|
14
|
+
}
|
|
15
|
+
else if (!project.packageManager) {
|
|
16
|
+
add("warning", "PACKAGE_MANAGER_UNKNOWN", "No package-manager evidence was found. Choose one explicitly for init.");
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
add("pass", "PACKAGE_MANAGER", `Package manager: ${project.packageManager}.`);
|
|
20
|
+
}
|
|
21
|
+
if (project.configError) {
|
|
22
|
+
add("error", "CONFIG_INVALID", project.configError);
|
|
23
|
+
}
|
|
24
|
+
else if (!project.config) {
|
|
25
|
+
add("warning", "NOT_CONFIGURED", "No combric.config.json exists. Use init to configure this project.");
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
add("pass", "CONFIG_VALID", "Combric config schema 1 is valid.");
|
|
29
|
+
if (project.configUnknownFields.length) {
|
|
30
|
+
add("warning", "CONFIG_UNKNOWN_FIELDS", `Unknown config fields: ${project.configUnknownFields.join(", ")}. Init will not rewrite them.`);
|
|
31
|
+
}
|
|
32
|
+
for (const name of requiredPackages(project.config.mode)) {
|
|
33
|
+
if (!project.dependencies[name])
|
|
34
|
+
add("error", "PACKAGE_MISSING", `${name} is required for ${project.config.mode} mode.`);
|
|
35
|
+
else
|
|
36
|
+
add("pass", "PACKAGE_DECLARED", `${name} is declared.`);
|
|
37
|
+
if (project.dependencies[name] && !project.installed[name]) {
|
|
38
|
+
add("warning", "PACKAGE_NOT_INSTALLED", `${name} is declared but was not found in node_modules. Run the selected package manager's install command.`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (project.config.mode.includes("react")) {
|
|
42
|
+
if (!project.react ||
|
|
43
|
+
!supportsReact19(project.react) ||
|
|
44
|
+
!project.dependencies["react-dom"] ||
|
|
45
|
+
!supportsReact19(project.dependencies["react-dom"])) {
|
|
46
|
+
add("error", "REACT_UNSUPPORTED", "React and React DOM 19 are required for this mode.");
|
|
47
|
+
}
|
|
48
|
+
else
|
|
49
|
+
add("pass", "REACT_SUPPORTED", "React and React DOM 19 are declared.");
|
|
50
|
+
}
|
|
51
|
+
if (project.config.mode.includes("tailwind")) {
|
|
52
|
+
if (!project.tailwind || !supportsTailwind4(project.tailwind)) {
|
|
53
|
+
add("error", "TAILWIND_UNSUPPORTED", "Tailwind CSS >=4.3 and <5 is required for this mode.");
|
|
54
|
+
}
|
|
55
|
+
else
|
|
56
|
+
add("pass", "TAILWIND_SUPPORTED", "Compatible Tailwind v4 is declared.");
|
|
57
|
+
}
|
|
58
|
+
if (!project.cssImports) {
|
|
59
|
+
add("error", "CSS_MISSING", `Configured CSS file ${project.config.cssFile} is missing or unsafe.`);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
const expectedImports = requiredImports(project.config.mode);
|
|
63
|
+
const conflicting = project.cssImports.filter((name) => name.startsWith("@combric/") && !expectedImports.includes(name));
|
|
64
|
+
if (conflicting.length) {
|
|
65
|
+
add("error", "CSS_IMPORT_CONFLICT", `Unexpected Combric CSS imports: ${conflicting.join(", ")}.`);
|
|
66
|
+
}
|
|
67
|
+
for (const name of requiredImports(project.config.mode)) {
|
|
68
|
+
if (!project.cssImports.includes(name))
|
|
69
|
+
add("error", "CSS_IMPORT_MISSING", `CSS import ${name} is missing from ${project.config.cssFile}.`);
|
|
70
|
+
}
|
|
71
|
+
if (!conflicting.length &&
|
|
72
|
+
expectedImports.every((name) => project.cssImports?.includes(name))) {
|
|
73
|
+
add("pass", "CSS_READY", "Required public CSS imports are present.");
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return checks;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=doctor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../src/doctor.ts"],"names":[],"mappings":"AAAA,OAA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