bobs-workshop 3.1.0 → 3.1.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../src/tools/background-agent/manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EAGZ,MAAM,SAAS,CAAC;AAQjB,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,KAAK,CAA8B;IAC3C,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,eAAe,CAAC,CAAiC;IACzD,OAAO,CAAC,kBAAkB,CAAqB;IAC/C,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAkC;IAEzD,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,WAAW,GAAG,iBAAiB;IAOvD,OAAO;IAOD,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC;YAoC3C,SAAS;IA8FvB,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;IAI/C,WAAW,IAAI,cAAc,EAAE;IAI/B,eAAe,IAAI,cAAc,EAAE;IAInC,WAAW,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,GAAG,IAAI;YAuClE,eAAe;YAmCf,wBAAwB;IAoCtC,OAAO,CAAC,YAAY;IASpB,OAAO,CAAC,WAAW;YAOL,gBAAgB;IAkI9B,QAAQ,IAAI,IAAI;CAmBjB"}
1
+ {"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../src/tools/background-agent/manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EAGZ,MAAM,SAAS,CAAC;AAQjB,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,KAAK,CAA8B;IAC3C,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,eAAe,CAAC,CAAiC;IACzD,OAAO,CAAC,kBAAkB,CAAqB;IAC/C,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAkC;IAEzD,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,WAAW,GAAG,iBAAiB;IAOvD,OAAO;IAOD,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC;YAoC3C,SAAS;IAyGvB,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;IAI/C,WAAW,IAAI,cAAc,EAAE;IAI/B,eAAe,IAAI,cAAc,EAAE;IAInC,WAAW,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,GAAG,IAAI;YAuClE,eAAe;YAmCf,wBAAwB;IAoCtC,OAAO,CAAC,YAAY;IASpB,OAAO,CAAC,WAAW;YAOL,gBAAgB;IAkI9B,QAAQ,IAAI,IAAI;CAmBjB"}
@@ -89,7 +89,12 @@ export class BackgroundManager {
89
89
  for (const skillName of input.skills) {
90
90
  const skillPath = join(this.directory, ".opencode", "skill", "bobs-workshop", skillName, "SKILL.md");
91
91
  if (existsSync(skillPath)) {
92
- const skillFile = readFileSync(skillPath, "utf8");
92
+ let skillFile = readFileSync(skillPath, "utf8");
93
+ // Sanitize content to prevent JSON parsing issues with kimi model
94
+ skillFile = skillFile
95
+ .replace(/[\x00-\x08\x0B-\x0C\x0E-\x1F]/g, '') // Remove control chars except \n, \r, \t
96
+ .replace(/\u2028/g, '\n') // Replace line separator with newline
97
+ .replace(/\u2029/g, '\n'); // Replace paragraph separator with newline
93
98
  skillContent += `\n\n---\n## Skill: ${skillName}\n\n${skillFile}`;
94
99
  }
95
100
  }
@@ -98,7 +103,13 @@ export class BackgroundManager {
98
103
  if (input.manual_path) {
99
104
  const { existsSync, readFileSync } = await import("node:fs");
100
105
  if (existsSync(input.manual_path)) {
101
- const manualContent = readFileSync(input.manual_path, "utf8");
106
+ let manualContent = readFileSync(input.manual_path, "utf8");
107
+ // Sanitize content to prevent JSON parsing issues with kimi model
108
+ // Remove control characters and ensure proper escaping
109
+ manualContent = manualContent
110
+ .replace(/[\x00-\x08\x0B-\x0C\x0E-\x1F]/g, '') // Remove control chars except \n, \r, \t
111
+ .replace(/\u2028/g, '\n') // Replace line separator with newline
112
+ .replace(/\u2029/g, '\n'); // Replace paragraph separator with newline
102
113
  skillContent = skillContent
103
114
  ? `${skillContent}\n\n## MANUAL Context:\n${manualContent}`
104
115
  : manualContent;
@@ -1 +1 @@
1
- {"version":3,"file":"verify-manual.d.ts","sourceRoot":"","sources":["../../../src/tools/manual/verify-manual.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAErE,QAAA,MAAM,gBAAgB,EAAE,cAkDtB,CAAC;AAEH,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"verify-manual.d.ts","sourceRoot":"","sources":["../../../src/tools/manual/verify-manual.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAErE,QAAA,MAAM,gBAAgB,EAAE,cAuDtB,CAAC;AAEH,eAAe,gBAAgB,CAAC"}
@@ -22,6 +22,11 @@ const VerifyManualTool = tool({
22
22
  let manualContent = "";
23
23
  if (existsSync(args.manual_path)) {
24
24
  manualContent = readFileSync(args.manual_path, "utf8");
25
+ // Sanitize content to prevent JSON parsing issues with kimi model
26
+ manualContent = manualContent
27
+ .replace(/[\x00-\x08\x0B-\x0C\x0E-\x1F]/g, '') // Remove control chars except \n, \r, \t
28
+ .replace(/\u2028/g, '\n') // Replace line separator with newline
29
+ .replace(/\u2029/g, '\n'); // Replace paragraph separator with newline
25
30
  }
26
31
  const skillPath = join(directory, ".opencode", "agent", "bobs-workshop", "bob-rev.md");
27
32
  let agentPrompt = "You are bob-rev, a reviewer agent that verifies implementation against MANUAL requirements.";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bobs-workshop",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "description": "MANUAL-driven development with background agents for OpenCode",
5
5
  "type": "module",
6
6
  "main": "./dist/plugins/bobs-workshop.js",
package/postinstall.js CHANGED
@@ -16,7 +16,9 @@ const PACKAGE_NAME = 'bobs-workshop';
16
16
  * Skip when: global npm update, or running from within bobs-workshop repo itself.
17
17
  */
18
18
  function isInstalledAsDependencyInThisRepo() {
19
- const projectRoot = process.cwd();
19
+ // Use INIT_CWD which npm sets to the directory where 'npm install' was invoked
20
+ // process.cwd() returns the package directory (node_modules/bobs-workshop/) during postinstall
21
+ const projectRoot = process.env.INIT_CWD || process.cwd();
20
22
  const pkgPath = join(projectRoot, 'package.json');
21
23
  if (!existsSync(pkgPath)) return false;
22
24
  let pkg;
@@ -68,7 +70,8 @@ function postinstall() {
68
70
  return; // Not a repo that depends on bobs-workshop (e.g. global update or bobs-workshop repo itself)
69
71
  }
70
72
 
71
- const projectRoot = process.cwd();
73
+ // Use INIT_CWD to get the actual project directory where npm install was run
74
+ const projectRoot = process.env.INIT_CWD || process.cwd();
72
75
  const opencodeDir = join(projectRoot, '.opencode');
73
76
 
74
77
  console.log('🔧 Installing bobs-workshop...');
@@ -117,7 +117,12 @@ export class BackgroundManager {
117
117
  for (const skillName of input.skills) {
118
118
  const skillPath = join(this.directory, ".opencode", "skill", "bobs-workshop", skillName, "SKILL.md");
119
119
  if (existsSync(skillPath)) {
120
- const skillFile = readFileSync(skillPath, "utf8");
120
+ let skillFile = readFileSync(skillPath, "utf8");
121
+ // Sanitize content to prevent JSON parsing issues with kimi model
122
+ skillFile = skillFile
123
+ .replace(/[\x00-\x08\x0B-\x0C\x0E-\x1F]/g, '') // Remove control chars except \n, \r, \t
124
+ .replace(/\u2028/g, '\n') // Replace line separator with newline
125
+ .replace(/\u2029/g, '\n'); // Replace paragraph separator with newline
121
126
  skillContent += `\n\n---\n## Skill: ${skillName}\n\n${skillFile}`;
122
127
  }
123
128
  }
@@ -127,7 +132,13 @@ export class BackgroundManager {
127
132
  if (input.manual_path) {
128
133
  const { existsSync, readFileSync } = await import("node:fs");
129
134
  if (existsSync(input.manual_path)) {
130
- const manualContent = readFileSync(input.manual_path, "utf8");
135
+ let manualContent = readFileSync(input.manual_path, "utf8");
136
+ // Sanitize content to prevent JSON parsing issues with kimi model
137
+ // Remove control characters and ensure proper escaping
138
+ manualContent = manualContent
139
+ .replace(/[\x00-\x08\x0B-\x0C\x0E-\x1F]/g, '') // Remove control chars except \n, \r, \t
140
+ .replace(/\u2028/g, '\n') // Replace line separator with newline
141
+ .replace(/\u2029/g, '\n'); // Replace paragraph separator with newline
131
142
  skillContent = skillContent
132
143
  ? `${skillContent}\n\n## MANUAL Context:\n${manualContent}`
133
144
  : manualContent;
@@ -27,6 +27,11 @@ const VerifyManualTool: ToolDefinition = tool({
27
27
  let manualContent = "";
28
28
  if (existsSync(args.manual_path)) {
29
29
  manualContent = readFileSync(args.manual_path, "utf8");
30
+ // Sanitize content to prevent JSON parsing issues with kimi model
31
+ manualContent = manualContent
32
+ .replace(/[\x00-\x08\x0B-\x0C\x0E-\x1F]/g, '') // Remove control chars except \n, \r, \t
33
+ .replace(/\u2028/g, '\n') // Replace line separator with newline
34
+ .replace(/\u2029/g, '\n'); // Replace paragraph separator with newline
30
35
  }
31
36
 
32
37
  const skillPath = join(directory, ".opencode", "agent", "bobs-workshop", "bob-rev.md");