@schalkneethling/calavera-artifact-core 0.3.0-next.1 → 0.4.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.
Files changed (3) hide show
  1. package/package.json +2 -19
  2. package/src/catalog.js +43 -127
  3. package/src/node.js +0 -16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schalkneethling/calavera-artifact-core",
3
- "version": "0.3.0-next.1",
3
+ "version": "0.4.0",
4
4
  "description": "Catalog and package resolution primitives for Calavera artifacts.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -14,7 +14,6 @@
14
14
  "type": "module",
15
15
  "exports": {
16
16
  ".": "./src/catalog.js",
17
- "./node": "./src/node.js",
18
17
  "./registry": "./src/registry.js"
19
18
  },
20
19
  "publishConfig": {
@@ -23,23 +22,7 @@
23
22
  },
24
23
  "dependencies": {
25
24
  "pacote": "22.0.0",
26
- "semver": "7.8.5",
27
- "@schalkneethling/calavera-agent-technical-devils-advocate": "^0.2.0",
28
- "@schalkneethling/calavera-hook-block-dangerous-commands": "^0.2.0",
29
- "@schalkneethling/calavera-skill-css-tokens": "^0.2.0",
30
- "@schalkneethling/calavera-skill-calavera": "^0.2.0",
31
- "@schalkneethling/calavera-hook-auto-approve-safe-commands": "^0.2.0",
32
- "@schalkneethling/calavera-skill-frontend-engineering": "^0.2.0",
33
- "@schalkneethling/calavera-skill-code-review": "^0.2.0",
34
- "@schalkneethling/calavera-skill-frontend-security": "^0.2.0",
35
- "@schalkneethling/calavera-skill-frontend-testing": "^0.2.0",
36
- "@schalkneethling/calavera-skill-github-goal-issue-triage": "^0.2.0",
37
- "@schalkneethling/calavera-skill-more-secure-dependabot-config": "^0.2.0",
38
- "@schalkneethling/calavera-skill-npm-publishing-best-practices": "^0.2.0",
39
- "@schalkneethling/calavera-skill-refined-plan-mode": "^0.2.0",
40
- "@schalkneethling/calavera-skill-project-goal": "^0.2.0",
41
- "@schalkneethling/calavera-skill-release-with-confidence": "^0.2.0-next.1",
42
- "@schalkneethling/calavera-skill-npm-trusted-publishing-github-workflow": "^0.2.0"
25
+ "semver": "7.8.5"
43
26
  },
