fishprint 1.0.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/fishprint +101 -0
  2. package/package.json +13 -0
package/fishprint ADDED
@@ -0,0 +1,101 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+
4
+ COMMAND="${1:-}"
5
+
6
+ usage() {
7
+ echo "Usage: fishprint <command> [args]"
8
+ echo ""
9
+ echo "Commands:"
10
+ echo " gyazo-upload <image_path> Upload image to Gyazo, print URL"
11
+ echo " assemble <sectionDir> <output> [preamble] [appendix] Concatenate section files into digest"
12
+ exit 1
13
+ }
14
+
15
+ cmd_gyazo_upload() {
16
+ local image="$1"
17
+ if [ -z "$image" ]; then
18
+ echo "Usage: fishprint gyazo-upload <image_path>" >&2
19
+ exit 1
20
+ fi
21
+
22
+ if [ "$(uname)" = "Darwin" ]; then
23
+ TOKEN=$(security find-generic-password -a gyazo -s fishprint -w 2>/dev/null || true)
24
+ else
25
+ TOKEN=$(secret-tool lookup service fishprint key gyazo 2>/dev/null || true)
26
+ fi
27
+
28
+ if [ -z "$TOKEN" ]; then
29
+ echo "Error: Gyazo token not found. Set it with:" >&2
30
+ echo " macOS: security add-generic-password -a gyazo -s fishprint -w YOUR_TOKEN -U" >&2
31
+ echo " Linux: secret-tool store --label=fishprint service fishprint key gyazo" >&2
32
+ exit 1
33
+ fi
34
+
35
+ curl -s -X POST https://upload.gyazo.com/api/upload \
36
+ -F "access_token=$TOKEN" \
37
+ -F "imagedata=@$image" \
38
+ | grep -o '"url":"[^"]*"' | cut -d'"' -f4
39
+ }
40
+
41
+ cmd_assemble() {
42
+ local section_dir="$1"
43
+ local output="$2"
44
+ local preamble_file="${3:-}"
45
+ local appendix_file="${4:-}"
46
+
47
+ if [ ! -d "$section_dir" ]; then
48
+ echo "Error: sectionDir '$section_dir' not found" >&2
49
+ exit 1
50
+ fi
51
+
52
+ local sections
53
+ sections=$(ls "$section_dir"/section_*.md 2>/dev/null | sort -t_ -k2 -n || true)
54
+ if [ -z "$sections" ]; then
55
+ echo "Error: no section_*.md files found in '$section_dir'" >&2
56
+ exit 1
57
+ fi
58
+
59
+ mkdir -p "$(dirname "$output")"
60
+
61
+ {
62
+ if [ -n "$preamble_file" ] && [ -f "$preamble_file" ]; then
63
+ cat "$preamble_file"
64
+ echo
65
+ echo
66
+ fi
67
+
68
+ local first=1
69
+ while IFS= read -r f; do
70
+ if [ "$first" = "1" ]; then
71
+ first=0
72
+ else
73
+ echo
74
+ echo "---"
75
+ echo
76
+ fi
77
+ cat "$f"
78
+ done <<< "$sections"
79
+
80
+ if [ -n "$appendix_file" ] && [ -f "$appendix_file" ]; then
81
+ echo
82
+ echo "---"
83
+ echo
84
+ cat "$appendix_file"
85
+ fi
86
+ } > "$output"
87
+
88
+ # Clean up
89
+ while IFS= read -r f; do rm -f "$f"; done <<< "$sections"
90
+ rmdir "$section_dir" 2>/dev/null || true
91
+
92
+ local count
93
+ count=$(echo "$sections" | wc -l | tr -d ' ')
94
+ echo "Assembled $count sections → $output"
95
+ }
96
+
97
+ case "$COMMAND" in
98
+ gyazo-upload) shift; cmd_gyazo_upload "$@" ;;
99
+ assemble) shift; cmd_assemble "$@" ;;
100
+ *) usage ;;
101
+ esac
package/package.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "fishprint",
3
+ "version": "1.0.0",
4
+ "description": "CLI for the Fishprint Claude Code plugin — Gyazo upload and digest assembly",
5
+ "bin": {
6
+ "fishprint": "fishprint"
7
+ },
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/moeki0/claude-code-fishprint.git"
11
+ },
12
+ "license": "MIT"
13
+ }