@doquflow/cli 0.4.6 → 0.5.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/dist/index.js CHANGED
@@ -35,12 +35,21 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  })();
36
36
  // eslint-disable-next-line @typescript-eslint/no-var-requires
37
37
  const { version } = require('../package.json');
38
- const [, , cmd, flag] = process.argv;
38
+ const args = process.argv.slice(2);
39
+ const [cmd, ...rest] = args;
40
+ // ── Simple arg parser ────────────────────────────────────────────────────────
41
+ function hasFlag(...flags) {
42
+ return flags.some(f => rest.includes(f));
43
+ }
44
+ function getFlagValue(flag) {
45
+ const idx = rest.indexOf(flag);
46
+ return idx !== -1 ? rest[idx + 1] : undefined;
47
+ }
39
48
  if (cmd === '--version' || cmd === '-v') {
40
49
  console.log(version);
41
50
  }
42
51
  else if (cmd === 'init') {
43
- if (flag === '--interactive' || flag === '-i') {
52
+ if (hasFlag('--interactive', '-i')) {
44
53
  Promise.resolve().then(() => __importStar(require('./commands/init-interactive'))).then(m => m.runInteractive());
45
54
  }
46
55
  else {
@@ -52,18 +61,93 @@ else if (cmd === 'status') {
52
61
  }
53
62
  else if (cmd === 'suggest') {
54
63
  Promise.resolve().then(() => __importStar(require('./commands/suggest'))).then(m => m.run());
64
+ // ── NEW: watch — auto-sync daemon ───────────────────────────────────────────
65
+ }
66
+ else if (cmd === 'watch') {
67
+ const subCmd = rest[0];
68
+ if (subCmd === 'stop') {
69
+ Promise.resolve().then(() => __importStar(require('./commands/watch-stop'))).then(m => m.runStop(process.cwd()));
70
+ }
71
+ else if (subCmd === 'status') {
72
+ Promise.resolve().then(() => __importStar(require('./commands/watch-stop'))).then(m => m.runStatus(process.cwd()));
73
+ }
74
+ else if (subCmd === 'restart') {
75
+ Promise.resolve().then(() => __importStar(require('./commands/watch-stop'))).then(m => m.runRestart(process.cwd()));
76
+ }
77
+ else {
78
+ // Normal watch start
79
+ const lintHours = getFlagValue('--lint-interval');
80
+ const codeExt = getFlagValue('--code-ext');
81
+ Promise.resolve().then(() => __importStar(require('./commands/watch'))).then(m => m.run({
82
+ ai: hasFlag('--ai'),
83
+ forceCopilot: hasFlag('--copilot'),
84
+ forceClaude: hasFlag('--claude'),
85
+ forceCodex: hasFlag('--codex'),
86
+ lintIntervalHours: lintHours ? Number(lintHours) : 24,
87
+ codeExtensions: codeExt ? codeExt.split(',') : undefined,
88
+ allowDangerousPermissions: hasFlag('--allow-dangerous-permissions'),
89
+ }));
90
+ }
91
+ // ── NEW: sync — one-shot sync for CI/CD and git hooks ───────────────────────
92
+ }
93
+ else if (cmd === 'sync') {
94
+ const sinceCommit = getFlagValue('--since-commit');
95
+ const sourceFile = getFlagValue('--source');
96
+ const failScore = getFlagValue('--fail-on-score');
97
+ Promise.resolve().then(() => __importStar(require('./commands/sync'))).then(m => m.run({
98
+ ai: hasFlag('--ai'),
99
+ forceCopilot: hasFlag('--copilot'),
100
+ forceClaude: hasFlag('--claude'),
101
+ forceCodex: hasFlag('--codex'),
102
+ sinceCommit,
103
+ sourceFile,
104
+ noLint: hasFlag('--no-lint'),
105
+ failOnScore: failScore ? Number(failScore) : 70,
106
+ quiet: hasFlag('--quiet', '-q'),
107
+ allowDangerousPermissions: hasFlag('--allow-dangerous-permissions'),
108
+ }));
55
109
  }
56
110
  else {
57
111
  console.log(`DocuFlow v${version}`);
58
112
  console.log('');
59
- console.log('Usage: docuflow <command>');
113
+ console.log('Usage: docuflow <command> [options]');
60
114
  console.log('');
61
115
  console.log('Commands:');
62
- console.log(' init Register DocuFlow MCP and generate CLAUDE.md');
63
- console.log(' init --interactive Interactive setup wizard (choose domain, project name)');
64
- console.log(' status Show wiki health, page counts, and MCP status');
65
- console.log(' suggest Show what to document first (domain-specific guidance)');
116
+ console.log(' init Register DocuFlow MCP and generate CLAUDE.md');
117
+ console.log(' init --interactive Interactive setup wizard');
118
+ console.log(' status Show wiki health, page counts, and MCP status');
119
+ console.log(' suggest Show what to document first (domain-specific)');
120
+ console.log(' watch Start auto-sync daemon (watches for changes)');
121
+ console.log(' watch --ai Auto-detect best AI bridge (copilot > claude > codex > api)');
122
+ console.log(' watch --ai --copilot Force @github/copilot CLI (direct MCP tool calling ⚡)');
123
+ console.log(' watch --ai --claude Force Claude Code CLI (direct MCP tool calling ⚡)');
124
+ console.log(' watch --ai --codex Force Codex CLI (generates doc → ingest)');
125
+ console.log(' watch --lint-interval N Run lint every N hours (default: 24)');
126
+ console.log(' watch --code-ext ts,py Watch only these file extensions');
127
+ console.log(' watch stop Stop the running watch daemon for this project');
128
+ console.log(' watch status Show daemon state: running/stopped, PID, uptime, bridge');
129
+ console.log(' watch restart Stop current daemon and restart with same options');
130
+ console.log(' sync One-shot sync: ingest all sources + rebuild index');
131
+ console.log(' sync --ai AI-powered sync (auto-detects bridge)');
132
+ console.log(' sync --ai --copilot Copilot drives DocuFlow MCP tools directly ⚡');
133
+ console.log(' sync --ai --claude Claude drives DocuFlow MCP tools directly ⚡');
134
+ console.log(' sync --ai --codex Codex generates doc → ingest');
135
+ console.log(' sync --since-commit REF Diff code changes since git ref (e.g. HEAD~1)');
136
+ console.log(' sync --source FILE Sync a single source file');
137
+ console.log(' sync --no-lint Skip health check (faster)');
138
+ console.log(' sync --fail-on-score N Exit 1 if health score < N (default: 70)');
139
+ console.log(' sync --quiet Suppress output (CI mode)');
66
140
  console.log('');
67
141
  console.log('Options:');
68
- console.log(' --version, -v Print version number');
142
+ console.log(' --version, -v Print version number');
143
+ console.log(' --allow-dangerous-permissions Pass --dangerously-skip-permissions to Claude CLI');
144
+ console.log(' Required for Claude bridge in non-interactive use.');
145
+ console.log(' Only use when file content in this project is trusted.');
146
+ console.log('');
147
+ console.log('AI bridge priority (for --ai flag):');
148
+ console.log(' 1. copilot (@github/copilot) — calls DocuFlow MCP tools directly ⚡');
149
+ console.log(' 2. claude (Claude Code CLI) — calls DocuFlow MCP tools directly ⚡');
150
+ console.log(' 3. codex (OpenAI Codex CLI) — generates doc text, then ingests');
151
+ console.log(' 4. api (ANTHROPIC_API_KEY env) — generates doc text, then ingests');
152
+ console.log(' Use --copilot / --claude / --codex to override auto-detection.');
69
153
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doquflow/cli",
3
- "version": "0.4.6",
3
+ "version": "0.5.2",
4
4
  "description": "CLI for setting up Docuflow in your project",
5
5
  "author": "Docuflow <hello@doquflows.dev>",
6
6
  "license": "MIT",
@@ -30,7 +30,7 @@
30
30
  "build": "tsc"
31
31
  },
32
32
  "dependencies": {
33
- "@doquflow/server": "0.4.6"
33
+ "@doquflow/server": "0.5.2"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/node": "^22.0.0",