@timefly/opencode-plugin 0.2.0 → 0.2.1
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 +2 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +65 -0
- package/dist/install.d.ts +1 -1
- package/dist/install.d.ts.map +1 -1
- package/dist/install.js +2 -7
- package/dist/login.d.ts +2 -1
- package/dist/login.d.ts.map +1 -1
- package/dist/login.js +1 -5
- package/package.json +4 -9
package/README.md
CHANGED
|
@@ -14,6 +14,8 @@ bunx @timefly/opencode-plugin login
|
|
|
14
14
|
# 3. Restart OpenCode
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
+
> **Note:** `login` and `setup-opencode` are subcommands. If `login` runs the installer again, update to v0.2.1+ or use `bunx timefly-opencode-login`.
|
|
18
|
+
|
|
17
19
|
You need a **TimeFly Supporter** plan for sync. Free accounts can install the plugin but `POST /ai/sync` returns 403.
|
|
18
20
|
|
|
19
21
|
## Installation (step by step)
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import { runInstall } from './install.js';
|
|
3
|
+
import { runLogin } from './login.js';
|
|
4
|
+
const printHelp = () => {
|
|
5
|
+
console.log(`TimeFly OpenCode plugin
|
|
6
|
+
|
|
7
|
+
Usage:
|
|
8
|
+
bunx @timefly/opencode-plugin <command> [options]
|
|
9
|
+
|
|
10
|
+
Commands:
|
|
11
|
+
setup-opencode Add plugin to opencode.json
|
|
12
|
+
login Sign in with TimeFly (Google OAuth)
|
|
13
|
+
|
|
14
|
+
Setup options:
|
|
15
|
+
--target user|project Config scope (default: user)
|
|
16
|
+
--project /path Required when --target project
|
|
17
|
+
--local Use local build path instead of npm package
|
|
18
|
+
|
|
19
|
+
Examples:
|
|
20
|
+
bunx @timefly/opencode-plugin setup-opencode -- --target user
|
|
21
|
+
bunx @timefly/opencode-plugin login
|
|
22
|
+
`);
|
|
23
|
+
};
|
|
24
|
+
const readCommand = (argumentsList) => {
|
|
25
|
+
const firstArgument = argumentsList[0];
|
|
26
|
+
if (!firstArgument || firstArgument.startsWith('-')) {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
return firstArgument;
|
|
30
|
+
};
|
|
31
|
+
const readCommandArguments = (argumentsList) => {
|
|
32
|
+
const separatorIndex = argumentsList.indexOf('--');
|
|
33
|
+
if (separatorIndex >= 0) {
|
|
34
|
+
return argumentsList.slice(separatorIndex + 1);
|
|
35
|
+
}
|
|
36
|
+
const command = readCommand(argumentsList);
|
|
37
|
+
if (!command) {
|
|
38
|
+
return argumentsList;
|
|
39
|
+
}
|
|
40
|
+
return argumentsList.slice(1);
|
|
41
|
+
};
|
|
42
|
+
const run = () => {
|
|
43
|
+
const argumentsList = process.argv.slice(2);
|
|
44
|
+
const command = readCommand(argumentsList);
|
|
45
|
+
const commandArguments = readCommandArguments(argumentsList);
|
|
46
|
+
if (command === 'setup-opencode' || command === 'install') {
|
|
47
|
+
return runInstall(commandArguments);
|
|
48
|
+
}
|
|
49
|
+
if (command === 'login') {
|
|
50
|
+
return runLogin();
|
|
51
|
+
}
|
|
52
|
+
if (!command) {
|
|
53
|
+
printHelp();
|
|
54
|
+
return Promise.resolve();
|
|
55
|
+
}
|
|
56
|
+
console.error(`Unknown command: ${command}`);
|
|
57
|
+
printHelp();
|
|
58
|
+
process.exitCode = 1;
|
|
59
|
+
return Promise.resolve();
|
|
60
|
+
};
|
|
61
|
+
run().catch((error) => {
|
|
62
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
63
|
+
console.error(`[timefly-opencode] ${message}`);
|
|
64
|
+
process.exit(1);
|
|
65
|
+
});
|
package/dist/install.d.ts
CHANGED
package/dist/install.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":";AA8HA,eAAO,MAAM,UAAU,GAAI,eAAe,MAAM,EAAE,KAAG,OAAO,CAAC,IAAI,CAGhE,CAAA"}
|
package/dist/install.js
CHANGED
|
@@ -87,12 +87,7 @@ const installPlugin = (options) => {
|
|
|
87
87
|
printPostInstallInstructions(configPath);
|
|
88
88
|
});
|
|
89
89
|
};
|
|
90
|
-
const
|
|
91
|
-
const options = parseArguments(
|
|
90
|
+
export const runInstall = (argumentsList) => {
|
|
91
|
+
const options = parseArguments(argumentsList);
|
|
92
92
|
return installPlugin(options);
|
|
93
93
|
};
|
|
94
|
-
run().catch((error) => {
|
|
95
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
96
|
-
console.error(`[timefly-opencode-install] ${message}`);
|
|
97
|
-
process.exit(1);
|
|
98
|
-
});
|
package/dist/login.d.ts
CHANGED
package/dist/login.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../src/login.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../src/login.ts"],"names":[],"mappings":";AA8IA,QAAA,MAAM,QAAQ,QAAO,OAAO,CAAC,IAAI,CAkDhC,CAAA;AAED,OAAO,EAAE,QAAQ,EAAE,CAAA"}
|
package/dist/login.js
CHANGED
|
@@ -150,8 +150,4 @@ const runLogin = () => {
|
|
|
150
150
|
console.log('Restart OpenCode to start syncing telemetry.');
|
|
151
151
|
});
|
|
152
152
|
};
|
|
153
|
-
runLogin
|
|
154
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
155
|
-
console.error(`[timefly-opencode-login] ${message}`);
|
|
156
|
-
process.exit(1);
|
|
157
|
-
});
|
|
153
|
+
export { runLogin };
|
package/package.json
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@timefly/opencode-plugin",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "TimeFly telemetry plugin for OpenCode — sessions, tokens, models, and tools",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"bin":
|
|
7
|
-
"timefly-opencode-install": "./dist/install.js",
|
|
8
|
-
"timefly-opencode-login": "./dist/login.js",
|
|
9
|
-
"setup-opencode": "./dist/install.js",
|
|
10
|
-
"login": "./dist/login.js"
|
|
11
|
-
},
|
|
6
|
+
"bin": "./dist/cli.js",
|
|
12
7
|
"main": "./dist/index.js",
|
|
13
8
|
"types": "./dist/index.d.ts",
|
|
14
9
|
"exports": {
|
|
@@ -27,8 +22,8 @@
|
|
|
27
22
|
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p test/tsconfig.json --noEmit",
|
|
28
23
|
"test": "bun test",
|
|
29
24
|
"prepublishOnly": "bun run build && bun run typecheck && bun test",
|
|
30
|
-
"setup-opencode": "bun run dist/
|
|
31
|
-
"login": "bun run dist/
|
|
25
|
+
"setup-opencode": "bun run dist/cli.js setup-opencode",
|
|
26
|
+
"login": "bun run dist/cli.js login",
|
|
32
27
|
"link": "bun link"
|
|
33
28
|
},
|
|
34
29
|
"repository": {
|