company-skill 3.1.1 → 3.1.3

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.
Files changed (2) hide show
  1. package/hooks/stop-guard.js +16 -15
  2. package/package.json +1 -1
@@ -8,12 +8,18 @@ const companyDir = path.join(cwd, '.company');
8
8
  const criteriaPath = path.join(companyDir, 'criteria.json');
9
9
  const goalPath = path.join(companyDir, 'GOAL.md');
10
10
  const cancelPath = path.join(companyDir, 'CANCEL');
11
- const counterPath = path.join(companyDir, '.stop-counter');
11
+
12
+ // Read stdin for stop_hook_active flag
13
+ let stdinData = '';
14
+ try { stdinData = fs.readFileSync('/dev/stdin', 'utf8'); } catch (e) {}
15
+ let hookActive = false;
16
+ try { hookActive = JSON.parse(stdinData).stop_hook_active === true; } catch (e) {}
17
+
18
+ // If hook already fired once and Claude is trying to stop again, let it
19
+ if (hookActive) process.exit(0);
12
20
 
13
21
  // No company running
14
- if (!fs.existsSync(goalPath) && !fs.existsSync(criteriaPath)) {
15
- process.exit(0);
16
- }
22
+ if (!fs.existsSync(goalPath) && !fs.existsSync(criteriaPath)) process.exit(0);
17
23
 
18
24
  // Cancel signal
19
25
  if (fs.existsSync(cancelPath)) {
@@ -21,8 +27,6 @@ if (fs.existsSync(cancelPath)) {
21
27
  process.exit(0);
22
28
  }
23
29
 
24
- // No limit. Runs until done or user cancels (touch .company/CANCEL).
25
-
26
30
  // Check criteria
27
31
  if (fs.existsSync(criteriaPath)) {
28
32
  try {
@@ -30,24 +34,21 @@ if (fs.existsSync(criteriaPath)) {
30
34
  const all = data.criteria || [];
31
35
  const failing = all.filter(c => !c.passes || !c.evidence);
32
36
 
33
- if (all.length > 0 && failing.length === 0) {
34
- try { fs.unlinkSync(counterPath); } catch (e) {}
35
- process.exit(0); // All pass, allow stop
36
- }
37
+ if (all.length > 0 && failing.length === 0) process.exit(0);
37
38
 
38
39
  const failList = failing.map(c => c.description).join(', ');
39
40
  console.log(JSON.stringify({
40
- continue: false,
41
- message: "[COMPANY CYCLE] " + failing.length + "/" + all.length + " criteria not met: " + failList + ". Continue THINK > EXECUTE > VERIFY. Read .company/criteria.json."
41
+ decision: "block",
42
+ reason: "[COMPANY] " + failing.length + "/" + all.length + " criteria not met: " + failList + ". Continue THINK > EXECUTE > VERIFY. Read .company/criteria.json."
42
43
  }));
43
44
  process.exit(0);
44
45
  } catch (e) {
45
- process.exit(0); // Malformed, allow stop
46
+ process.exit(0);
46
47
  }
47
48
  }
48
49
 
49
50
  // No criteria but goal exists
50
51
  console.log(JSON.stringify({
51
- continue: false,
52
- message: "[COMPANY] Goal not achieved. Read .company/GOAL.md and create criteria.json, then start THINK > EXECUTE > VERIFY."
52
+ decision: "block",
53
+ reason: "[COMPANY] Goal not achieved. Read .company/GOAL.md, create criteria.json, start THINK > EXECUTE > VERIFY."
53
54
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "company-skill",
3
- "version": "3.1.1",
3
+ "version": "3.1.3",
4
4
  "description": "Goal-driven multi-employee company for Claude Code. Give it a goal, it runs until done.",
5
5
  "bin": {
6
6
  "company-skill": "./bin/install.js"