screenhand 0.4.3 → 0.4.5

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 CHANGED
@@ -132,12 +132,17 @@ Every install ships with battle-tested knowledge so AI starts from EXPERT level
132
132
 
133
133
  | | Count | Apps Included |
134
134
  |---|---|---|
135
- | **References** | 36 | Terminal, Mail, Finder, Calendar, Reminders, Keynote, Pages, Notes, Photos, Apple Music, WhatsApp, Figma, Discord, DaVinci Resolve, Canva, Instagram, X/Twitter, LinkedIn, YouTube, Reddit, Notion, n8n, and more |
135
+ | **References** | 37 | Terminal, Mail, Finder, Calendar, Reminders, Keynote, Pages, Notes, Photos, Apple Music, WhatsApp, Simulator, Figma, Discord, DaVinci Resolve, Canva, Instagram, X/Twitter, LinkedIn, YouTube, Reddit, Notion, n8n, and more |
136
136
  | **Playbooks** | 49 | Calendar events, Keynote decks, Reminders, Notes workflows, WhatsApp navigation, DaVinci color grading/render, Canva carousel, social posting, Google Flow, competitor research, and more |
137
- | **App Maps** | 14 | Spatial UI blueprints for Finder, Mail, Calendar, Notes, Reminders, Keynote, Pages, Photos, Apple Music, Terminal, WhatsApp, Figma, Discord, Notion |
137
+ | **App Maps** | 15 | Spatial UI blueprints for Finder, Mail, Calendar, Notes, Reminders, Keynote, Pages, Photos, Apple Music, Terminal, WhatsApp, Simulator, Figma, Discord, Notion |
138
138
 
139
139
  These load automatically when the matching app or website is detected. No setup required.
140
140
 
141
+ **Verify after install:**
142
+ ```bash
143
+ npx screenhand --info
144
+ ```
145
+
141
146
  ---
142
147
 
143
148
  ## What It Does
@@ -75,6 +75,95 @@ import { ReferenceMerger } from "./src/ingestion/reference-merger.js";
75
75
  import { PlaybookPublisher } from "./src/community/publisher.js";
76
76
  import { PlaybookFetcher } from "./src/community/fetcher.js";
77
77
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
78
+ // ── CLI flags (--info, --version, --help) ──
79
+ if (process.argv.includes("--info") || process.argv.includes("--list-knowledge")) {
80
+ const pkgPath = fs.existsSync(path.resolve(__dirname, "package.json"))
81
+ ? path.resolve(__dirname, "package.json")
82
+ : path.resolve(__dirname, "..", "package.json");
83
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
84
+ const countJsonFiles = (dir) => {
85
+ if (!fs.existsSync(dir))
86
+ return { count: 0, names: [] };
87
+ const files = fs.readdirSync(dir).filter(f => f.endsWith(".json") && !f.includes(".ladder."));
88
+ return { count: files.length, names: files.map(f => f.replace(".json", "")) };
89
+ };
90
+ // Check all possible data paths: local dev, same-level dist, parent-level dist, npm installed
91
+ const findDataDir = (name) => {
92
+ const candidates = [
93
+ path.resolve(__dirname, name), // local dev: references/
94
+ path.resolve(__dirname, `dist-${name}`), // local dev: dist-references/
95
+ path.resolve(__dirname, "..", name), // from dist/: ../references/
96
+ path.resolve(__dirname, "..", `dist-${name}`), // from dist/: ../dist-references/
97
+ ];
98
+ for (const dir of candidates) {
99
+ if (fs.existsSync(dir) && fs.readdirSync(dir).some(f => f.endsWith(".json"))) {
100
+ return dir;
101
+ }
102
+ }
103
+ return path.join(os.homedir(), ".screenhand", name);
104
+ };
105
+ const refsDir = findDataDir("references");
106
+ const pbDir = findDataDir("playbooks");
107
+ const mapsDir = findDataDir("app-maps");
108
+ const refs = countJsonFiles(refsDir);
109
+ const pbs = countJsonFiles(pbDir);
110
+ const maps = countJsonFiles(mapsDir);
111
+ console.log(`\nScreenHand v${pkg.version}\n`);
112
+ console.log(`Prebuilt Knowledge:`);
113
+ console.log(` References: ${refs.count} apps`);
114
+ refs.names.forEach(n => console.log(` - ${n}`));
115
+ console.log(` Playbooks: ${pbs.count} workflows`);
116
+ pbs.names.forEach(n => console.log(` - ${n}`));
117
+ console.log(` App Maps: ${maps.count} spatial blueprints`);
118
+ maps.names.forEach(n => console.log(` - ${n}`));
119
+ // User-generated knowledge
120
+ const userRefsDir = path.join(os.homedir(), ".screenhand", "references");
121
+ const userMapsDir = path.join(os.homedir(), ".screenhand", "app-maps");
122
+ const userRefs = countJsonFiles(userRefsDir);
123
+ const userMaps = countJsonFiles(userMapsDir);
124
+ if (userRefs.count > 0 || userMaps.count > 0) {
125
+ console.log(`\nUser-Learned Knowledge (~/.screenhand/):`);
126
+ if (userRefs.count > 0) {
127
+ console.log(` References: ${userRefs.count}`);
128
+ userRefs.names.forEach(n => console.log(` - ${n}`));
129
+ }
130
+ if (userMaps.count > 0) {
131
+ console.log(` App Maps: ${userMaps.count}`);
132
+ userMaps.names.forEach(n => console.log(` - ${n}`));
133
+ }
134
+ }
135
+ console.log(`\nData paths:`);
136
+ console.log(` References: ${refsDir}`);
137
+ console.log(` Playbooks: ${pbDir}`);
138
+ console.log(` App Maps: ${mapsDir}`);
139
+ console.log(` User data: ${path.join(os.homedir(), ".screenhand")}`);
140
+ console.log();
141
+ process.exit(0);
142
+ }
143
+ if (process.argv.includes("--version")) {
144
+ const pkgPath2 = fs.existsSync(path.resolve(__dirname, "package.json"))
145
+ ? path.resolve(__dirname, "package.json")
146
+ : path.resolve(__dirname, "..", "package.json");
147
+ const pkg = JSON.parse(fs.readFileSync(pkgPath2, "utf-8"));
148
+ console.log(`screenhand v${pkg.version}`);
149
+ process.exit(0);
150
+ }
151
+ if (process.argv.includes("--help")) {
152
+ console.log(`
153
+ ScreenHand — MCP Server for Desktop Automation
154
+
155
+ Usage:
156
+ npx screenhand Start MCP server (stdio)
157
+ npx screenhand --info Show prebuilt knowledge & data paths
158
+ npx screenhand --version Show version
159
+
160
+ Add to your AI client:
161
+ claude mcp add screenhand -- npx -y screenhand
162
+
163
+ Docs: https://github.com/manushi4/Screenhand
164
+ `);
165
+ process.exit(0);
166
+ }
78
167
  // ── Audit logging for dangerous tools ──
79
168
  const AUDIT_LOG_PATH = path.resolve(__dirname, ".audit-log.jsonl");
80
169
  function auditLog(tool, params) {