@redaksjon/protokoll-cli 0.1.1-dev.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.
@@ -0,0 +1,84 @@
1
+ import { defineConfig, globalIgnores } from "eslint/config";
2
+ import typescriptEslint from "@typescript-eslint/eslint-plugin";
3
+ import importPlugin from "eslint-plugin-import";
4
+ import globals from "globals";
5
+ import tsParser from "@typescript-eslint/parser";
6
+ import path from "node:path";
7
+ import { fileURLToPath } from "node:url";
8
+ import js from "@eslint/js";
9
+ import { FlatCompat } from "@eslint/eslintrc";
10
+
11
+ const __filename = fileURLToPath(import.meta.url);
12
+ const __dirname = path.dirname(__filename);
13
+ const compat = new FlatCompat({
14
+ baseDirectory: __dirname,
15
+ recommendedConfig: js.configs.recommended,
16
+ allConfig: js.configs.all
17
+ });
18
+
19
+ export default defineConfig([
20
+ globalIgnores([
21
+ "dist/**",
22
+ "node_modules/**",
23
+ "coverage/**",
24
+ "**/*.test.ts",
25
+ ]),
26
+ {
27
+ files: ["src/main.ts"],
28
+ rules: {
29
+ "no-console": "off",
30
+ },
31
+ },
32
+ {
33
+ extends: compat.extends("eslint:recommended", "plugin:@typescript-eslint/recommended"),
34
+
35
+ plugins: {
36
+ "@typescript-eslint": typescriptEslint,
37
+ "import": importPlugin,
38
+ },
39
+
40
+ languageOptions: {
41
+ globals: {
42
+ ...globals.node,
43
+ },
44
+
45
+ parser: tsParser,
46
+ ecmaVersion: "latest",
47
+ sourceType: "module",
48
+ },
49
+
50
+ rules: {
51
+ "@typescript-eslint/no-explicit-any": "off",
52
+ "@typescript-eslint/explicit-function-return-type": "off",
53
+
54
+ "@typescript-eslint/no-unused-vars": ["warn", {
55
+ argsIgnorePattern: "^_",
56
+ }],
57
+
58
+ indent: ["error", 4, {
59
+ SwitchCase: 1,
60
+ }],
61
+
62
+ "import/extensions": ["error", "always", {
63
+ "ignorePackages": true
64
+ }],
65
+
66
+ "import/no-extraneous-dependencies": ["error", {
67
+ devDependencies: true,
68
+ optionalDependencies: false,
69
+ peerDependencies: false,
70
+ }],
71
+
72
+ "no-console": ["error"],
73
+
74
+ "no-restricted-imports": ["error", {
75
+ paths: ["dayjs", "fs", "node:fs", "moment-timezone"],
76
+ patterns: [
77
+ {
78
+ group: ["src/**"],
79
+ message: "Use absolute imports instead of relative imports"
80
+ }
81
+ ]
82
+ }]
83
+ },
84
+ }]);
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@redaksjon/protokoll-cli",
3
+ "version": "0.1.1-dev.0",
4
+ "description": "Command-line interface for Protokoll - thin MCP client",
5
+ "main": "dist/main.js",
6
+ "type": "module",
7
+ "bin": {
8
+ "protokoll": "./dist/main.js"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/redaksjon/protokoll-cli.git"
13
+ },
14
+ "homepage": "https://github.com/redaksjon/protokoll-cli",
15
+ "scripts": {
16
+ "build": "npm run lint && tsc --noEmit && vite build && chmod +x dist/main.js",
17
+ "dev": "vite",
18
+ "watch": "vite build --watch",
19
+ "test": "vitest run --coverage",
20
+ "test:coverage": "vitest run --coverage",
21
+ "lint": "eslint . --ext .ts",
22
+ "lint:fix": "eslint . --ext .ts --fix",
23
+ "clean": "rm -rf dist",
24
+ "precommit": "npm run lint && npm run build && npm run test",
25
+ "prepublishOnly": "npm run clean && npm run build"
26
+ },
27
+ "keywords": [
28
+ "protokoll",
29
+ "cli",
30
+ "transcription",
31
+ "mcp"
32
+ ],
33
+ "author": "Tim O'Brien <tobrien@discursive.com>",
34
+ "license": "Apache-2.0",
35
+ "engines": {
36
+ "node": ">=24.0.0"
37
+ },
38
+ "dependencies": {
39
+ "@modelcontextprotocol/sdk": "1.25.3",
40
+ "@redaksjon/protokoll": "file:../protokoll",
41
+ "commander": "^14.0.2",
42
+ "cli-progress": "^3.12.0"
43
+ },
44
+ "devDependencies": {
45
+ "@eslint/eslintrc": "^3.3.1",
46
+ "@eslint/js": "^9.39.1",
47
+ "@rollup/plugin-replace": "^6.0.3",
48
+ "@types/cli-progress": "^3.11.6",
49
+ "@types/node": "^25.0.9",
50
+ "@typescript-eslint/eslint-plugin": "^8.46.4",
51
+ "@typescript-eslint/parser": "^8.46.4",
52
+ "@vitest/coverage-v8": "^4.0.8",
53
+ "eslint": "^9.39.1",
54
+ "eslint-plugin-import": "^2.32.0",
55
+ "globals": "^17.0.0",
56
+ "rollup-plugin-preserve-shebang": "^1.0.1",
57
+ "typescript": "^5.9.3",
58
+ "vite": "^7.2.2",
59
+ "vitest": "^4.0.8"
60
+ }
61
+ }
package/vite.config.ts ADDED
@@ -0,0 +1,83 @@
1
+ import { defineConfig } from 'vite';
2
+ import replace from '@rollup/plugin-replace';
3
+ import { execSync } from 'node:child_process';
4
+ import shebang from 'rollup-plugin-preserve-shebang';
5
+ import path from 'node:path';
6
+
7
+ let gitInfo = {
8
+ branch: '',
9
+ commit: '',
10
+ tags: '',
11
+ commitDate: '',
12
+ };
13
+
14
+ try {
15
+ gitInfo = {
16
+ branch: execSync('git rev-parse --abbrev-ref HEAD').toString().trim(),
17
+ commit: execSync('git rev-parse --short HEAD').toString().trim(),
18
+ tags: '',
19
+ commitDate: execSync('git log -1 --format=%cd --date=iso').toString().trim(),
20
+ };
21
+
22
+ try {
23
+ gitInfo.tags = execSync('git tag --points-at HEAD | paste -sd "," -').toString().trim();
24
+ } catch {
25
+ gitInfo.tags = '';
26
+ }
27
+ } catch {
28
+ // eslint-disable-next-line no-console
29
+ console.log('Directory does not have a Git repository, skipping git info');
30
+ }
31
+
32
+
33
+ export default defineConfig({
34
+ plugins: [
35
+ replace({
36
+ '__VERSION__': process.env.npm_package_version,
37
+ '__GIT_BRANCH__': gitInfo.branch,
38
+ '__GIT_COMMIT__': gitInfo.commit,
39
+ '__GIT_TAGS__': gitInfo.tags === '' ? '' : `T:${gitInfo.tags}`,
40
+ '__GIT_COMMIT_DATE__': gitInfo.commitDate,
41
+ '__SYSTEM_INFO__': `${process.platform} ${process.arch} ${process.version}`,
42
+ preventAssignment: true,
43
+ }),
44
+ shebang({
45
+ shebang: '#!/usr/bin/env node',
46
+ }),
47
+ ],
48
+ build: {
49
+ target: 'esnext',
50
+ outDir: 'dist',
51
+ ssr: true,
52
+ rollupOptions: {
53
+ external: [
54
+ // Dependencies from package.json
55
+ '@modelcontextprotocol/sdk',
56
+ '@modelcontextprotocol/sdk/client/index.js',
57
+ '@modelcontextprotocol/sdk/client/stdio.js',
58
+ '@modelcontextprotocol/sdk/types.js',
59
+ '@redaksjon/protokoll',
60
+ 'commander',
61
+ 'cli-progress',
62
+ // Node.js built-in modules (node: prefix)
63
+ /^node:/,
64
+ ],
65
+ input: {
66
+ main: 'src/main.ts',
67
+ },
68
+ output: {
69
+ format: 'esm',
70
+ entryFileNames: '[name].js',
71
+ chunkFileNames: '[name].js',
72
+ },
73
+ },
74
+ modulePreload: false,
75
+ minify: false,
76
+ sourcemap: true
77
+ },
78
+ resolve: {
79
+ alias: {
80
+ '@': path.resolve(__dirname, 'src'),
81
+ },
82
+ },
83
+ });
@@ -0,0 +1,36 @@
1
+ import { defineConfig } from 'vitest/config';
2
+ import { fileURLToPath, URL } from 'node:url';
3
+
4
+ export default defineConfig({
5
+ test: {
6
+ globals: false,
7
+ environment: 'node',
8
+ setupFiles: ['tests/setup.ts'],
9
+ include: ['tests/**/*.test.ts'],
10
+ exclude: ['node_modules/**/*', 'dist/**/*'],
11
+ testTimeout: 30000,
12
+ coverage: {
13
+ provider: 'v8',
14
+ reporter: ['text', 'html', 'lcov'],
15
+ include: ['src/**/*.ts'],
16
+ exclude: [
17
+ 'dist/**/*',
18
+ 'node_modules/**/*',
19
+ 'tests/**/*',
20
+ 'src/**/*.md',
21
+ 'src/**/.DS_Store',
22
+ ],
23
+ thresholds: {
24
+ lines: 2,
25
+ statements: 2,
26
+ branches: 2,
27
+ functions: 2,
28
+ },
29
+ },
30
+ },
31
+ resolve: {
32
+ alias: {
33
+ '@': fileURLToPath(new URL('./src', import.meta.url)),
34
+ },
35
+ },
36
+ });