@duypham93/openkit 0.2.3 → 0.2.5

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 (37) hide show
  1. package/README.md +14 -0
  2. package/agents/architect-agent.md +13 -7
  3. package/agents/ba-agent.md +11 -5
  4. package/agents/code-reviewer.md +7 -1
  5. package/agents/fullstack-agent.md +9 -2
  6. package/agents/master-orchestrator.md +19 -11
  7. package/agents/pm-agent.md +11 -5
  8. package/agents/qa-agent.md +13 -6
  9. package/agents/tech-lead-agent.md +12 -6
  10. package/assets/install-bundle/opencode/agents/ArchitectAgent.md +13 -7
  11. package/assets/install-bundle/opencode/agents/BAAgent.md +11 -5
  12. package/assets/install-bundle/opencode/agents/CodeReviewer.md +7 -1
  13. package/assets/install-bundle/opencode/agents/FullstackAgent.md +9 -2
  14. package/assets/install-bundle/opencode/agents/MasterOrchestrator.md +19 -11
  15. package/assets/install-bundle/opencode/agents/PMAgent.md +11 -5
  16. package/assets/install-bundle/opencode/agents/QAAgent.md +13 -6
  17. package/assets/install-bundle/opencode/agents/TechLeadAgent.md +12 -6
  18. package/assets/install-bundle/opencode/commands/brainstorm.md +13 -6
  19. package/assets/install-bundle/opencode/commands/delivery.md +15 -8
  20. package/assets/install-bundle/opencode/commands/execute-plan.md +15 -8
  21. package/assets/install-bundle/opencode/commands/migrate.md +16 -9
  22. package/assets/install-bundle/opencode/commands/quick-task.md +14 -7
  23. package/assets/install-bundle/opencode/commands/task.md +16 -8
  24. package/assets/install-bundle/opencode/commands/write-plan.md +15 -8
  25. package/commands/brainstorm.md +13 -6
  26. package/commands/delivery.md +15 -8
  27. package/commands/execute-plan.md +15 -8
  28. package/commands/migrate.md +16 -9
  29. package/commands/quick-task.md +14 -7
  30. package/commands/task.md +16 -8
  31. package/commands/write-plan.md +15 -8
  32. package/docs/operator/README.md +9 -0
  33. package/package.json +1 -1
  34. package/src/global/paths.js +6 -0
  35. package/src/global/workspace-shim.js +104 -0
  36. package/src/global/workspace-state.js +3 -0
  37. package/tests/cli/openkit-cli.test.js +5 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duypham93/openkit",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "type": "module",
