@everydaydevops/opencode-typescript-linting 1.0.1 → 1.0.2

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/install.js +20 -6
  2. package/package.json +1 -1
package/install.js CHANGED
@@ -7,21 +7,35 @@ const os = require('os');
7
7
  const agentName = 'typescript-linting.md';
8
8
  const sourceFile = path.join(__dirname, 'agent', agentName);
9
9
 
10
- // Determine the target directory
11
- const globalConfigDir = path.join(os.homedir(), '.config', 'opencode', 'agent');
10
+ // Determine if this is a global installation
11
+ // npm sets npm_config_global=true when installing globally
12
+ const isGlobalInstall = process.env.npm_config_global === 'true';
13
+
14
+ // Determine the target directory based on installation type
15
+ let targetDir;
16
+ if (isGlobalInstall) {
17
+ // Global install: use ~/.config/opencode/agent
18
+ targetDir = path.join(os.homedir(), '.config', 'opencode', 'agent');
19
+ } else {
20
+ // Local install: use .opencode/ in the project directory
21
+ // npm_config_local_prefix points to the project root during npm install
22
+ const projectRoot = process.env.npm_config_local_prefix || process.cwd();
23
+ targetDir = path.join(projectRoot, '.opencode');
24
+ }
12
25
 
13
26
  // Create the directory if it doesn't exist
14
- if (!fs.existsSync(globalConfigDir)) {
15
- fs.mkdirSync(globalConfigDir, { recursive: true });
27
+ if (!fs.existsSync(targetDir)) {
28
+ fs.mkdirSync(targetDir, { recursive: true });
16
29
  }
17
30
 
18
- const targetFile = path.join(globalConfigDir, agentName);
31
+ const targetFile = path.join(targetDir, agentName);
19
32
 
20
33
  // Copy the agent file
21
34
  try {
22
35
  fs.copyFileSync(sourceFile, targetFile);
23
- console.log('TypeScript Linting agent installed successfully!');
36
+ console.log('TypeScript Linting agent installed successfully!');
24
37
  console.log(` Installed to: ${targetFile}`);
38
+ console.log(` Installation type: ${isGlobalInstall ? 'global' : 'local'}`);
25
39
  console.log('\nUsage:');
26
40
  console.log(' Run "opencode" in any TypeScript project');
27
41
  console.log(' The typescript-linting subagent will be available');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everydaydevops/opencode-typescript-linting",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "OpenCode agent for implementing TypeScript linting and code formatting following Everyday DevOps best practices",
5
5
  "keywords": [
6
6
  "opencode",