44
27
  "scripts": {
45
28
  "test": "node --test test/*.test.mjs"
package/src/catalog.js CHANGED
@@ -1,138 +1,54 @@
1
1
  // @ts-check
2
- import manifest1 from "@schalkneethling/calavera-skill-calavera" with { type: "json" };
3
- import manifest2 from "@schalkneethling/calavera-skill-code-review" with { type: "json" };
4
- import manifest3 from "@schalkneethling/calavera-skill-css-tokens" with { type: "json" };
5
- import manifest4 from "@schalkneethling/calavera-skill-frontend-engineering" with { type: "json" };
6
- import manifest5 from "@schalkneethling/calavera-skill-frontend-security" with { type: "json" };
7
- import manifest6 from "@schalkneethling/calavera-skill-frontend-testing" with { type: "json" };
8
- import manifest7 from "@schalkneethling/calavera-skill-github-goal-issue-triage" with { type: "json" };
9
- import manifest8 from "@schalkneethling/calavera-skill-more-secure-dependabot-config" with { type: "json" };
10
- import manifest9 from "@schalkneethling/calavera-skill-npm-publishing-best-practices" with { type: "json" };
11
- import manifest10 from "@schalkneethling/calavera-skill-npm-trusted-publishing-github-workflow" with { type: "json" };
12
- import manifest11 from "@schalkneethling/calavera-skill-project-goal" with { type: "json" };
13
- import manifest12 from "@schalkneethling/calavera-skill-refined-plan-mode" with { type: "json" };
14
- import manifest13 from "@schalkneethling/calavera-hook-auto-approve-safe-commands" with { type: "json" };
15
- import manifest14 from "@schalkneethling/calavera-hook-block-dangerous-commands" with { type: "json" };
16
- import manifest15 from "@schalkneethling/calavera-agent-technical-devils-advocate" with { type: "json" };
17
- import manifest16 from "@schalkneethling/calavera-skill-release-with-confidence" with { type: "json" };
18
- import package1 from "@schalkneethling/calavera-skill-calavera/package.json" with { type: "json" };
19
- import package2 from "@schalkneethling/calavera-skill-code-review/package.json" with { type: "json" };
20
- import package3 from "@schalkneethling/calavera-skill-css-tokens/package.json" with { type: "json" };
21
- import package4 from "@schalkneethling/calavera-skill-frontend-engineering/package.json" with { type: "json" };
22
- import package5 from "@schalkneethling/calavera-skill-frontend-security/package.json" with { type: "json" };
23
- import package6 from "@schalkneethling/calavera-skill-frontend-testing/package.json" with { type: "json" };
24
- import package7 from "@schalkneethling/calavera-skill-github-goal-issue-triage/package.json" with { type: "json" };
25
- import package8 from "@schalkneethling/calavera-skill-more-secure-dependabot-config/package.json" with { type: "json" };
26
- import package9 from "@schalkneethling/calavera-skill-npm-publishing-best-practices/package.json" with { type: "json" };
27
- import package10 from "@schalkneethling/calavera-skill-npm-trusted-publishing-github-workflow/package.json" with { type: "json" };
28
- import package11 from "@schalkneethling/calavera-skill-project-goal/package.json" with { type: "json" };
29
- import package12 from "@schalkneethling/calavera-skill-refined-plan-mode/package.json" with { type: "json" };
30
- import package13 from "@schalkneethling/calavera-hook-auto-approve-safe-commands/package.json" with { type: "json" };
31
- import package14 from "@schalkneethling/calavera-hook-block-dangerous-commands/package.json" with { type: "json" };
32
- import package15 from "@schalkneethling/calavera-agent-technical-devils-advocate/package.json" with { type: "json" };
33
- import package16 from "@schalkneethling/calavera-skill-release-with-confidence/package.json" with { type: "json" };
34
2
 
35
3
  export const DEFAULT_ARTIFACT_TARGET = "claude-code";
36
4
 
37
- const packageVersions = new Map([
38
- ["@schalkneethling/calavera-skill-calavera", package1.version],
39
- ["@schalkneethling/calavera-skill-code-review", package2.version],
40
- ["@schalkneethling/calavera-skill-css-tokens", package3.version],
41
- ["@schalkneethling/calavera-skill-frontend-engineering", package4.version],
42
- ["@schalkneethling/calavera-skill-frontend-security", package5.version],
43
- ["@schalkneethling/calavera-skill-frontend-testing", package6.version],
44
- ["@schalkneethling/calavera-skill-github-goal-issue-triage", package7.version],
45
- ["@schalkneethling/calavera-skill-more-secure-dependabot-config", package8.version],
46
- ["@schalkneethling/calavera-skill-npm-publishing-best-practices", package9.version],
47
- ["@schalkneethling/calavera-skill-npm-trusted-publishing-github-workflow", package10.version],
48
- ["@schalkneethling/calavera-skill-project-goal", package11.version],
49
- ["@schalkneethling/calavera-skill-refined-plan-mode", package12.version],
50
- ["@schalkneethling/calavera-hook-auto-approve-safe-commands", package13.version],
51
- ["@schalkneethling/calavera-hook-block-dangerous-commands", package14.version],
52
- ["@schalkneethling/calavera-agent-technical-devils-advocate", package15.version],
53
- ["@schalkneethling/calavera-skill-release-with-confidence", package16.version],
5
+ const ARTIFACT_SCHEMA =
6
+ "https://calavera.schalkneethling.com/schemas/calavera-artifact.schema.json";
7
+ const DEFAULT_COMPATIBILITY = ">=2.2.0 <3";
8
+ const ARTIFACT_TARGETS = Object.freeze(["claude-code", "codex", "cursor", "opencode"]);
9
+ /** @type {readonly (readonly [string, string, string?])[]} */
10
+ const definitions = Object.freeze([
11
+ ["skill-calavera", "Calavera"],
12
+ ["skill-code-review", "Code review"],
13
+ ["skill-css-tokens", "CSS tokens"],
14
+ ["skill-frontend-engineering", "Frontend engineering"],
15
+ ["skill-frontend-security", "Frontend security"],
16
+ ["skill-frontend-testing", "Frontend testing"],
17
+ ["skill-github-goal-issue-triage", "GitHub goal issue triage"],
18
+ ["skill-more-secure-dependabot-config", "More secure Dependabot config"],
19
+ ["skill-npm-publishing-best-practices", "npm publishing best practices"],
20
+ ["skill-npm-trusted-publishing-github-workflow", "npm trusted publishing GitHub workflow"],
21
+ ["skill-project-goal", "Project goal"],
22
+ ["skill-refined-plan-mode", "Refined plan mode"],
23
+ ["skill-release-with-confidence", "Release with confidence", ">=2.4.0-next.0 <3"],
24
+ ["hook-auto-approve-safe-commands", "Auto-approve safe commands"],
25
+ ["hook-block-dangerous-commands", "Block dangerous commands"],
26
+ ["agent-technical-devils-advocate", "Technical devil's advocate"],
54
27
  ]);
55
28
 
56
- export const artifactCatalog = Object.freeze([
57
- artifact(manifest1, "@schalkneethling/calavera-skill-calavera", "skills/calavera"),
58
- artifact(manifest2, "@schalkneethling/calavera-skill-code-review", "skills/code-review"),
59
- artifact(manifest3, "@schalkneethling/calavera-skill-css-tokens", "skills/css-tokens"),
60
- artifact(
61
- manifest4,
62
- "@schalkneethling/calavera-skill-frontend-engineering",
63
- "skills/frontend-engineering",
64
- ),
65
- artifact(
66
- manifest5,
67
- "@schalkneethling/calavera-skill-frontend-security",
68
- "skills/frontend-security",
69
- ),
70
- artifact(
71
- manifest6,
72
- "@schalkneethling/calavera-skill-frontend-testing",
73
- "skills/frontend-testing",
74
- ),
75
- artifact(
76
- manifest7,
77
- "@schalkneethling/calavera-skill-github-goal-issue-triage",
78
- "skills/github-goal-issue-triage",
79
- ),
80
- artifact(
81
- manifest8,
82
- "@schalkneethling/calavera-skill-more-secure-dependabot-config",
83
- "skills/more-secure-dependabot-config",
84
- ),
85
- artifact(
86
- manifest9,
87
- "@schalkneethling/calavera-skill-npm-publishing-best-practices",
88
- "skills/npm-publishing-best-practices",
89
- ),
90
- artifact(
91
- manifest10,
92
- "@schalkneethling/calavera-skill-npm-trusted-publishing-github-workflow",
93
- "skills/npm-trusted-publishing-github-workflow",
94
- ),
95
- artifact(manifest11, "@schalkneethling/calavera-skill-project-goal", "skills/project-goal"),
96
- artifact(
97
- manifest12,
98
- "@schalkneethling/calavera-skill-refined-plan-mode",
99
- "skills/refined-plan-mode",
100
- ),
101
- artifact(
102
- manifest16,
103
- "@schalkneethling/calavera-skill-release-with-confidence",
104
- "skills/release-with-confidence",
105
- ),
106
- artifact(
107
- manifest13,
108
- "@schalkneethling/calavera-hook-auto-approve-safe-commands",
109
- "hooks/auto-approve-safe-commands",
110
- ),
111
- artifact(
112
- manifest14,
113
- "@schalkneethling/calavera-hook-block-dangerous-commands",
114
- "hooks/block-dangerous-commands",
115
- ),
116
- artifact(
117
- manifest15,
118
- "@schalkneethling/calavera-agent-technical-devils-advocate",
119
- "agents/technical-devils-advocate.md",
120
- ),
121
- ]);
29
+ export const artifactCatalog = Object.freeze(definitions.map(createArtifact));
30
+
31
+ /** @param {readonly [string, string, string?]} definition */
32
+ function createArtifact([id, displayName, calavera = DEFAULT_COMPATIBILITY]) {
33
+ const separator = id.indexOf("-");
34
+ const type = id.slice(0, separator);
35
+ const slug = id.slice(separator + 1);
36
+ const isAgent = type === "agent";
37
+ const usesTargetAdapter = type !== "skill";
122
38
 
123
- /**
124
- * @param {{ id: string, type: string, displayName: string, payload: string, [key: string]: unknown }} manifest
125
- * @param {string} packageName
126
- * @param {string} legacyPath
127
- */
128
- function artifact(manifest, packageName, legacyPath) {
129
39
  return Object.freeze({
130
- ...manifest,
131
- packageName,
132
- version: packageVersions.get(packageName),
133
- legacyPath,
134
- group: manifest.type === "skill" ? "Skills" : manifest.type === "hook" ? "Hooks" : "Agents",
135
- defaultTarget: manifest.type === "skill" ? undefined : DEFAULT_ARTIFACT_TARGET,
40
+ $schema: ARTIFACT_SCHEMA,
41
+ schemaVersion: 1,
42
+ id,
43
+ type,
44
+ displayName,
45
+ payload: `payload/${slug}${isAgent ? ".md" : ""}`,
46
+ ...(usesTargetAdapter ? { targets: ARTIFACT_TARGETS } : {}),
47
+ compatibility: { calavera },
48
+ packageName: `@schalkneethling/calavera-${id}`,
49
+ legacyPath: `${type}s/${slug}${isAgent ? ".md" : ""}`,
50
+ group: type === "skill" ? "Skills" : type === "hook" ? "Hooks" : "Agents",
51
+ defaultTarget: usesTargetAdapter ? DEFAULT_ARTIFACT_TARGET : undefined,
136
52
  });
137
53
  }
138
54
 
package/src/node.js DELETED
@@ -1,16 +0,0 @@
1
- // @ts-check
2
- import { dirname, join } from "node:path";
3
- import { fileURLToPath } from "node:url";
4
-
5
- import { artifactForId, artifactForLegacyPath } from "./catalog.js";
6
-
7
- /** @param {string} idOrLegacyPath */
8
- export function artifactPayloadPath(idOrLegacyPath) {
9
- const artifact = artifactForId(idOrLegacyPath) ?? artifactForLegacyPath(idOrLegacyPath);
10
- if (!artifact) {
11
- throw new Error(`Unknown Calavera artifact: ${idOrLegacyPath}.`);
12
- }
13
-
14
- const manifestUrl = import.meta.resolve(artifact.packageName);
15
- return join(dirname(fileURLToPath(manifestUrl)), artifact.payload);
16
- }