clawck 0.4.3 → 0.5.4

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 (79) hide show
  1. package/README.md +86 -11
  2. package/dist/cli/index.js +29 -44
  3. package/dist/cli/index.js.map +1 -1
  4. package/dist/core/atp.d.ts +1 -1
  5. package/dist/core/atp.d.ts.map +1 -1
  6. package/dist/core/atp.js +1 -1
  7. package/dist/core/atp.js.map +1 -1
  8. package/dist/core/clawck.d.ts.map +1 -1
  9. package/dist/core/clawck.js +40 -1
  10. package/dist/core/clawck.js.map +1 -1
  11. package/dist/core/config.d.ts +10 -0
  12. package/dist/core/config.d.ts.map +1 -0
  13. package/dist/core/config.js +58 -0
  14. package/dist/core/config.js.map +1 -0
  15. package/dist/core/database.d.ts +13 -0
  16. package/dist/core/database.d.ts.map +1 -1
  17. package/dist/core/database.js +150 -65
  18. package/dist/core/database.js.map +1 -1
  19. package/dist/core/errors.d.ts +19 -0
  20. package/dist/core/errors.d.ts.map +1 -0
  21. package/dist/core/errors.js +40 -0
  22. package/dist/core/errors.js.map +1 -0
  23. package/dist/core/logger.d.ts +14 -0
  24. package/dist/core/logger.d.ts.map +1 -0
  25. package/dist/core/logger.js +39 -0
  26. package/dist/core/logger.js.map +1 -0
  27. package/dist/core/pricing.d.ts +28 -0
  28. package/dist/core/pricing.d.ts.map +1 -0
  29. package/dist/core/pricing.js +48 -0
  30. package/dist/core/pricing.js.map +1 -0
  31. package/dist/core/runtime.d.ts +10 -0
  32. package/dist/core/runtime.d.ts.map +1 -1
  33. package/dist/core/runtime.js +34 -0
  34. package/dist/core/runtime.js.map +1 -1
  35. package/dist/core/sync.d.ts.map +1 -1
  36. package/dist/core/sync.js +3 -0
  37. package/dist/core/sync.js.map +1 -1
  38. package/dist/core/types.d.ts +14 -3
  39. package/dist/core/types.d.ts.map +1 -1
  40. package/dist/core/types.js +1 -1
  41. package/dist/core/types.js.map +1 -1
  42. package/dist/core/webhooks.d.ts.map +1 -1
  43. package/dist/core/webhooks.js +5 -2
  44. package/dist/core/webhooks.js.map +1 -1
  45. package/dist/dashboard/index.js +3 -3
  46. package/dist/hooks/adapters.d.ts.map +1 -1
  47. package/dist/hooks/adapters.js +27 -8
  48. package/dist/hooks/adapters.js.map +1 -1
  49. package/dist/hooks/handler.d.ts.map +1 -1
  50. package/dist/hooks/handler.js +17 -5
  51. package/dist/hooks/handler.js.map +1 -1
  52. package/dist/hooks/types.d.ts +1 -0
  53. package/dist/hooks/types.d.ts.map +1 -1
  54. package/dist/index.d.ts +5 -0
  55. package/dist/index.d.ts.map +1 -1
  56. package/dist/index.js +12 -1
  57. package/dist/index.js.map +1 -1
  58. package/dist/reports/html.d.ts +2 -2
  59. package/dist/reports/html.d.ts.map +1 -1
  60. package/dist/reports/html.js +238 -84
  61. package/dist/reports/html.js.map +1 -1
  62. package/dist/reports/pdf.d.ts.map +1 -1
  63. package/dist/reports/pdf.js +5 -4
  64. package/dist/reports/pdf.js.map +1 -1
  65. package/dist/server/api.d.ts.map +1 -1
  66. package/dist/server/api.js +57 -18
  67. package/dist/server/api.js.map +1 -1
  68. package/dist/server/mcp.d.ts.map +1 -1
  69. package/dist/server/mcp.js +3 -3
  70. package/dist/server/mcp.js.map +1 -1
  71. package/docs/api-reference.md +380 -0
  72. package/docs/deployment.md +140 -0
  73. package/docs/deprecation-policy.md +32 -0
  74. package/docs/migration-guide.md +78 -0
  75. package/docs/security.md +70 -0
  76. package/docs/skills/clawck-setup.md +19 -0
  77. package/docs/skills/clawck-usage.md +6 -0
  78. package/docs/versioning.md +49 -0
  79. package/package.json +7 -4
