declare-cc 0.3.4 → 0.3.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/bin/install.js +19 -3
- package/commands/declare/future.md +3 -3
- package/commands/declare/init.md +7 -4
- package/package.json +1 -1
package/bin/install.js
CHANGED
|
@@ -662,10 +662,12 @@ function copyFlattenedCommands(srcDir, destDir, prefix, pathPrefix, runtime) {
|
|
|
662
662
|
const localClaudeRegex = /\.\/\.claude\//g;
|
|
663
663
|
const opencodeDirRegex = /~\/\.opencode\//g;
|
|
664
664
|
const distToolsRegex = /dist\/declare-tools\.cjs/g;
|
|
665
|
+
const workflowsRegex = /@workflows\//g;
|
|
665
666
|
content = content.replace(globalClaudeRegex, pathPrefix);
|
|
666
667
|
content = content.replace(localClaudeRegex, `./${getDirName(runtime)}/`);
|
|
667
668
|
content = content.replace(opencodeDirRegex, pathPrefix);
|
|
668
669
|
content = content.replace(distToolsRegex, `${pathPrefix}declare-tools.cjs`);
|
|
670
|
+
content = content.replace(workflowsRegex, `@${pathPrefix}workflows/`);
|
|
669
671
|
content = processAttribution(content, getCommitAttribution(runtime));
|
|
670
672
|
content = convertClaudeToOpencodeFrontmatter(content);
|
|
671
673
|
|
|
@@ -706,9 +708,11 @@ function copyWithPathReplacement(srcDir, destDir, pathPrefix, runtime) {
|
|
|
706
708
|
const globalClaudeRegex = /~\/\.claude\//g;
|
|
707
709
|
const localClaudeRegex = /\.\/\.claude\//g;
|
|
708
710
|
const distToolsRegex = /dist\/declare-tools\.cjs/g;
|
|
711
|
+
const workflowsRegex = /@workflows\//g;
|
|
709
712
|
content = content.replace(globalClaudeRegex, pathPrefix);
|
|
710
713
|
content = content.replace(localClaudeRegex, `./${dirName}/`);
|
|
711
714
|
content = content.replace(distToolsRegex, `${pathPrefix}declare-tools.cjs`);
|
|
715
|
+
content = content.replace(workflowsRegex, `@${pathPrefix}workflows/`);
|
|
712
716
|
content = processAttribution(content, getCommitAttribution(runtime));
|
|
713
717
|
|
|
714
718
|
// Convert frontmatter for opencode compatibility
|
|
@@ -1448,6 +1452,19 @@ function install(isGlobal, runtime = 'claude') {
|
|
|
1448
1452
|
}
|
|
1449
1453
|
}
|
|
1450
1454
|
|
|
1455
|
+
// Copy workflows/ so @workflows/ references in commands resolve correctly
|
|
1456
|
+
const workflowsSrc = path.join(src, 'workflows');
|
|
1457
|
+
if (fs.existsSync(workflowsSrc)) {
|
|
1458
|
+
const workflowsDest = path.join(targetDir, 'workflows');
|
|
1459
|
+
fs.mkdirSync(workflowsDest, { recursive: true });
|
|
1460
|
+
for (const entry of fs.readdirSync(workflowsSrc, { withFileTypes: true })) {
|
|
1461
|
+
if (entry.isFile()) {
|
|
1462
|
+
fs.copyFileSync(path.join(workflowsSrc, entry.name), path.join(workflowsDest, entry.name));
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
console.log(` ${green}✓${reset} Installed workflows/`);
|
|
1466
|
+
}
|
|
1467
|
+
|
|
1451
1468
|
// Copy declare-tools.cjs bundle so commands can run `node {pathPrefix}declare-tools.cjs`
|
|
1452
1469
|
const bundleSrc = path.join(src, 'dist', 'declare-tools.cjs');
|
|
1453
1470
|
const bundleDest = path.join(targetDir, 'declare-tools.cjs');
|
|
@@ -1490,9 +1507,8 @@ function install(isGlobal, runtime = 'claude') {
|
|
|
1490
1507
|
fs.writeFileSync(pkgJsonDest, '{"type":"commonjs"}\n');
|
|
1491
1508
|
console.log(` ${green}✓${reset} Wrote package.json (CommonJS mode)`);
|
|
1492
1509
|
|
|
1493
|
-
// Copy hooks
|
|
1494
|
-
|
|
1495
|
-
const hooksSrc = path.join(src, 'hooks', 'dist');
|
|
1510
|
+
// Copy hooks (replaces '.claude' with runtime-specific config dir in .js files)
|
|
1511
|
+
const hooksSrc = path.join(src, 'hooks');
|
|
1496
1512
|
if (fs.existsSync(hooksSrc)) {
|
|
1497
1513
|
const hooksDest = path.join(targetDir, 'hooks');
|
|
1498
1514
|
fs.mkdirSync(hooksDest, { recursive: true });
|
|
@@ -14,7 +14,7 @@ Guide the user through declaring their project's future as present-tense truth s
|
|
|
14
14
|
**Step 1: Load current graph state.**
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
|
-
node
|
|
17
|
+
node dist/declare-tools.cjs load-graph
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
Parse the JSON output. If the output contains an `error` field (e.g., "No Declare project found"), tell the user to run `/declare:init` first and stop.
|
|
@@ -30,7 +30,7 @@ Note the existing declarations from the graph (if any) -- the workflow needs thi
|
|
|
30
30
|
|
|
31
31
|
Read and follow the full workflow instructions:
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
@workflows/future.md
|
|
34
34
|
|
|
35
35
|
Pass the loaded graph state into the workflow so it knows about existing declarations.
|
|
36
36
|
|
|
@@ -39,7 +39,7 @@ Pass the loaded graph state into the workflow so it knows about existing declara
|
|
|
39
39
|
After each declaration passes language detection and NSR validation and the user confirms it, persist it:
|
|
40
40
|
|
|
41
41
|
```bash
|
|
42
|
-
node
|
|
42
|
+
node dist/declare-tools.cjs add-declaration --title "Short Title" --statement "Full present-tense declaration statement"
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
Parse the JSON output to confirm the declaration was created and note its assigned ID (e.g., D-01).
|
package/commands/declare/init.md
CHANGED
|
@@ -30,7 +30,10 @@ If the `existing` array is non-empty, present the existing files to the user and
|
|
|
30
30
|
|
|
31
31
|
**Step 3: Report results.**
|
|
32
32
|
|
|
33
|
-
Show the user a summary of what was created
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
Show the user a brief summary of what was created (file name + one-line purpose). If a commit was made, mention the hash.
|
|
34
|
+
|
|
35
|
+
Then immediately prompt the user to start declaring:
|
|
36
|
+
|
|
37
|
+
> **Ready. Run `/declare:future` to declare what's true when this project succeeds.**
|
|
38
|
+
|
|
39
|
+
Do not suggest editing files manually or running `/declare:status`. The next step is always `/declare:future`.
|
package/package.json
CHANGED