deepflow 0.1.14 → 0.1.16

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 CHANGED
@@ -74,9 +74,7 @@ async function main() {
74
74
  ];
75
75
 
76
76
  if (level === 'global') {
77
- dirs.push('hooks', 'deepflow');
78
- } else {
79
- dirs.push('deepflow');
77
+ dirs.push('hooks');
80
78
  }
81
79
 
82
80
  for (const dir of dirs) {
@@ -120,14 +118,9 @@ async function main() {
120
118
  }
121
119
  }
122
120
 
123
- // Copy VERSION file (for update checking)
124
- const versionFile = path.join(PACKAGE_DIR, 'VERSION');
125
- let installedVersion = null;
126
- if (fs.existsSync(versionFile)) {
127
- fs.copyFileSync(versionFile, path.join(CLAUDE_DIR, 'deepflow', 'VERSION'));
128
- installedVersion = fs.readFileSync(versionFile, 'utf8').trim();
129
- log('Version file installed');
130
- }
121
+ // Get version from package.json (single source of truth)
122
+ const packageJson = require(path.join(PACKAGE_DIR, 'package.json'));
123
+ const installedVersion = packageJson.version;
131
124
 
132
125
  // Update cache to reflect installed version (prevents stale "update available" message)
133
126
  const cacheDir = path.join(GLOBAL_DIR, 'cache');
@@ -309,8 +302,7 @@ async function uninstall() {
309
302
  'skills/atomic-commits',
310
303
  'skills/code-completeness',
311
304
  'skills/gap-discovery',
312
- 'agents/reasoner.md',
313
- 'deepflow'
305
+ 'agents/reasoner.md'
314
306
  ];
315
307
 
316
308
  if (level === 'global') {
@@ -73,16 +73,17 @@ async function checkForUpdate() {
73
73
  }
74
74
 
75
75
  function getCurrentVersion() {
76
- // Check deepflow VERSION file
77
- const dfLocalPath = path.join(process.cwd(), '.claude', 'deepflow', 'VERSION');
78
- const dfGlobalPath = path.join(os.homedir(), '.claude', 'deepflow', 'VERSION');
79
-
80
- for (const versionPath of [dfLocalPath, dfGlobalPath]) {
81
- if (fs.existsSync(versionPath)) {
82
- return fs.readFileSync(versionPath, 'utf8').trim();
76
+ // Read current version from cache (written by installer)
77
+ if (fs.existsSync(CACHE_FILE)) {
78
+ try {
79
+ const cache = JSON.parse(fs.readFileSync(CACHE_FILE, 'utf8'));
80
+ if (cache.currentVersion) {
81
+ return cache.currentVersion;
82
+ }
83
+ } catch (e) {
84
+ // Fall through
83
85
  }
84
86
  }
85
-
86
87
  return null;
87
88
  }
88
89
 
@@ -97,17 +97,53 @@ function buildContextMeter(contextWindow) {
97
97
  return `${color}${bar}${colors.reset} ${percentage}%`;
98
98
  }
99
99
 
100
+ const TRIGGER_THROTTLE = 60 * 1000; // 60 seconds between triggers
101
+
100
102
  function checkForUpdate() {
103
+ const cacheDir = path.join(os.homedir(), '.claude', 'cache');
104
+ const cachePath = path.join(cacheDir, 'df-update-check.json');
105
+ const triggerPath = path.join(cacheDir, 'df-trigger-time');
106
+
107
+ // Trigger background check if not triggered recently (throttle rapid refreshes)
101
108
  try {
102
- const cacheDir = path.join(os.homedir(), '.claude', 'cache');
103
- const cachePath = path.join(cacheDir, 'df-update-check.json');
109
+ let shouldTrigger = true;
110
+ if (fs.existsSync(triggerPath)) {
111
+ const lastTrigger = parseInt(fs.readFileSync(triggerPath, 'utf8'), 10);
112
+ shouldTrigger = Date.now() - lastTrigger > TRIGGER_THROTTLE;
113
+ }
114
+ if (shouldTrigger) {
115
+ fs.mkdirSync(cacheDir, { recursive: true });
116
+ fs.writeFileSync(triggerPath, String(Date.now()));
117
+ triggerUpdateCheck();
118
+ }
119
+ } catch (e) {
120
+ // Fail silently
121
+ }
104
122
 
105
- if (!fs.existsSync(cachePath)) return null;
123
+ // Return cached result
124
+ try {
125
+ if (fs.existsSync(cachePath)) {
126
+ return JSON.parse(fs.readFileSync(cachePath, 'utf8'));
127
+ }
128
+ } catch (e) {
129
+ // Fail silently
130
+ }
131
+ return null;
132
+ }
106
133
 
107
- const cache = JSON.parse(fs.readFileSync(cachePath, 'utf8'));
108
- return cache;
134
+ function triggerUpdateCheck() {
135
+ try {
136
+ const checkerPath = path.join(os.homedir(), '.claude', 'hooks', 'df-check-update.js');
137
+ if (fs.existsSync(checkerPath)) {
138
+ const { spawn } = require('child_process');
139
+ const child = spawn(process.execPath, [checkerPath], {
140
+ detached: true,
141
+ stdio: 'ignore'
142
+ });
143
+ child.unref();
144
+ }
109
145
  } catch (e) {
110
- return null;
146
+ // Fail silently
111
147
  }
112
148
  }
113
149
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepflow",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "description": "Stay in flow state - lightweight spec-driven task orchestration for Claude Code",
5
5
  "keywords": [
6
6
  "claude",
@@ -31,8 +31,7 @@
31
31
  "bin/",
32
32
  "src/",
33
33
  "hooks/",
34
- "templates/",
35
- "VERSION"
34
+ "templates/"
36
35
  ],
37
36
  "engines": {
38
37
  "node": ">=16.0.0"
package/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.1.14