@lbdudc/linea-cli 0.0.0-stage → 0.1.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/package.json CHANGED
@@ -1,6 +1,54 @@
1
1
  {
2
2
  "name": "@lbdudc/linea-cli",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.1",
4
+ "type": "module",
5
+ "description": "LINEA from the terminal: manage software product lines and generate products. Needs the Bun runtime.",
6
+ "main": "src/index.tsx",
7
+ "bin": {
8
+ "linea": "dist/index.js"
9
+ },
10
+ "scripts": {
11
+ "start": "bun run src/index.tsx",
12
+ "dev": "bun run src/index.tsx",
13
+ "build": "bun run scripts/build.ts",
14
+ "typecheck": "tsc --noEmit",
15
+ "test": "bun test",
16
+ "prepublishOnly": "npm run build"
17
+ },
18
+ "engines": {
19
+ "bun": ">=1.1"
20
+ },
21
+ "dependencies": {
22
+ "@lbdudc/bango": "^0.2.0",
23
+ "@lbdudc/linea-core": "^0.1.2",
24
+ "@lbdudc/linea-git": "^0.1.1",
25
+ "@opentui/core": "^0.4.5",
26
+ "@opentui/solid": "^0.4.5",
27
+ "langium": "^4.4.0",
28
+ "open": "^10.1.0",
29
+ "solid-js": "1.9.12"
30
+ },
31
+ "devDependencies": {
32
+ "@types/bun": "^1.3.14",
33
+ "typescript": "^5.7.0"
34
+ },
35
+ "license": "Apache-2.0",
36
+ "author": "Laboratorio de Bases de Datos (LBD) - Universidade da Coruña",
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "git+https://github.com/lbdudc/linea.git",
40
+ "directory": "packages/cli"
41
+ },
42
+ "homepage": "https://github.com/lbdudc/linea/tree/main/packages/cli",
43
+ "bugs": {
44
+ "url": "https://github.com/lbdudc/linea/issues"
45
+ },
46
+ "publishConfig": {
47
+ "access": "public",
48
+ "provenance": true
49
+ },
50
+ "files": [
51
+ "dist",
52
+ "README.md"
53
+ ]
54
+ }
package/src/index.tsx ADDED
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env bun
2
+ import pkg from '../package.json';
3
+
4
+ const args = process.argv.slice(2);
5
+
6
+ const HELP = [
7
+ `linea ${pkg.version} — the SPLALM command line`,
8
+ '',
9
+ 'Usage:',
10
+ ' linea the interactive window',
11
+ ' linea <command> [args] run one command and exit (scripts, CI)',
12
+ '',
13
+ 'A command is `<noun> <verb>`, or a verb on its own:',
14
+ ' linea get my-spl bring an SPL and its products from LINEA (again: update them)',
15
+ ' linea open open what you are in with your editor',
16
+ ' linea check check the SPL / product / package of this folder',
17
+ ' linea push send your changes back as a merge/pull request',
18
+ ' linea spl list | product list | module list | fm show …',
19
+ ' linea help every command',
20
+ '',
21
+ 'Flags for any command: --json (data for a program) --local (do not talk to the server)',
22
+ 'Exit code: 0 ok · 1 failed, or a check found problems · 2 used wrong',
23
+ '',
24
+ 'Env:',
25
+ ' LINEA_BASE_URL backend URL (default http://localhost:3000)',
26
+ ' LINEA_TOKEN dev-only JWT override (skips login)',
27
+ ' LINEA_OAUTH_PORT loopback port login listens on (default 53682)',
28
+ '',
29
+ ].join('\n');
30
+
31
+ if (args.length === 1 && (args[0] === '--version' || args[0] === '-v')) {
32
+ process.stdout.write(`linea ${pkg.version}\n`);
33
+ process.exit(0);
34
+ }
35
+
36
+ if (args.length === 1 && (args[0] === '--help' || args[0] === '-h')) {
37
+ process.stdout.write(HELP);
38
+ process.exit(0);
39
+ }
40
+
41
+ if (args[0] === 'credential') {
42
+ // git asks for the token of the host (see core/credentialHelper.ts): no window, no sign-in, nothing else on stdout
43
+ const { credentialHelper, traceHelper } = await import('./core/credentialHelper.js');
44
+ const request = await Bun.stdin.text();
45
+ const answer = credentialHelper(args[1], request);
46
+ traceHelper(args[1], request, answer); // with LINEA_DEBUG=1: a line in ~/.linea/credential.log, to tell whether git asked at all
47
+ process.stdout.write(answer);
48
+ process.exit(0);
49
+ }
50
+
51
+ if (args.length > 0) {
52
+ // one command, no window
53
+ const { runShell } = await import('./shell.js');
54
+ process.exit(await runShell(args));
55
+ }
56
+
57
+ const { runInteractive } = await import('./interactive.js');
58
+ await runInteractive();