@unlaxer/dge-toolkit 2.0.1 → 2.1.0
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/dge-tool.js +122 -0
- package/package.json +4 -2
- package/skills/dge-session.md +19 -1
- package/version.txt +1 -1
package/bin/dge-tool.js
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
const VERSION = '1.0.0';
|
|
7
|
+
const command = process.argv[2];
|
|
8
|
+
const arg = process.argv[3];
|
|
9
|
+
|
|
10
|
+
function findFlowsDir() {
|
|
11
|
+
// Look for dge/flows/ from current directory
|
|
12
|
+
const candidates = ['dge/flows', 'flows'];
|
|
13
|
+
for (const dir of candidates) {
|
|
14
|
+
if (fs.existsSync(dir)) return dir;
|
|
15
|
+
}
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function cmdSave() {
|
|
20
|
+
const file = arg;
|
|
21
|
+
if (!file) {
|
|
22
|
+
console.error('ERROR: file path required. Usage: echo "content" | dge-tool save <file>');
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const dir = path.dirname(file);
|
|
27
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
28
|
+
|
|
29
|
+
let content = '';
|
|
30
|
+
process.stdin.setEncoding('utf8');
|
|
31
|
+
process.stdin.on('data', chunk => { content += chunk; });
|
|
32
|
+
process.stdin.on('end', () => {
|
|
33
|
+
fs.writeFileSync(file, content);
|
|
34
|
+
const bytes = Buffer.byteLength(content);
|
|
35
|
+
console.log(`SAVED: ${file} (${bytes} bytes)`);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function cmdPrompt() {
|
|
40
|
+
const flow = arg || 'quick';
|
|
41
|
+
const flowsDir = findFlowsDir();
|
|
42
|
+
const yamlFile = flowsDir ? path.join(flowsDir, `${flow}.yaml`) : null;
|
|
43
|
+
|
|
44
|
+
if (yamlFile && fs.existsSync(yamlFile)) {
|
|
45
|
+
const content = fs.readFileSync(yamlFile, 'utf8');
|
|
46
|
+
const lines = content.split('\n');
|
|
47
|
+
|
|
48
|
+
// Extract display_name from post_actions section
|
|
49
|
+
let inPostActions = false;
|
|
50
|
+
const actions = [];
|
|
51
|
+
for (const line of lines) {
|
|
52
|
+
if (line.match(/^post_actions:/)) {
|
|
53
|
+
inPostActions = true;
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
if (inPostActions && line.match(/^\S/) && !line.match(/^\s/)) {
|
|
57
|
+
break; // End of post_actions section
|
|
58
|
+
}
|
|
59
|
+
if (inPostActions) {
|
|
60
|
+
const match = line.match(/display_name:\s*"(.+?)"/);
|
|
61
|
+
if (match) actions.push(match[1]);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (actions.length > 0) {
|
|
66
|
+
actions.forEach((a, i) => {
|
|
67
|
+
console.log(` ${i + 1}. ${a}`);
|
|
68
|
+
});
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Default choices
|
|
74
|
+
console.log(' 1. DGE を回す');
|
|
75
|
+
console.log(' 2. 実装できるまで回す');
|
|
76
|
+
console.log(' 3. 実装する');
|
|
77
|
+
console.log(' 4. 素の LLM でも回してマージ');
|
|
78
|
+
console.log(' 5. 後で');
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function cmdVersion() {
|
|
82
|
+
console.log(`dge-tool v${VERSION}`);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function cmdHelp() {
|
|
86
|
+
console.log(`dge-tool v${VERSION} — DGE MUST enforcement CLI
|
|
87
|
+
|
|
88
|
+
Commands:
|
|
89
|
+
save <file> Save stdin to file (ensures MUST: always save)
|
|
90
|
+
prompt [flow] Show numbered choices from flow YAML (ensures MUST: show choices)
|
|
91
|
+
version Show version
|
|
92
|
+
help Show this help
|
|
93
|
+
|
|
94
|
+
Examples:
|
|
95
|
+
echo "session content" | dge-tool save dge/sessions/auth-api.md
|
|
96
|
+
dge-tool prompt quick
|
|
97
|
+
dge-tool prompt design-review`);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Dispatch
|
|
101
|
+
switch (command) {
|
|
102
|
+
case 'save':
|
|
103
|
+
cmdSave();
|
|
104
|
+
break;
|
|
105
|
+
case 'prompt':
|
|
106
|
+
cmdPrompt();
|
|
107
|
+
break;
|
|
108
|
+
case 'version':
|
|
109
|
+
case '-v':
|
|
110
|
+
case '--version':
|
|
111
|
+
cmdVersion();
|
|
112
|
+
break;
|
|
113
|
+
case 'help':
|
|
114
|
+
case '-h':
|
|
115
|
+
case '--help':
|
|
116
|
+
case undefined:
|
|
117
|
+
cmdHelp();
|
|
118
|
+
break;
|
|
119
|
+
default:
|
|
120
|
+
console.error(`ERROR: unknown command "${command}". Run "dge-tool help" for usage.`);
|
|
121
|
+
process.exit(1);
|
|
122
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unlaxer/dge-toolkit",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "DGE (Dialogue-driven Gap Extraction) — 会話劇で設計の穴を発見するメソッドkit",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
],
|
|
19
19
|
"bin": {
|
|
20
20
|
"dge-install": "./install.sh",
|
|
21
|
-
"dge-update": "./update.sh"
|
|
21
|
+
"dge-update": "./update.sh",
|
|
22
|
+
"dge-tool": "./bin/dge-tool.js"
|
|
22
23
|
},
|
|
23
24
|
"files": [
|
|
24
25
|
"LICENSE",
|
|
@@ -34,6 +35,7 @@
|
|
|
34
35
|
"INTERNALS.md",
|
|
35
36
|
"CUSTOMIZING.md",
|
|
36
37
|
"dialogue-techniques.md",
|
|
38
|
+
"bin/",
|
|
37
39
|
"install.sh",
|
|
38
40
|
"update.sh"
|
|
39
41
|
],
|
package/skills/dge-session.md
CHANGED
|
@@ -36,6 +36,9 @@
|
|
|
36
36
|
3. `dge/custom/characters/*.md` があれば Prompt Core を読む
|
|
37
37
|
4. `dge/patterns.md` を読む
|
|
38
38
|
5. `dge/version.txt` があれば 1 行表示
|
|
39
|
+
6. **dge-tool 検出**: Bash で `dge-tool version` を実行。
|
|
40
|
+
- 成功 → `🔧 Tool mode (dge-tool vX.X.X)` と表示。以降 Step 7, 8 で dge-tool を使用
|
|
41
|
+
- 失敗 → Skill mode(従来通り)。dge-tool なしでも全機能動作
|
|
39
42
|
|
|
40
43
|
### Step 2: テーマ確認(全 flow 共通)
|
|
41
44
|
明確なら次へ。不明確なら掘り下げる。
|
|
@@ -62,6 +65,15 @@ built-in + カスタムキャラを統合表示。
|
|
|
62
65
|
- brainstorm: アイデアに分類を付与(severity なし)
|
|
63
66
|
|
|
64
67
|
### Step 7: 保存(全 flow 共通、MUST)
|
|
68
|
+
|
|
69
|
+
**Tool mode**: Bash で実行:
|
|
70
|
+
```
|
|
71
|
+
echo "<session 全文>" | dge-tool save <output_dir>/<theme>.md
|
|
72
|
+
```
|
|
73
|
+
→ "SAVED: ..." が返れば成功。失敗したら Write ツールでフォールバック。
|
|
74
|
+
|
|
75
|
+
**Skill mode**: Write ツールでファイル保存。
|
|
76
|
+
|
|
65
77
|
flow の output_dir に保存(デフォルト: `dge/sessions/`)。
|
|
66
78
|
プロジェクトファイルがあれば更新。
|
|
67
79
|
|
|
@@ -81,7 +93,13 @@ flow の output_dir に保存(デフォルト: `dge/sessions/`)。
|
|
|
81
93
|
**全文**: `[ファイルパス]`
|
|
82
94
|
```
|
|
83
95
|
|
|
84
|
-
|
|
96
|
+
**Tool mode**: Bash で実行:
|
|
97
|
+
```
|
|
98
|
+
dge-tool prompt <flow>
|
|
99
|
+
```
|
|
100
|
+
→ 番号付き選択肢が返る。そのまま表示。失敗したらデフォルト選択肢でフォールバック。
|
|
101
|
+
|
|
102
|
+
**Skill mode**: 選択肢は flow YAML の post_actions から表示。YAML がない場合のデフォルト:
|
|
85
103
|
```
|
|
86
104
|
1. DGE を回す
|
|
87
105
|
2. 実装できるまで回す
|
package/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.0
|
|
1
|
+
2.1.0
|