@@ -114,6 +114,25 @@ def clawck_stop(entry_id, status="completed", summary=""):
114
114
 
115
115
  Use HTTP Request nodes to call the REST API at `http://localhost:3456/api/start` and `/api/stop` at the beginning and end of each agent turn.
116
116
 
117
+ ## Verifying Hook Data Flow
118
+
119
+ If tokens or cost show as 0 in your entries, verify that the platform is sending the data:
120
+
121
+ ```bash
122
+ # See what data the hook receives (debug mode)
123
+ LOG_LEVEL=debug clawck hook stop
124
+
125
+ # Test with sample JSON
126
+ echo '{"session_id":"test","total_input_tokens":5000,"total_output_tokens":2000,"total_cost_usd":0.50}' | LOG_LEVEL=debug clawck hook stop
127
+ ```
128
+
129
+ The debug output shows `Stop context: tokens_in=... tokens_out=... cost_usd=... tool_calls=...` so you can confirm the adapter extracted values correctly.
130
+
131
+ Each platform adapter recognizes multiple field names:
132
+ - **Claude**: `tokens_in`/`total_input_tokens`, `tokens_out`/`total_output_tokens`, `cost_usd`/`total_cost_usd`, `tool_calls`/`num_tool_calls`
133
+ - **Gemini/Cursor/Windsurf/Codex**: `tokens_in`/`input_tokens`, `tokens_out`/`output_tokens`, `cost_usd`/`total_cost_usd`
134
+ - **Cline**: `tokens_in`/`input_tokens`/`tokensIn`, `tokens_out`/`output_tokens`/`tokensOut`, `cost_usd`/`totalCost`
135
+
117
136
  ## Quick Start CLI
118
137
 
