@1medium/cli 1.2.0 → 1.3.0

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/package.json +1 -1
  2. package/src/api.js +18 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1medium/cli",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "CLI and MCP server for 1Medium AI task management",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/src/api.js CHANGED
@@ -23,12 +23,30 @@ function getToken() {
23
23
  return token;
24
24
  }
25
25
 
26
+ /**
27
+ * Get configured org ID (if any)
28
+ */
29
+ function getOrgId() {
30
+ return config.get("orgId") || null;
31
+ }
32
+
26
33
  /**
27
34
  * Make an authenticated API request
35
+ * Automatically includes org_id if configured
28
36
  */
29
37
  async function request(method, path, body = null, params = null) {
30
38
  const baseUrl = getApiUrl();
31
39
  const token = getToken();
40
+ const orgId = getOrgId();
41
+
42
+ // Add org_id to params for GET requests, or to body for POST/PATCH
43
+ if (orgId) {
44
+ if (method === "GET" || method === "DELETE") {
45
+ params = { ...params, org_id: orgId };
46
+ } else if (method === "POST" || method === "PATCH" || method === "PUT") {
47
+ body = { ...(body || {}), org_id: orgId };
48
+ }
49
+ }
32
50
 
33
51
  let url = `${baseUrl}/v1/agent${path}`;
34
52
  if (params) {