company-skill 3.2.0 → 3.3.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.
@@ -8,15 +8,7 @@ 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
-
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);
11
+ const lockPath = path.join(companyDir, '.stop-lock');
20
12
 
21
13
  // No company running
22
14
  if (!fs.existsSync(goalPath) && !fs.existsSync(criteriaPath)) process.exit(0);
@@ -24,9 +16,21 @@ if (!fs.existsSync(goalPath) && !fs.existsSync(criteriaPath)) process.exit(0);
24
16
  // Cancel signal
25
17
  if (fs.existsSync(cancelPath)) {
26
18
  try { fs.unlinkSync(cancelPath); } catch (e) {}
19
+ try { fs.unlinkSync(lockPath); } catch (e) {}
27
20
  process.exit(0);
28
21
  }
29
22
 
23
+ // If lock file exists and is recent (< 60s), this is a repeat stop. Allow it.
24
+ if (fs.existsSync(lockPath)) {
25
+ try {
26
+ const age = Date.now() - fs.statSync(lockPath).mtimeMs;
27
+ if (age < 60000) {
28
+ fs.unlinkSync(lockPath);
29
+ process.exit(0);
30
+ }
31
+ } catch (e) {}
32
+ }
33
+
30
34
  // Check criteria
31
35
  if (fs.existsSync(criteriaPath)) {
32
36
  try {
@@ -34,12 +38,17 @@ if (fs.existsSync(criteriaPath)) {
34
38
  const all = data.criteria || [];
35
39
  const failing = all.filter(c => !c.passes || !c.evidence);
36
40
 
37
- if (all.length > 0 && failing.length === 0) process.exit(0);
41
+ if (all.length > 0 && failing.length === 0) {
42
+ try { fs.unlinkSync(lockPath); } catch (e) {}
43
+ process.exit(0);
44
+ }
38
45
 
46
+ // Write lock, block this stop
47
+ fs.writeFileSync(lockPath, String(Date.now()));
39
48
  const failList = failing.map(c => c.description).join(', ');
40
49
  console.log(JSON.stringify({
41
50
  decision: "block",
42
- reason: "[COMPANY] " + failing.length + "/" + all.length + " criteria not met: " + failList + ". Continue THINK > EXECUTE > VERIFY. Read .company/criteria.json."
51
+ reason: "[COMPANY] " + failing.length + "/" + all.length + " criteria not met: " + failList + ". Continue THINK > EXECUTE > VERIFY."
43
52
  }));
44
53
  process.exit(0);
45
54
  } catch (e) {
@@ -47,8 +56,9 @@ if (fs.existsSync(criteriaPath)) {
47
56
  }
48
57
  }
49
58
 
50
- // No criteria but goal exists
59
+ // No criteria but goal exists — block once
60
+ fs.writeFileSync(lockPath, String(Date.now()));
51
61
  console.log(JSON.stringify({
52
62
  decision: "block",
53
- reason: "[COMPANY] Goal not achieved. Read .company/GOAL.md, create criteria.json, start THINK > EXECUTE > VERIFY."
63
+ reason: "[COMPANY] Goal not achieved. Create criteria.json and start THINK > EXECUTE > VERIFY."
54
64
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "company-skill",
3
- "version": "3.2.0",
3
+ "version": "3.3.0",
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"
package/skill/SKILL.md CHANGED
@@ -21,9 +21,19 @@ allowed-tools:
21
21
 
22
22
  Give it a goal. Run every employee. Loop until verified done.
23
23
 
24
- ## Preamble
24
+ ## Preamble (MUST run first, before anything else)
25
25
 
26
- Print this as plain text (NOT Bash):
26
+ Step 1: Install skills. Run this Bash block IMMEDIATELY:
27
+
28
+ ```bash
29
+ INSTALLED=$(for d in ~/.claude/skills/*/SKILL.md .claude/skills/*/SKILL.md; do [ -f "$d" ] && basename "$(dirname "$d")"; done 2>/dev/null | sort -u)
30
+ echo "$INSTALLED" | grep -q "gstack" || npx gstack@latest install 2>/dev/null || true
31
+ echo "$INSTALLED" | grep -q "gsd" || npx -y get-shit-done-cc@latest install 2>/dev/null || true
32
+ echo "$INSTALLED" | grep -q "trailofbits" || (git clone --depth 1 https://github.com/trailofbits/skills.git /tmp/tob-skills 2>/dev/null && cp -r /tmp/tob-skills/.claude/skills/* ~/.claude/skills/ 2>/dev/null && rm -rf /tmp/tob-skills) || true
33
+ echo "Skills: $(for d in ~/.claude/skills/*/SKILL.md .claude/skills/*/SKILL.md; do [ -f "$d" ] && basename "$(dirname "$d")"; done 2>/dev/null | sort -u | tr '\n' ' ')"
34
+ ```
35
+
36
+ Step 2: Print banner as plain text (NOT Bash):
27
37
 
28
38
  ════════════════════════════════════════════════
29
39
  🏢 COMPANY SKILL ACTIVE
@@ -128,15 +138,7 @@ Deduplicated if user defines them in COMPANY.md.
128
138
 
129
139
  ## Skills
130
140
 
131
- ```bash
132
- INSTALLED=$(for d in ~/.claude/skills/*/SKILL.md .claude/skills/*/SKILL.md; do [ -f "$d" ] && basename "$(dirname "$d")"; done 2>/dev/null | sort -u)
133
- echo "$INSTALLED" | grep -q "gstack" || npx gstack@latest install 2>/dev/null || true
134
- echo "$INSTALLED" | grep -q "gsd" || npx -y get-shit-done-cc@latest install 2>/dev/null || true
135
- echo "$INSTALLED" | grep -q "trailofbits" || (git clone --depth 1 https://github.com/trailofbits/skills.git /tmp/tob-skills 2>/dev/null && cp -r /tmp/tob-skills/.claude/skills/* ~/.claude/skills/ 2>/dev/null && rm -rf /tmp/tob-skills) || true
136
- for d in ~/.claude/skills/*/SKILL.md .claude/skills/*/SKILL.md; do [ -f "$d" ] && basename "$(dirname "$d")"; done 2>/dev/null | sort -u
137
- ```
138
-
139
- When installed: MUST use /review for code review, /investigate for bugs, /qa for testing, /ship for PRs.
141
+ When installed: MUST use /review for code review, /investigate for bugs, /qa for testing, /ship for PRs. Skills are installed in the Preamble.
140
142
 
141
143
  ## Stop Hook
142
144