@bacano/sdk 1.2.7 → 1.2.9
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/CATALOG_MANAGEMENT.md +304 -0
- package/README.md +14 -5
- package/STOREFRONT_FORMS.md +38 -0
- package/STOREFRONT_LEADS.md +5 -1
- package/STOREFRONT_PAYMENTS.md +49 -2
- package/catalog-draft-types.d.ts +145 -0
- package/catalog-import-preflight.d.ts +19 -0
- package/catalog-management-types.d.ts +143 -0
- package/catalog-management.cjs +173 -0
- package/catalog-management.d.ts +38 -0
- package/catalog-management.js +150 -0
- package/index.cjs +153 -63
- package/index.js +153 -63
- package/modules/checkout-contact.d.ts +4 -0
- package/package.json +6 -1
- package/react.cjs +153 -63
- package/react.js +153 -63
- package/skills/bacano-web/SKILL.md +10 -3
- package/skills/bacano-web/references/common.md +5 -0
- package/skills/bacano-web/references/forms.md +2 -0
- package/skills/bacano-web/references/storefront.md +15 -0
- package/skills/bacano-web/scripts/cli.mjs +28 -5
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
existsSync,
|
|
7
7
|
lstatSync,
|
|
8
8
|
mkdirSync,
|
|
9
|
+
readdirSync,
|
|
9
10
|
readFileSync,
|
|
10
11
|
readlinkSync,
|
|
11
12
|
rmSync,
|
|
@@ -17,7 +18,6 @@ import { fileURLToPath } from "node:url";
|
|
|
17
18
|
|
|
18
19
|
const scriptDirectory = dirname(fileURLToPath(import.meta.url));
|
|
19
20
|
const sourceSkill = resolve(scriptDirectory, "..");
|
|
20
|
-
const sourceSkillFile = resolve(sourceSkill, "SKILL.md");
|
|
21
21
|
const projectRoot = process.cwd();
|
|
22
22
|
const canonicalSkill = resolve(projectRoot, ".agents", "skills", "bacano-web");
|
|
23
23
|
|
|
@@ -43,8 +43,27 @@ function option(name) {
|
|
|
43
43
|
return index >= 0 ? process.argv[index + 1] : null;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
function
|
|
47
|
-
|
|
46
|
+
function skillFingerprint(directory) {
|
|
47
|
+
const digest = createHash("sha256");
|
|
48
|
+
|
|
49
|
+
function visit(current, prefix = "") {
|
|
50
|
+
for (const entry of readdirSync(current, { withFileTypes: true }).sort(
|
|
51
|
+
(first, second) => first.name.localeCompare(second.name),
|
|
52
|
+
)) {
|
|
53
|
+
const name = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
54
|
+
const path = resolve(current, entry.name);
|
|
55
|
+
if (entry.isDirectory()) {
|
|
56
|
+
visit(path, name);
|
|
57
|
+
} else if (entry.isFile()) {
|
|
58
|
+
digest.update(name).update("\0").update(readFileSync(path));
|
|
59
|
+
} else if (entry.isSymbolicLink()) {
|
|
60
|
+
digest.update(name).update("\0").update(readlinkSync(path));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
visit(directory);
|
|
66
|
+
return digest.digest("hex");
|
|
48
67
|
}
|
|
49
68
|
|
|
50
69
|
function skillFile(directory) {
|
|
@@ -70,7 +89,8 @@ function installCanonical(force) {
|
|
|
70
89
|
if (resolve(sourceSkill) === canonicalSkill) return;
|
|
71
90
|
|
|
72
91
|
if (existsSync(skillFile(canonicalSkill))) {
|
|
73
|
-
if (
|
|
92
|
+
if (skillFingerprint(canonicalSkill) === skillFingerprint(sourceSkill))
|
|
93
|
+
return;
|
|
74
94
|
removeExisting(canonicalSkill, force);
|
|
75
95
|
} else if (existsSync(canonicalSkill)) {
|
|
76
96
|
removeExisting(canonicalSkill, force);
|
|
@@ -170,7 +190,10 @@ function checkPath(name, path) {
|
|
|
170
190
|
return {
|
|
171
191
|
name,
|
|
172
192
|
path: relativeDisplay(path),
|
|
173
|
-
status:
|
|
193
|
+
status:
|
|
194
|
+
skillFingerprint(path) === skillFingerprint(sourceSkill)
|
|
195
|
+
? "current"
|
|
196
|
+
: "outdated",
|
|
174
197
|
link: lstatSync(path).isSymbolicLink(),
|
|
175
198
|
};
|
|
176
199
|
}
|