119
138
  ```bash
@@ -91,6 +91,12 @@ Report if your platform provides this data:
91
91
  - `tokens_out`: Output tokens generated this turn
92
92
  - `cost_usd`: Estimated cost in USD
93
93
 
94
+ **Platform hooks** auto-extract tokens and cost from the stdin JSON that each platform sends on stop events. The adapter layer normalizes field names across platforms (e.g., `total_input_tokens`, `input_tokens`, `tokens_in` are all recognized).
95
+
96
+ **MCP tool users** should pass `tokens_in`, `tokens_out`, and `cost_usd` explicitly when calling `clawck_stop_task`.
97
+
98
+ **Verification**: Run `LOG_LEVEL=debug clawck hook stop` to see the extracted token/cost values in the debug output. You can also pipe test JSON: `echo '{"session_id":"test","total_input_tokens":5000}' | LOG_LEVEL=debug clawck hook stop`
99
+
94
100
  ## Edge Cases
95
101
 
96
102
  ### Errors / Failures
@@ -0,0 +1,49 @@
1
+ # Versioning Policy
2
+
3
+ Clawck tracks three independent version numbers. Each serves a different purpose and follows its own release cadence.
4
+
5
+ ## App Version
6
+
7
+ - **Constant:** `APP_VERSION` in `src/core/types.ts`, mirrored in `package.json` `"version"`
8
+ - **Format:** Semantic versioning (`MAJOR.MINOR.PATCH`)
9
+ - **Current:** `0.4.3`
10
+ - **What it tracks:** The overall Clawck release — CLI, server, SDK, dashboard, reports
11
+ - **When bumped:**
12
+ - MAJOR: Breaking API or config changes (not yet — still 0.x)
13
+ - MINOR: New features (e.g., patterns, approval workflow, HTML reports)
14
+ - PATCH: Bug fixes and small improvements
15
+ - **Compatibility:** While in 0.x, minor versions may contain breaking changes. Upgrade notes are in `CHANGELOG.md`.
16
+
17
+ ## Spec Version
18
+
19
+ - **Constant:** `SPEC_VERSION` in `src/core/types.ts`
20
+ - **Format:** Semantic versioning (`MAJOR.MINOR.PATCH`)
21
+ - **Current:** `0.2.0`
22
+ - **What it tracks:** The ATP (Agent Time Protocol) wire format — the JSON envelope used for import/export and multi-agent sync
23
+ - **When bumped:** When the ATP schema changes (new required fields, structural changes)
24
+ - **Compatibility:** ATP envelopes include a `spec_version` field. Import accepts older spec versions. See `docs/atp-spec-v0.2.md` for the current spec.
25
+
26
+ ## Schema Version
27
+
28
+ - **Constant:** `ClawckDB.SCHEMA_VERSION` in `src/core/database.ts`
29
+ - **Format:** Integer, incrementing from 1
30
+ - **Current:** `5`
31
+ - **What it tracks:** The SQLite database schema — tables, columns, indexes
32
+ - **When bumped:** Each time a migration is added to the `MIGRATIONS` array in `database.ts`
33
+ - **Compatibility:** Migrations are **forward-only** and **auto-applied** — Clawck detects the current schema version on startup and runs any pending migrations in a transaction. There is no downgrade path. See `docs/migration-guide.md` for details.
34
+
35
+ ## Version Independence
36
+
37
+ These three versions are independent. A single release may bump the app version without changing the spec or schema version. For example:
38
+
39
+ | Release | App Version | Spec Version | Schema Version |
40
+ |---------|-------------|--------------|----------------|
41
+ | v0.1.0 | 0.1.0 | 0.1.0 | 1 |
42
+ | v0.3.0 | 0.3.0 | 0.2.0 | 5 |
43
+ | v0.4.1 | 0.4.1 | 0.2.0 | 5 |
44
+ | v0.4.3 | 0.4.3 | 0.2.0 | 5 |
45
+
46
+ ## Known Limitations
47
+
48
+ - **No API versioning prefix** — REST endpoints are served at `/api/*` with no version prefix (e.g., no `/api/v1/`). Breaking API changes will be communicated via changelog and app version bumps.
49
+ - **No schema downgrade** — If you need to roll back Clawck to an older version, restore the database from a backup taken before the upgrade.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "clawck",
3
- "version": "0.4.3",
4
- "description": "⏱️🦀 Time tracking for AI agents. Toggl for the agentic era.",
3
+ "version": "0.5.4",
4
+ "description": "⏱️🦀 System of record for AI agent work.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "bin": {
@@ -10,7 +10,7 @@
10
10
  "scripts": {
11
11
  "build": "tsc",
12
12
  "dev": "tsx watch src/cli/index.ts",
13
- "start": "node dist/cli/index.ts",
13
+ "start": "node dist/cli/index.js",
14
14
  "serve": "tsx src/cli/index.ts serve",
15
15
  "test": "vitest run",
16
16
  "lint": "eslint src/",
@@ -39,12 +39,13 @@
39
39
  "dependencies": {
40
40
  "better-sqlite3": "^12.6.2",
41
41
  "commander": "^12.0.0",
42
- "pdfkit": "^0.15.0",
43
42
  "cors": "^2.8.5",
44
43
  "express": "^4.21.0",
44
+ "pdfkit": "^0.15.0",
45
45
  "uuid": "^10.0.0"
46
46
  },
47
47
  "devDependencies": {
48
+ "@eslint/js": "^10.0.1",
48
49
  "@types/better-sqlite3": "^7.6.13",
49
50
  "@types/cors": "^2.8.0",
50
51
  "@types/express": "^4.17.0",
@@ -52,9 +53,11 @@
52
53
  "@types/pdfkit": "^0.13.0",
53
54
  "@types/supertest": "^7.2.0",
54
55
  "@types/uuid": "^10.0.0",
56
+ "eslint": "^10.0.3",
55
57
  "supertest": "^7.2.2",
56
58
  "tsx": "^4.0.0",
57
59
  "typescript": "^5.6.0",
60
+ "typescript-eslint": "^8.56.1",
58
61
  "vitest": "^2.0.0"
59
62
  },
60
63
  "engines": {