@canonical/pragma-cli 0.26.0 → 0.27.1-experimental.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/dist/pragma
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canonical/pragma-cli",
|
|
3
3
|
"description": "CLI and MCP server for Canonical's design system.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.27.1-experimental.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "src/index.ts",
|
|
7
7
|
"types": "src/index.ts",
|
|
@@ -40,6 +40,9 @@
|
|
|
40
40
|
"#testing": "./src/testing/index.ts",
|
|
41
41
|
"#tui": "./src/tui/index.ts"
|
|
42
42
|
},
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
},
|
|
43
46
|
"scripts": {
|
|
44
47
|
"build": "bun build --compile --minify --target=bun-linux-x64 src/bin.ts --outfile dist/pragma",
|
|
45
48
|
"build:compile": "bun build --compile --minify --target=bun-linux-x64 src/bin.ts --outfile dist/pragma",
|
|
@@ -57,9 +60,9 @@
|
|
|
57
60
|
},
|
|
58
61
|
"devDependencies": {
|
|
59
62
|
"@biomejs/biome": "2.4.9",
|
|
60
|
-
"@canonical/biome-config": "^0.
|
|
61
|
-
"@canonical/typescript-config": "^0.
|
|
62
|
-
"@canonical/webarchitect": "^0.
|
|
63
|
+
"@canonical/biome-config": "^0.27.1-experimental.0",
|
|
64
|
+
"@canonical/typescript-config": "^0.27.1-experimental.0",
|
|
65
|
+
"@canonical/webarchitect": "^0.27.1-experimental.0",
|
|
63
66
|
"@types/bun": "^1.3.10",
|
|
64
67
|
"@types/node": "^24.12.0",
|
|
65
68
|
"@types/react": "^19.2.14",
|
|
@@ -73,13 +76,13 @@
|
|
|
73
76
|
"@canonical/design-system": "^0.1.2"
|
|
74
77
|
},
|
|
75
78
|
"dependencies": {
|
|
76
|
-
"@canonical/cli-core": "^0.
|
|
77
|
-
"@canonical/harnesses": "^0.
|
|
78
|
-
"@canonical/ke": "^0.
|
|
79
|
-
"@canonical/summon-component": "^0.
|
|
80
|
-
"@canonical/summon-core": "^0.
|
|
81
|
-
"@canonical/summon-package": "^0.
|
|
82
|
-
"@canonical/task": "^0.
|
|
79
|
+
"@canonical/cli-core": "^0.27.1-experimental.0",
|
|
80
|
+
"@canonical/harnesses": "^0.27.1-experimental.0",
|
|
81
|
+
"@canonical/ke": "^0.27.1-experimental.0",
|
|
82
|
+
"@canonical/summon-component": "^0.27.1-experimental.0",
|
|
83
|
+
"@canonical/summon-core": "^0.27.1-experimental.0",
|
|
84
|
+
"@canonical/summon-package": "^0.27.1-experimental.0",
|
|
85
|
+
"@canonical/task": "^0.27.1-experimental.0",
|
|
83
86
|
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
84
87
|
"chalk": "^5.6.2",
|
|
85
88
|
"commander": "^14.0.3",
|
|
@@ -88,5 +91,5 @@
|
|
|
88
91
|
"react": "^19.2.4",
|
|
89
92
|
"zod": "^3.25.0"
|
|
90
93
|
},
|
|
91
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "d3f5b9aab7bec07fce40a12b45097d28d3cf0201"
|
|
92
95
|
}
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
promptToParameter,
|
|
6
6
|
} from "@canonical/cli-core";
|
|
7
7
|
import { generators } from "@canonical/summon-component";
|
|
8
|
-
import type { AnyGenerator } from "@canonical/summon-core";
|
|
9
8
|
import { PragmaError } from "#error";
|
|
9
|
+
import { COMPONENT_GENERATORS } from "../generators.js";
|
|
10
10
|
|
|
11
11
|
const FRAMEWORK_CHOICES = [
|
|
12
12
|
{ label: "react", value: "react" },
|
|
@@ -14,12 +14,6 @@ const FRAMEWORK_CHOICES = [
|
|
|
14
14
|
{ label: "lit", value: "lit" },
|
|
15
15
|
] as const;
|
|
16
16
|
|
|
17
|
-
const GENERATOR_MAP: Record<string, AnyGenerator> = {
|
|
18
|
-
react: generators["component/react"],
|
|
19
|
-
svelte: generators["component/svelte"],
|
|
20
|
-
lit: generators["component/lit"],
|
|
21
|
-
};
|
|
22
|
-
|
|
23
17
|
/** Reference generator used to derive shared prompt parameters. */
|
|
24
18
|
const referenceGenerator = generators["component/react"];
|
|
25
19
|
|
|
@@ -101,12 +95,12 @@ export default function buildComponentCommand(): CommandDefinition {
|
|
|
101
95
|
});
|
|
102
96
|
}
|
|
103
97
|
|
|
104
|
-
const gen =
|
|
98
|
+
const gen = COMPONENT_GENERATORS[framework];
|
|
105
99
|
if (!gen) {
|
|
106
100
|
throw PragmaError.invalidInput("framework", framework, {
|
|
107
|
-
validOptions: Object.keys(
|
|
101
|
+
validOptions: Object.keys(COMPONENT_GENERATORS),
|
|
108
102
|
recovery: {
|
|
109
|
-
message: `Valid frameworks: ${Object.keys(
|
|
103
|
+
message: `Valid frameworks: ${Object.keys(COMPONENT_GENERATORS).join(", ")}`,
|
|
110
104
|
},
|
|
111
105
|
});
|
|
112
106
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { generators } from "@canonical/summon-component";
|
|
2
|
+
import type { AnyGenerator } from "@canonical/summon-core";
|
|
3
|
+
|
|
4
|
+
export const COMPONENT_GENERATORS: Record<string, AnyGenerator> = {
|
|
5
|
+
react: generators["component/react"],
|
|
6
|
+
svelte: generators["component/svelte"],
|
|
7
|
+
lit: generators["component/lit"],
|
|
8
|
+
};
|
|
@@ -3,17 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { executeGenerator } from "@canonical/cli-core";
|
|
6
|
-
import { generators as componentGenerators } from "@canonical/summon-component";
|
|
7
6
|
import type { AnyGenerator } from "@canonical/summon-core";
|
|
8
7
|
import { generators as packageGenerators } from "@canonical/summon-package";
|
|
9
8
|
import { PragmaError } from "#error";
|
|
10
9
|
import type { ToolSpec } from "../../shared/ToolSpec.js";
|
|
11
|
-
|
|
12
|
-
const componentGeneratorMap: Record<string, AnyGenerator> = {
|
|
13
|
-
react: componentGenerators["component/react"],
|
|
14
|
-
svelte: componentGenerators["component/svelte"],
|
|
15
|
-
lit: componentGenerators["component/lit"],
|
|
16
|
-
};
|
|
10
|
+
import { COMPONENT_GENERATORS } from "../generators.js";
|
|
17
11
|
|
|
18
12
|
const specs: readonly ToolSpec[] = [
|
|
19
13
|
{
|
|
@@ -62,10 +56,10 @@ const specs: readonly ToolSpec[] = [
|
|
|
62
56
|
};
|
|
63
57
|
|
|
64
58
|
const framework = params.framework as string;
|
|
65
|
-
const gen =
|
|
59
|
+
const gen = COMPONENT_GENERATORS[framework];
|
|
66
60
|
if (!gen) {
|
|
67
61
|
throw PragmaError.invalidInput("framework", framework, {
|
|
68
|
-
validOptions: Object.keys(
|
|
62
|
+
validOptions: Object.keys(COMPONENT_GENERATORS),
|
|
69
63
|
});
|
|
70
64
|
}
|
|
71
65
|
|