@bfrs/agentic-components 0.6.4 → 0.6.6
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/BFRS_AGENTIC_COMPONENTS.md +56 -12
- package/README.md +13 -0
- package/dist/components/data-display/DataTable/DataTable.types.d.ts +1 -1
- package/dist/components/data-display/DataTable/TableViewSelector.d.ts +44 -0
- package/dist/components/data-display/DataTable/index.d.ts +2 -0
- package/dist/components/data-display/DataTable/saveViewApi.d.ts +22 -10
- package/dist/components/data-display/DataTable/viewStore.d.ts +55 -0
- package/dist/custom-elements.d.ts +7 -0
- package/dist/custom-elements.js +9998 -9113
- package/dist/custom-elements.js.map +1 -1
- package/dist/index.js +6368 -5552
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +9 -6
- package/scripts/lint/cli.cjs +894 -0
- package/scripts/postinstall.cjs +79 -2
package/scripts/postinstall.cjs
CHANGED
|
@@ -9,6 +9,26 @@ const initCwd = process.env.INIT_CWD ? path.resolve(process.env.INIT_CWD) : "";
|
|
|
9
9
|
const projectRoot = initCwd || path.resolve(packageDir, "..", "..", "..");
|
|
10
10
|
const knowledgeFileName = "BFRS_AGENTIC_COMPONENTS.md";
|
|
11
11
|
const referenceLine = `Use ${knowledgeFileName} for knowledge regarding the component library.`;
|
|
12
|
+
const skipSetup = process.env.BFRS_AGENTIC_COMPONENTS_SKIP_SETUP === "1";
|
|
13
|
+
const packageJsonFileName = "package.json";
|
|
14
|
+
const lintScriptName = "check:bfrs-agentic-lint";
|
|
15
|
+
const lintScriptCommand = "bfrs-agentic-lint all";
|
|
16
|
+
const buildScriptNames = ["build", "build:spa", "build:web-component", "build-ec2"];
|
|
17
|
+
const knownGuardCommands = [
|
|
18
|
+
lintScriptCommand,
|
|
19
|
+
"bfrs-agentic-lint style-overrides",
|
|
20
|
+
"bfrs-agentic-lint style-selectors",
|
|
21
|
+
"bfrs-agentic-lint ui-library",
|
|
22
|
+
"bfrs-agentic-lint theme-tokens",
|
|
23
|
+
"bfrs-agentic-lint custom-rules",
|
|
24
|
+
"npm run check:bfrs-agentic-lint",
|
|
25
|
+
"npm run check:bfrs-style-overrides",
|
|
26
|
+
"npm run check:library-style-overrides",
|
|
27
|
+
"npm run check:style-selectors",
|
|
28
|
+
"npm run check:ui-library",
|
|
29
|
+
"npm run check:theme-tokens",
|
|
30
|
+
"npm run check:custom-rules",
|
|
31
|
+
];
|
|
12
32
|
|
|
13
33
|
const src = path.join(packageDir, knowledgeFileName);
|
|
14
34
|
const dest = path.join(projectRoot, knowledgeFileName);
|
|
@@ -31,7 +51,7 @@ if (!isInsideNodeModules && !isConsumerLifecycle) {
|
|
|
31
51
|
process.exit(0);
|
|
32
52
|
}
|
|
33
53
|
|
|
34
|
-
if (!fs.existsSync(src)) {
|
|
54
|
+
if (skipSetup || !fs.existsSync(src)) {
|
|
35
55
|
process.exit(0);
|
|
36
56
|
}
|
|
37
57
|
|
|
@@ -59,6 +79,62 @@ function resolveAgentFile(fileNames) {
|
|
|
59
79
|
return path.join(projectRoot, existingFileName || fileNames[0]);
|
|
60
80
|
}
|
|
61
81
|
|
|
82
|
+
function ensureBuildGuard(command) {
|
|
83
|
+
if (!command) return command;
|
|
84
|
+
if (command.includes(lintScriptCommand)) return command;
|
|
85
|
+
|
|
86
|
+
let nextCommand = command.trim();
|
|
87
|
+
let stripped = true;
|
|
88
|
+
while (stripped) {
|
|
89
|
+
stripped = false;
|
|
90
|
+
for (const guardCommand of knownGuardCommands) {
|
|
91
|
+
if (nextCommand === guardCommand) {
|
|
92
|
+
nextCommand = "";
|
|
93
|
+
stripped = true;
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const guardPrefix = `${guardCommand} && `;
|
|
98
|
+
if (nextCommand.startsWith(guardPrefix)) {
|
|
99
|
+
nextCommand = nextCommand.slice(guardPrefix.length).trimStart();
|
|
100
|
+
stripped = true;
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return nextCommand ? `${lintScriptCommand} && ${nextCommand}` : lintScriptCommand;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function ensurePackageScripts() {
|
|
110
|
+
const packageJsonPath = path.join(projectRoot, packageJsonFileName);
|
|
111
|
+
if (!fs.existsSync(packageJsonPath)) return "missing";
|
|
112
|
+
|
|
113
|
+
const existing = fs.readFileSync(packageJsonPath, "utf8");
|
|
114
|
+
const pkg = JSON.parse(existing);
|
|
115
|
+
pkg.scripts = pkg.scripts && typeof pkg.scripts === "object" ? pkg.scripts : {};
|
|
116
|
+
|
|
117
|
+
let changed = false;
|
|
118
|
+
if (pkg.scripts[lintScriptName] !== lintScriptCommand) {
|
|
119
|
+
pkg.scripts[lintScriptName] = lintScriptCommand;
|
|
120
|
+
changed = true;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
for (const scriptName of buildScriptNames) {
|
|
124
|
+
if (typeof pkg.scripts[scriptName] !== "string") continue;
|
|
125
|
+
const nextCommand = ensureBuildGuard(pkg.scripts[scriptName]);
|
|
126
|
+
if (nextCommand !== pkg.scripts[scriptName]) {
|
|
127
|
+
pkg.scripts[scriptName] = nextCommand;
|
|
128
|
+
changed = true;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (!changed) return "unchanged";
|
|
133
|
+
|
|
134
|
+
fs.writeFileSync(packageJsonPath, `${JSON.stringify(pkg, null, 2)}\n`, "utf8");
|
|
135
|
+
return "updated";
|
|
136
|
+
}
|
|
137
|
+
|
|
62
138
|
try {
|
|
63
139
|
fs.copyFileSync(src, dest);
|
|
64
140
|
|
|
@@ -66,9 +142,10 @@ try {
|
|
|
66
142
|
const filePath = resolveAgentFile(fileNames);
|
|
67
143
|
return `${path.basename(filePath)}:${ensureReference(filePath)}`;
|
|
68
144
|
});
|
|
145
|
+
results.push(`${packageJsonFileName}:${ensurePackageScripts()}`);
|
|
69
146
|
|
|
70
147
|
console.log(
|
|
71
|
-
`[agentic-components] Installed ${knowledgeFileName} and
|
|
148
|
+
`[agentic-components] Installed ${knowledgeFileName}, agent references, and lint build guard (${results.join(", ")}).`
|
|
72
149
|
);
|
|
73
150
|
} catch (err) {
|
|
74
151
|
// Never fail a consumer's install.
|