declare-cc 0.3.1 → 0.3.2
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/bin/install.js +15 -1
- package/package.json +1 -1
package/bin/install.js
CHANGED
|
@@ -661,9 +661,11 @@ function copyFlattenedCommands(srcDir, destDir, prefix, pathPrefix, runtime) {
|
|
|
661
661
|
const globalClaudeRegex = /~\/\.claude\//g;
|
|
662
662
|
const localClaudeRegex = /\.\/\.claude\//g;
|
|
663
663
|
const opencodeDirRegex = /~\/\.opencode\//g;
|
|
664
|
+
const distToolsRegex = /dist\/declare-tools\.cjs/g;
|
|
664
665
|
content = content.replace(globalClaudeRegex, pathPrefix);
|
|
665
666
|
content = content.replace(localClaudeRegex, `./${getDirName(runtime)}/`);
|
|
666
667
|
content = content.replace(opencodeDirRegex, pathPrefix);
|
|
668
|
+
content = content.replace(distToolsRegex, `${pathPrefix}declare-tools.cjs`);
|
|
667
669
|
content = processAttribution(content, getCommitAttribution(runtime));
|
|
668
670
|
content = convertClaudeToOpencodeFrontmatter(content);
|
|
669
671
|
|
|
@@ -699,12 +701,14 @@ function copyWithPathReplacement(srcDir, destDir, pathPrefix, runtime) {
|
|
|
699
701
|
if (entry.isDirectory()) {
|
|
700
702
|
copyWithPathReplacement(srcPath, destPath, pathPrefix, runtime);
|
|
701
703
|
} else if (entry.name.endsWith('.md')) {
|
|
702
|
-
// Replace ~/.claude
|
|
704
|
+
// Replace ~/.claude/, ./.claude/, and dist/declare-tools.cjs with runtime-appropriate paths
|
|
703
705
|
let content = fs.readFileSync(srcPath, 'utf8');
|
|
704
706
|
const globalClaudeRegex = /~\/\.claude\//g;
|
|
705
707
|
const localClaudeRegex = /\.\/\.claude\//g;
|
|
708
|
+
const distToolsRegex = /dist\/declare-tools\.cjs/g;
|
|
706
709
|
content = content.replace(globalClaudeRegex, pathPrefix);
|
|
707
710
|
content = content.replace(localClaudeRegex, `./${dirName}/`);
|
|
711
|
+
content = content.replace(distToolsRegex, `${pathPrefix}declare-tools.cjs`);
|
|
708
712
|
content = processAttribution(content, getCommitAttribution(runtime));
|
|
709
713
|
|
|
710
714
|
// Convert frontmatter for opencode compatibility
|
|
@@ -1435,6 +1439,16 @@ function install(isGlobal, runtime = 'claude') {
|
|
|
1435
1439
|
}
|
|
1436
1440
|
}
|
|
1437
1441
|
|
|
1442
|
+
// Copy declare-tools.cjs bundle so commands can run `node {pathPrefix}declare-tools.cjs`
|
|
1443
|
+
const bundleSrc = path.join(src, 'dist', 'declare-tools.cjs');
|
|
1444
|
+
const bundleDest = path.join(targetDir, 'declare-tools.cjs');
|
|
1445
|
+
if (fs.existsSync(bundleSrc)) {
|
|
1446
|
+
fs.copyFileSync(bundleSrc, bundleDest);
|
|
1447
|
+
console.log(` ${green}✓${reset} Installed declare-tools.cjs`);
|
|
1448
|
+
} else {
|
|
1449
|
+
failures.push('declare-tools.cjs');
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1438
1452
|
// Ensure declare/ metadata dir exists for VERSION and CHANGELOG
|
|
1439
1453
|
const declareMetaDir = path.join(targetDir, 'declare');
|
|
1440
1454
|
fs.mkdirSync(declareMetaDir, { recursive: true });
|
package/package.json
CHANGED