@yuiseki/gyazocli 0.0.2 → 0.2.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,72 @@
1
+ # 005. Module layout
2
+
3
+ ## Status
4
+
5
+ Accepted.
6
+
7
+ ## Context
8
+
9
+ `src/index.ts` had grown to about 2950 lines. It held the commander
10
+ definitions for sixteen commands, and underneath them the text formatting, the
11
+ date handling, the cache walks, the rankings and the printers. Finding the code
12
+ behind a command meant scrolling, and two unrelated concerns often sat a few
13
+ lines apart.
14
+
15
+ The tests made the move safe: all of them spawn the built CLI and assert on its
16
+ output, so nothing here depends on the internal shape, and a behaviour change
17
+ during the move would fail them.
18
+
19
+ ## Decision
20
+
21
+ ```
22
+ src/
23
+ index.ts the program, the register calls, the entry dispatch
24
+ commands/ one module per command, each exporting
25
+ register<Name>Command(program)
26
+ api.ts HTTP against Gyazo
27
+ storage.ts reading and writing the cache files
28
+ config.ts environment
29
+ credentials.ts the access token
30
+ ids.ts image and collection IDs out of what was typed
31
+ options.ts numeric option validation
32
+ format.ts reading and presenting the fields of an image
33
+ dates.ts local days, ranges, hourly bucket keys
34
+ mcp.ts the MCP server
35
+ services/
36
+ memory.ts the cache, and the API walks that fill it
37
+ analytics.ts rankings, summaries, the stats markdown
38
+ images.ts showing captures, and the upload helpers
39
+ collections.ts collections
40
+ ```
41
+
42
+ Dependencies run one way. A command module may use anything below it;
43
+ `services/` may use the modules above it; nothing below reaches back up into
44
+ `commands/`. Within `services/`, `analytics` and `images` may use `memory`, and
45
+ `collections` may use `images`.
46
+
47
+ The register calls in `index.ts` run in the order the commands were defined
48
+ before, because that order is what `--help` prints.
49
+
50
+ Two placements are worth recording, because they were both the second attempt.
51
+ `mergeImageForDisplay` and `shouldEnrichForLocationDisplay` sound like display
52
+ code but live in `format.ts`: the cache walks need them too, and leaving them
53
+ with the printers made `memory` and `images` depend on each other in both
54
+ directions. `parsePositiveIntegerOption` is its own module rather than part of
55
+ either `dates` or `index`, because the date handling and the commands both use
56
+ it and it reports failure by exiting.
57
+
58
+ ## Consequences
59
+
60
+ - `index.ts` is about 100 lines: the program metadata, the register calls, and
61
+ the two things that happen before parsing, which are the bare-argument
62
+ dispatch and the MCP branch.
63
+ - The largest command module is `list.ts` at about 220 lines. The rest are
64
+ under 120.
65
+ - `noUnusedLocals` and `noUnusedParameters` are on. The move left dozens of
66
+ imports behind for functions that were no longer there, and that class of
67
+ leftover should fail the build.
68
+ - The MCP server no longer reaches into the command file for ID handling; it
69
+ imports `ids.ts` like everything else.
70
+ - A command's implementation is now spread over more files than before. The
71
+ commander definition stays the place to start reading, and it names what it
72
+ calls.
package/package.json CHANGED
@@ -1,7 +1,15 @@
1
1
  {
2
2
  "name": "@yuiseki/gyazocli",
3
- "version": "0.0.2",
3
+ "version": "0.2.0",
4
4
  "description": "Gyazo Memory CLI for AI Secretary",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/yuiseki/gyazocli.git"
8
+ },
9
+ "bugs": {
10
+ "url": "https://github.com/yuiseki/gyazocli/issues"
11
+ },
12
+ "homepage": "https://github.com/yuiseki/gyazocli#readme",
5
13
  "main": "dist/index.js",
6
14
  "bin": {
7
15
  "gyazo": "dist/index.js"
@@ -28,9 +36,11 @@
28
36
  "license": "ISC",
29
37
  "type": "commonjs",
30
38
  "dependencies": {
39
+ "@modelcontextprotocol/sdk": "^1.30.0",
31
40
  "axios": "^1.13.5",
32
41
  "commander": "^14.0.3",
33
42
  "dotenv": "^17.3.1",
43
+ "form-data": "^4.0.0",
34
44
  "zod": "^4.3.6"
35
45
  },
36
46
  "devDependencies": {