@haposoft/cafekit 0.8.17 → 0.9.1
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/README.md +47 -84
- package/bin/install.js +90 -653
- package/bin/lib/copy-utils.js +61 -0
- package/bin/lib/opencode-install.js +866 -0
- package/package.json +4 -1
- package/src/claude/CLAUDE.md +2 -2
- package/src/claude/migration-manifest.json +1 -0
- package/src/claude/rules/skill-domain-routing.md +2 -0
- package/src/claude/rules/skill-workflow-routing.md +5 -1
- package/src/claude/skills/question/SKILL.md +162 -0
- package/src/claude/skills/question/templates/question.md +32 -0
- package/src/opencode/AGENTS.md +6 -6
- package/src/opencode/plugins/docs-sync.ts +181 -0
- package/src/opencode/plugins/inspect-block.ts +164 -0
- package/src/opencode/plugins/privacy-block.ts +182 -0
- package/src/opencode/plugins/rules.ts +163 -0
- package/src/opencode/plugins/session.ts +179 -0
- package/src/opencode/plugins/state.ts +253 -0
- package/src/opencode/plugins/usage.ts +178 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
const TEXT_REWRITE_EXTENSIONS = new Set([
|
|
7
|
+
'.md', '.mdx', '.txt', '.json', '.cjs', '.js', '.mjs', '.ts', '.sh', '.yml', '.yaml'
|
|
8
|
+
]);
|
|
9
|
+
|
|
10
|
+
function isTextAsset(filePath) {
|
|
11
|
+
return TEXT_REWRITE_EXTENSIONS.has(path.extname(filePath).toLowerCase());
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function copyRecursive(src, dest, options = {}) {
|
|
15
|
+
const exists = fs.existsSync(src);
|
|
16
|
+
const stats = exists && fs.statSync(src);
|
|
17
|
+
const isDirectory = exists && stats.isDirectory();
|
|
18
|
+
const shouldOverwriteManagedFiles = Boolean(options.upgrade);
|
|
19
|
+
|
|
20
|
+
if (isDirectory) {
|
|
21
|
+
if (!fs.existsSync(dest)) {
|
|
22
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
23
|
+
}
|
|
24
|
+
fs.readdirSync(src).forEach(childItemName => {
|
|
25
|
+
const destItemName = childItemName === 'gitignore' ? '.gitignore' : childItemName;
|
|
26
|
+
copyRecursive(path.join(src, childItemName), path.join(dest, destItemName), options);
|
|
27
|
+
});
|
|
28
|
+
} else {
|
|
29
|
+
if (fs.existsSync(dest) && !shouldOverwriteManagedFiles) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
|
34
|
+
|
|
35
|
+
if (typeof options.transform === 'function' && isTextAsset(src)) {
|
|
36
|
+
const original = fs.readFileSync(src, 'utf8');
|
|
37
|
+
fs.writeFileSync(dest, options.transform(original, src), 'utf8');
|
|
38
|
+
} else {
|
|
39
|
+
fs.copyFileSync(src, dest);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function readJsonFile(filePath) {
|
|
45
|
+
if (!fs.existsSync(filePath)) {
|
|
46
|
+
return {};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
try {
|
|
50
|
+
return JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
|
51
|
+
} catch {
|
|
52
|
+
return {};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
module.exports = {
|
|
57
|
+
TEXT_REWRITE_EXTENSIONS,
|
|
58
|
+
isTextAsset,
|
|
59
|
+
copyRecursive,
|
|
60
|
+
readJsonFile
|
|
61
|
+
};
|