5
5
  "files": [
6
6
  ".opencode/",
@@ -82,5 +82,11 @@ export function getWorkspacePaths({ projectRoot, env = process.env, platform = p
82
82
  legacyRuntimeDir: path.join(resolvedProjectRoot, '.opencode'),
83
83
  legacyWorkflowStatePath: path.join(resolvedProjectRoot, '.opencode', 'workflow-state.json'),
84
84
  legacyWorkItemsDir: path.join(resolvedProjectRoot, '.opencode', 'work-items'),
85
+ workspaceShimDir: path.join(resolvedProjectRoot, '.opencode', 'openkit'),
86
+ workspaceShimContextDir: path.join(resolvedProjectRoot, '.opencode', 'openkit', 'context'),
87
+ workspaceShimTemplatesDir: path.join(resolvedProjectRoot, '.opencode', 'openkit', 'docs', 'templates'),
88
+ workspaceShimAgentsPath: path.join(resolvedProjectRoot, '.opencode', 'openkit', 'AGENTS.md'),
89
+ workspaceShimWorkflowStatePath: path.join(resolvedProjectRoot, '.opencode', 'openkit', 'workflow-state.json'),
90
+ workspaceShimWorkflowCliPath: path.join(resolvedProjectRoot, '.opencode', 'openkit', 'workflow-state.js'),
85
91
  };
86
92
  }
@@ -0,0 +1,104 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+
4
+ function ensureParent(filePath) {
5
+ fs.mkdirSync(path.dirname(filePath), { recursive: true });
6
+ }
7
+
8
+ function writeFile(filePath, content, mode) {
9
+ ensureParent(filePath);
10
+ fs.writeFileSync(filePath, content, 'utf8');
11
+ if (typeof mode === 'number') {
12
+ fs.chmodSync(filePath, mode);
13
+ }
14
+ }
15
+
16
+ function relativeTarget(fromPath, toPath) {
17
+ return path.relative(path.dirname(fromPath), toPath) || '.';
18
+ }
19
+
20
+ function createSymlinkOrCopy({ linkPath, targetPath, type = 'file' }) {
21
+ ensureParent(linkPath);
22
+
23
+ try {
24
+ if (fs.existsSync(linkPath) || fs.lstatSync(linkPath)) {
25
+ fs.rmSync(linkPath, { recursive: true, force: true });
26
+ }
27
+ } catch {
28
+ // ignore cleanup misses
29
+ }
30
+
31
+ try {
32
+ fs.symlinkSync(relativeTarget(linkPath, targetPath), linkPath, type);
33
+ return 'symlink';
34
+ } catch {
35
+ const stats = fs.statSync(targetPath);
36
+ if (stats.isDirectory()) {
37
+ fs.cpSync(targetPath, linkPath, { recursive: true });
38
+ } else {
39
+ fs.copyFileSync(targetPath, linkPath);
40
+ }
41
+ return 'copy';
42
+ }
43
+ }
44
+
45
+ export function ensureWorkspaceShim(paths) {
46
+ fs.mkdirSync(paths.workspaceShimDir, { recursive: true });
47
+
48
+ createSymlinkOrCopy({
49
+ linkPath: paths.workspaceShimAgentsPath,
50
+ targetPath: path.join(paths.kitRoot, 'AGENTS.md'),
51
+ type: 'file',
52
+ });
53
+
54
+ createSymlinkOrCopy({
55
+ linkPath: paths.workspaceShimContextDir,
56
+ targetPath: path.join(paths.kitRoot, 'context'),
57
+ type: 'dir',
58
+ });
59
+
60
+ createSymlinkOrCopy({
61
+ linkPath: paths.workspaceShimTemplatesDir,
62
+ targetPath: path.join(paths.kitRoot, 'docs', 'templates'),
63
+ type: 'dir',
64
+ });
65
+
66
+ createSymlinkOrCopy({
67
+ linkPath: paths.workspaceShimWorkflowStatePath,
68
+ targetPath: paths.workflowStatePath,
69
+ type: 'file',
70
+ });
71
+
72
+ const workflowCli = `#!/usr/bin/env node
73
+ import { spawnSync } from 'node:child_process';
74
+
75
+ const args = process.argv.slice(2);
76
+ const result = spawnSync(process.execPath, [${JSON.stringify(path.join(paths.kitRoot, '.opencode', 'workflow-state.js'))}, '--state', ${JSON.stringify(paths.workflowStatePath)}, ...args], {
77
+ stdio: 'inherit',
78
+ env: process.env,
79
+ });
80
+
81
+ if (result.error) {
82
+ throw result.error;
83
+ }
84
+
85
+ process.exit(typeof result.status === 'number' ? result.status : 1);
86
+ `;
87
+
88
+ writeFile(paths.workspaceShimWorkflowCliPath, workflowCli, 0o755);
89
+
90
+ const gitDir = path.join(paths.projectRoot, '.git');
91
+ if (fs.existsSync(gitDir)) {
92
+ const excludePath = path.join(gitDir, 'info', 'exclude');
93
+ const entry = '.opencode/openkit/';
94
+ let current = '';
95
+ if (fs.existsSync(excludePath)) {
96
+ current = fs.readFileSync(excludePath, 'utf8');
97
+ }
98
+ if (!current.split(/\r?\n/).includes(entry)) {
99
+ writeFile(excludePath, `${current}${current.endsWith('\n') || current.length === 0 ? '' : '\n'}${entry}\n`);
100
+ }
101
+ }
102
+
103
+ return paths;
104
+ }
@@ -2,6 +2,7 @@ import fs from 'node:fs';
2
2
  import path from 'node:path';
3
3
 
4
4
  import { getWorkspacePaths } from './paths.js';
5
+ import { ensureWorkspaceShim } from './workspace-shim.js';
5
6
 
6
7
  const WORKSPACE_STATE_SCHEMA = 'openkit/workspace-state@1';
7
8
 
@@ -50,6 +51,8 @@ export function ensureWorkspaceBootstrap(options = {}) {
50
51
  });
51
52
  }
52
53
 
54
+ ensureWorkspaceShim(paths);
55
+
53
56
  return paths;
54
57
  }
55
58
 
@@ -222,6 +222,10 @@ process.stdout.write('mock opencode launched\\n');
222
222
  assert.equal(invocation.configDir, path.join(tempHome, 'kits', 'openkit'));
223
223
  assert.match(invocation.workflowState, /workspaces\/.*\/openkit\/\.opencode\/workflow-state\.json$/);
224
224
  assert.equal(invocation.kitRoot, path.join(tempHome, 'kits', 'openkit'));
225
+ assert.equal(fs.existsSync(path.join(projectRoot, '.opencode', 'openkit', 'AGENTS.md')), true);
226
+ assert.equal(fs.existsSync(path.join(projectRoot, '.opencode', 'openkit', 'context', 'core', 'workflow.md')), true);
227
+ assert.equal(fs.lstatSync(path.join(projectRoot, '.opencode', 'openkit', 'workflow-state.json')).isSymbolicLink() || fs.existsSync(path.join(projectRoot, '.opencode', 'openkit', 'workflow-state.json')), true);
228
+ assert.equal(fs.existsSync(path.join(projectRoot, '.opencode', 'openkit', 'workflow-state.js')), true);
225
229
  });
226
230
 
227
231
  test('openkit run does not reinstall when the global install already exists', () => {
@@ -294,6 +298,7 @@ process.stdout.write('mock opencode launched after auto-install\\n');
294
298
  const invocation = readJson(logPath);
295
299
  assert.deepEqual(invocation.argv, [projectRoot]);
296
300
  assert.equal(invocation.kitRoot, path.join(tempHome, 'kits', 'openkit'));
301
+ assert.equal(fs.existsSync(path.join(projectRoot, '.opencode', 'openkit', 'AGENTS.md')), true);
297
302
  });
298
303
 
299
304
  test('openkit run reports missing opencode after first-time setup completes', () => {