@techdivision/opencode-time-tracking 0.1.8 → 0.1.9

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.
package/README.md CHANGED
@@ -14,13 +14,16 @@ Add to your `opencode.json`:
14
14
 
15
15
  ## Configuration
16
16
 
17
- Create `.opencode/time-tracking.json` in your project:
17
+ Add the `time_tracking` section to your `.opencode/opencode-project.json`:
18
18
 
19
19
  ```json
20
20
  {
21
- "csv_file": "~/time_tracking/time-tracking.csv",
22
- "user_email": "your@email.com",
23
- "default_account_key": "YOUR_ACCOUNT_KEY"
21
+ "$schema": "https://raw.githubusercontent.com/techdivision/opencode-plugins/main/schemas/opencode-project.json",
22
+ "time_tracking": {
23
+ "csv_file": "~/time_tracking/time-tracking.csv",
24
+ "user_email": "your@email.com",
25
+ "default_account_key": "YOUR_ACCOUNT_KEY"
26
+ }
24
27
  }
25
28
  ```
26
29
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@techdivision/opencode-time-tracking",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "Automatic time tracking plugin for OpenCode - tracks session duration and tool usage to CSV",
5
5
  "main": "src/Plugin.ts",
6
6
  "types": "src/Plugin.ts",
@@ -2,7 +2,10 @@
2
2
  * @fileoverview Configuration loader for the time tracking plugin.
3
3
  */
4
4
 
5
- import type { TimeTrackingConfig } from "../types/TimeTrackingConfig"
5
+ import type {
6
+ OpencodeProjectConfig,
7
+ TimeTrackingConfig,
8
+ } from "../types/TimeTrackingConfig"
6
9
 
7
10
  import "../types/Bun"
8
11
 
@@ -10,8 +13,8 @@ import "../types/Bun"
10
13
  * Loads the plugin configuration from the project directory.
11
14
  *
12
15
  * @remarks
13
- * The configuration file is expected at `.opencode/time-tracking.json`
14
- * within the project directory.
16
+ * The configuration file is expected at `.opencode/opencode-project.json`
17
+ * within the project directory, with a `time_tracking` section.
15
18
  */
16
19
  export class ConfigLoader {
17
20
  /**
@@ -29,13 +32,17 @@ export class ConfigLoader {
29
32
  * ```
30
33
  */
31
34
  static async load(directory: string): Promise<TimeTrackingConfig | null> {
32
- const configPath = `${directory}/.opencode/time-tracking.json`
35
+ const configPath = `${directory}/.opencode/opencode-project.json`
33
36
 
34
37
  try {
35
38
  const file = Bun.file(configPath)
36
39
 
37
40
  if (await file.exists()) {
38
- return (await file.json()) as TimeTrackingConfig
41
+ const projectConfig = (await file.json()) as OpencodeProjectConfig
42
+
43
+ if (projectConfig.time_tracking) {
44
+ return projectConfig.time_tracking
45
+ }
39
46
  }
40
47
 
41
48
  return null
@@ -3,7 +3,7 @@
3
3
  */
4
4
 
5
5
  /**
6
- * Plugin configuration loaded from `.opencode/time-tracking.json`.
6
+ * Time tracking configuration from `.opencode/opencode-project.json`.
7
7
  */
8
8
  export interface TimeTrackingConfig {
9
9
  /**
@@ -23,3 +23,14 @@ export interface TimeTrackingConfig {
23
23
  /** Default Jira account key for time entries */
24
24
  default_account_key: string
25
25
  }
26
+
27
+ /**
28
+ * OpenCode project configuration structure.
29
+ */
30
+ export interface OpencodeProjectConfig {
31
+ /** JSON Schema reference */
32
+ $schema?: string
33
+
34
+ /** Time tracking configuration */
35
+ time_tracking?: TimeTrackingConfig
36
+ }