declare-cc 0.3.0 → 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 +48 -39
- package/package.json +1 -1
package/bin/install.js
CHANGED
|
@@ -128,16 +128,16 @@ function getGlobalDir(runtime, explicitDir = null) {
|
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
const banner = '\n' +
|
|
131
|
-
cyan + '
|
|
132
|
-
'
|
|
133
|
-
' ██║
|
|
134
|
-
' ██║
|
|
135
|
-
'
|
|
136
|
-
'
|
|
131
|
+
cyan + ' ██████╗ ███████╗ ██████╗██╗ █████╗ ██████╗ ███████╗\n' +
|
|
132
|
+
' ██╔══██╗██╔════╝██╔════╝██║ ██╔══██╗██╔══██╗██╔════╝\n' +
|
|
133
|
+
' ██║ ██║█████╗ ██║ ██║ ███████║██████╔╝█████╗\n' +
|
|
134
|
+
' ██║ ██║██╔══╝ ██║ ██║ ██╔══██║██╔══██╗██╔══╝\n' +
|
|
135
|
+
' ██████╔╝███████╗╚██████╗███████╗██║ ██║██║ ██║███████╗\n' +
|
|
136
|
+
' ╚═════╝ ╚══════╝ ╚═════╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝' + reset + '\n' +
|
|
137
137
|
'\n' +
|
|
138
|
-
'
|
|
139
|
-
' A meta-prompting
|
|
140
|
-
'
|
|
138
|
+
' Declare ' + dim + 'v' + pkg.version + reset + '\n' +
|
|
139
|
+
' A future-driven meta-prompting engine for agentic development.\n' +
|
|
140
|
+
' Forked from GSD · https://github.com/decocms/declare-cc\n';
|
|
141
141
|
|
|
142
142
|
// Parse --config-dir argument
|
|
143
143
|
function parseConfigDirArg() {
|
|
@@ -171,7 +171,7 @@ console.log(banner);
|
|
|
171
171
|
|
|
172
172
|
// Show help if requested
|
|
173
173
|
if (hasHelp) {
|
|
174
|
-
console.log(` ${yellow}Usage:${reset} npx
|
|
174
|
+
console.log(` ${yellow}Usage:${reset} npx declare-cc [options]\n\n ${yellow}Options:${reset}\n ${cyan}-g, --global${reset} Install globally (to config directory)\n ${cyan}-l, --local${reset} Install locally (to current directory)\n ${cyan}--claude${reset} Install for Claude Code only\n ${cyan}--opencode${reset} Install for OpenCode only\n ${cyan}--gemini${reset} Install for Gemini only\n ${cyan}--all${reset} Install for all runtimes\n ${cyan}-u, --uninstall${reset} Uninstall Declare (remove all Declare files)\n ${cyan}-c, --config-dir <path>${reset} Specify custom config directory\n ${cyan}-h, --help${reset} Show this help message\n ${cyan}--force-statusline${reset} Replace existing statusline config\n\n ${yellow}Examples:${reset}\n ${dim}# Interactive install (prompts for runtime and location)${reset}\n npx declare-cc\n\n ${dim}# Install for Claude Code globally${reset}\n npx declare-cc --claude --global\n\n ${dim}# Install for Gemini globally${reset}\n npx declare-cc --gemini --global\n\n ${dim}# Install for all runtimes globally${reset}\n npx declare-cc --all --global\n\n ${dim}# Install to custom config directory${reset}\n npx declare-cc --claude --global --config-dir ~/.claude-bc\n\n ${dim}# Install to current project only${reset}\n npx declare-cc --claude --local\n\n ${dim}# Uninstall Declare from Claude Code globally${reset}\n npx declare-cc --claude --global --uninstall\n\n ${yellow}Notes:${reset}\n The --config-dir option is useful when you have multiple configurations.\n It takes priority over CLAUDE_CONFIG_DIR / GEMINI_CONFIG_DIR environment variables.\n`);
|
|
175
175
|
process.exit(0);
|
|
176
176
|
}
|
|
177
177
|
|
|
@@ -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
|
|
@@ -1369,41 +1373,32 @@ function install(isGlobal, runtime = 'claude') {
|
|
|
1369
1373
|
// OpenCode: flat structure in command/ directory
|
|
1370
1374
|
const commandDir = path.join(targetDir, 'command');
|
|
1371
1375
|
fs.mkdirSync(commandDir, { recursive: true });
|
|
1372
|
-
|
|
1373
|
-
// Copy commands/
|
|
1374
|
-
const
|
|
1375
|
-
copyFlattenedCommands(
|
|
1376
|
-
|
|
1377
|
-
|
|
1376
|
+
|
|
1377
|
+
// Copy commands/declare/*.md as command/declare-*.md (flatten structure)
|
|
1378
|
+
const declareSrc = path.join(src, 'commands', 'declare');
|
|
1379
|
+
copyFlattenedCommands(declareSrc, commandDir, 'declare', pathPrefix, runtime);
|
|
1380
|
+
const count = fs.readdirSync(commandDir).filter(f => f.startsWith('declare-')).length;
|
|
1381
|
+
if (count > 0) {
|
|
1378
1382
|
console.log(` ${green}✓${reset} Installed ${count} commands to command/`);
|
|
1379
1383
|
} else {
|
|
1380
|
-
failures.push('command/
|
|
1384
|
+
failures.push('command/declare-*');
|
|
1381
1385
|
}
|
|
1382
1386
|
} else {
|
|
1383
1387
|
// Claude Code & Gemini: nested structure in commands/ directory
|
|
1384
1388
|
const commandsDir = path.join(targetDir, 'commands');
|
|
1385
1389
|
fs.mkdirSync(commandsDir, { recursive: true });
|
|
1386
|
-
|
|
1387
|
-
const
|
|
1388
|
-
const
|
|
1389
|
-
copyWithPathReplacement(
|
|
1390
|
-
if (verifyInstalled(
|
|
1391
|
-
|
|
1390
|
+
|
|
1391
|
+
const declareSrc = path.join(src, 'commands', 'declare');
|
|
1392
|
+
const declareDest = path.join(commandsDir, 'declare');
|
|
1393
|
+
copyWithPathReplacement(declareSrc, declareDest, pathPrefix, runtime);
|
|
1394
|
+
if (verifyInstalled(declareDest, 'commands/declare')) {
|
|
1395
|
+
const count = fs.readdirSync(declareDest).filter(f => f.endsWith('.md')).length;
|
|
1396
|
+
console.log(` ${green}✓${reset} Installed ${count} commands to commands/declare`);
|
|
1392
1397
|
} else {
|
|
1393
|
-
failures.push('commands/
|
|
1398
|
+
failures.push('commands/declare');
|
|
1394
1399
|
}
|
|
1395
1400
|
}
|
|
1396
1401
|
|
|
1397
|
-
// Copy get-shit-done skill with path replacement
|
|
1398
|
-
const skillSrc = path.join(src, 'get-shit-done');
|
|
1399
|
-
const skillDest = path.join(targetDir, 'get-shit-done');
|
|
1400
|
-
copyWithPathReplacement(skillSrc, skillDest, pathPrefix, runtime);
|
|
1401
|
-
if (verifyInstalled(skillDest, 'get-shit-done')) {
|
|
1402
|
-
console.log(` ${green}✓${reset} Installed get-shit-done`);
|
|
1403
|
-
} else {
|
|
1404
|
-
failures.push('get-shit-done');
|
|
1405
|
-
}
|
|
1406
|
-
|
|
1407
1402
|
// Copy agents to agents directory
|
|
1408
1403
|
const agentsSrc = path.join(src, 'agents');
|
|
1409
1404
|
if (fs.existsSync(agentsSrc)) {
|
|
@@ -1444,9 +1439,23 @@ function install(isGlobal, runtime = 'claude') {
|
|
|
1444
1439
|
}
|
|
1445
1440
|
}
|
|
1446
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
|
+
|
|
1452
|
+
// Ensure declare/ metadata dir exists for VERSION and CHANGELOG
|
|
1453
|
+
const declareMetaDir = path.join(targetDir, 'declare');
|
|
1454
|
+
fs.mkdirSync(declareMetaDir, { recursive: true });
|
|
1455
|
+
|
|
1447
1456
|
// Copy CHANGELOG.md
|
|
1448
1457
|
const changelogSrc = path.join(src, 'CHANGELOG.md');
|
|
1449
|
-
const changelogDest = path.join(
|
|
1458
|
+
const changelogDest = path.join(declareMetaDir, 'CHANGELOG.md');
|
|
1450
1459
|
if (fs.existsSync(changelogSrc)) {
|
|
1451
1460
|
fs.copyFileSync(changelogSrc, changelogDest);
|
|
1452
1461
|
if (verifyFileInstalled(changelogDest, 'CHANGELOG.md')) {
|
|
@@ -1457,7 +1466,7 @@ function install(isGlobal, runtime = 'claude') {
|
|
|
1457
1466
|
}
|
|
1458
1467
|
|
|
1459
1468
|
// Write VERSION file
|
|
1460
|
-
const versionDest = path.join(
|
|
1469
|
+
const versionDest = path.join(declareMetaDir, 'VERSION');
|
|
1461
1470
|
fs.writeFileSync(versionDest, pkg.version);
|
|
1462
1471
|
if (verifyFileInstalled(versionDest, 'VERSION')) {
|
|
1463
1472
|
console.log(` ${green}✓${reset} Wrote VERSION (${pkg.version})`);
|
|
@@ -1590,11 +1599,11 @@ function finishInstall(settingsPath, settings, statuslineCommand, shouldInstallS
|
|
|
1590
1599
|
if (runtime === 'opencode') program = 'OpenCode';
|
|
1591
1600
|
if (runtime === 'gemini') program = 'Gemini';
|
|
1592
1601
|
|
|
1593
|
-
const command = isOpencode ? '/
|
|
1602
|
+
const command = isOpencode ? '/declare-help' : '/declare:help';
|
|
1594
1603
|
console.log(`
|
|
1595
1604
|
${green}Done!${reset} Launch ${program} and run ${cyan}${command}${reset}.
|
|
1596
1605
|
|
|
1597
|
-
${cyan}
|
|
1606
|
+
${cyan}Docs & source:${reset} https://github.com/decocms/declare-cc
|
|
1598
1607
|
`);
|
|
1599
1608
|
}
|
|
1600
1609
|
|
package/package.json
CHANGED