promptotype 0.1.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.
package/npm/cli.js ADDED
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Thin wrapper that exec's the platform-specific binary.
5
+ * The binary is downloaded by postinstall.js into ../bin/promptotype.
6
+ */
7
+
8
+ import { execFileSync } from 'child_process';
9
+ import { existsSync } from 'fs';
10
+ import { join, dirname } from 'path';
11
+ import { fileURLToPath } from 'url';
12
+
13
+ const __dirname = dirname(fileURLToPath(import.meta.url));
14
+ const binPath = join(__dirname, '..', 'bin', 'promptotype');
15
+
16
+ if (!existsSync(binPath)) {
17
+ console.error('Binary not found. Try reinstalling: npm install -g promptotype');
18
+ process.exit(1);
19
+ }
20
+
21
+ try {
22
+ execFileSync(binPath, process.argv.slice(2), { stdio: 'inherit' });
23
+ } catch (err) {
24
+ process.exit(err.status ?? 1);
25
+ }
@@ -0,0 +1,89 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Postinstall script that downloads the correct platform binary
5
+ * from the GitHub release matching the package version.
6
+ */
7
+
8
+ import { createWriteStream, chmodSync, mkdirSync } from 'fs';
9
+ import { join, dirname } from 'path';
10
+ import { fileURLToPath } from 'url';
11
+ import { get } from 'https';
12
+
13
+ const __dirname = dirname(fileURLToPath(import.meta.url));
14
+
15
+ const REPO = 'niforiskollaros/promptotype';
16
+ const BIN_NAME = 'promptotype';
17
+
18
+ function getPlatformBinary() {
19
+ const platform = process.platform;
20
+ const arch = process.arch;
21
+
22
+ if (platform === 'darwin' && arch === 'arm64') return `${BIN_NAME}-darwin-arm64`;
23
+ if (platform === 'darwin' && arch === 'x64') return `${BIN_NAME}-darwin-x64`;
24
+ if (platform === 'linux' && arch === 'x64') return `${BIN_NAME}-linux-x64`;
25
+ if (platform === 'linux' && arch === 'arm64') return `${BIN_NAME}-linux-arm64`;
26
+
27
+ console.error(`Unsupported platform: ${platform}-${arch}`);
28
+ console.error('Promptotype supports: macOS (arm64, x64) and Linux (x64, arm64)');
29
+ process.exit(1);
30
+ }
31
+
32
+ function getVersion() {
33
+ const pkg = JSON.parse(
34
+ (await import('fs')).readFileSync(join(__dirname, '..', 'package.json'), 'utf8')
35
+ );
36
+ return pkg.version;
37
+ }
38
+
39
+ function download(url, dest) {
40
+ return new Promise((resolve, reject) => {
41
+ const follow = (url) => {
42
+ get(url, (res) => {
43
+ if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
44
+ follow(res.headers.location);
45
+ return;
46
+ }
47
+ if (res.statusCode !== 200) {
48
+ reject(new Error(`Download failed: HTTP ${res.statusCode} from ${url}`));
49
+ return;
50
+ }
51
+ const file = createWriteStream(dest);
52
+ res.pipe(file);
53
+ file.on('finish', () => { file.close(); resolve(); });
54
+ file.on('error', reject);
55
+ }).on('error', reject);
56
+ };
57
+ follow(url);
58
+ });
59
+ }
60
+
61
+ async function main() {
62
+ const binaryName = getPlatformBinary();
63
+ const binDir = join(__dirname, '..', 'bin');
64
+ const binPath = join(binDir, BIN_NAME);
65
+
66
+ // Read version from package.json
67
+ const { readFileSync } = await import('fs');
68
+ const pkg = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf8'));
69
+ const version = pkg.version;
70
+
71
+ const url = `https://github.com/${REPO}/releases/download/v${version}/${binaryName}`;
72
+
73
+ console.log(`Downloading ${binaryName} v${version}...`);
74
+
75
+ mkdirSync(binDir, { recursive: true });
76
+
77
+ try {
78
+ await download(url, binPath);
79
+ chmodSync(binPath, 0o755);
80
+ console.log(`Installed promptotype to ${binPath}`);
81
+ } catch (err) {
82
+ console.error(`Failed to download binary: ${err.message}`);
83
+ console.error(`URL: ${url}`);
84
+ console.error('You can install manually from: https://github.com/niforiskollaros/promptotype/releases');
85
+ process.exit(1);
86
+ }
87
+ }
88
+
89
+ main();
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "promptotype",
3
+ "version": "0.1.0",
4
+ "description": "Browser overlay that lets you annotate UI elements and send structured feedback to AI coding agents",
5
+ "main": "dist/promptotype.iife.js",
6
+ "bin": {
7
+ "promptotype": "npm/cli.js"
8
+ },
9
+ "scripts": {
10
+ "dev": "vite",
11
+ "build": "vite build",
12
+ "preview": "vite preview",
13
+ "build:cli": "vite build && bun build cli/index.ts --outfile dist/promptotype --compile",
14
+ "build:cli:all": "vite build && bun build cli/index.ts --outfile dist/promptotype-darwin-arm64 --compile --target=bun-darwin-arm64 && bun build cli/index.ts --outfile dist/promptotype-darwin-x64 --compile --target=bun-darwin-x64 && bun build cli/index.ts --outfile dist/promptotype-linux-x64 --compile --target=bun-linux-x64 && bun build cli/index.ts --outfile dist/promptotype-linux-arm64 --compile --target=bun-linux-arm64",
15
+ "cli": "bun run cli/index.ts",
16
+ "postinstall": "node npm/postinstall.js"
17
+ },
18
+ "files": [
19
+ "dist/promptotype.iife.js",
20
+ "npm/postinstall.js",
21
+ "npm/cli.js",
22
+ "bin/"
23
+ ],
24
+ "keywords": ["design", "annotation", "ai", "cli", "browser", "overlay", "promptotype"],
25
+ "author": "Nikos Kollaros",
26
+ "license": "ISC",
27
+ "type": "module",
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "https://github.com/niforiskollaros/promptotype.git"
31
+ },
32
+ "homepage": "https://github.com/niforiskollaros/promptotype",
33
+ "devDependencies": {
34
+ "typescript": "^6.0.2",
35
+ "vite": "^8.0.3"
36
+ }
37
+ }