@matrica-code/snippet-extractor 1.0.0 → 1.0.2

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/README.md +29 -6
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -50,14 +50,10 @@ jobs:
50
50
  with:
51
51
  snippet-file: snippets.json # output path, relative to repo root
52
52
  paths: src # space-separated dirs/files to scan
53
+ upload-artifact: "true" # also upload the result as a workflow artifact
53
54
  # reset: "true" # start from {} (default); set "false" to merge
55
+ # artifact-name: snippets # artifact name (default: snippets)
54
56
  # image-tag: "1.0.0" # which ghcr.io image tag to run (default: latest)
55
-
56
- # then commit the file, or upload it, or deploy it to your snippet-viewer host
57
- - uses: actions/upload-artifact@v4
58
- with:
59
- name: snippets
60
- path: snippets.json
61
57
  ```
62
58
 
63
59
  A **Java repo** is identical — just point `paths` at the sources:
@@ -73,6 +69,33 @@ The action requires a Linux runner with Docker available (GitHub-hosted
73
69
  `ubuntu-latest` has it). It pulls `ghcr.io/matrica-code/snippet-extractor` and
74
70
  runs it over your checked-out workspace.
75
71
 
72
+ #### Action inputs
73
+
74
+ | Input | Default | Description |
75
+ | ------------------------- | --------------- | -------------------------------------------------------------- |
76
+ | `snippet-file` | `snippets.json` | Output JSON path, relative to the repo root. |
77
+ | `paths` | `.` | Space-separated dirs/files to scan, relative to the repo root. |
78
+ | `reset` | `true` | Start from `{}`; set `false` to merge into an existing file. |
79
+ | `image-tag` | `latest` | Which `ghcr.io/matrica-code/snippet-extractor` tag to run. |
80
+ | `upload-artifact` | `false` | Upload the generated file as a workflow artifact. |
81
+ | `artifact-name` | `snippets` | Artifact name (when `upload-artifact` is `true`). |
82
+ | `artifact-retention-days` | `90` | Artifact retention (when `upload-artifact` is `true`). |
83
+
84
+ The generated file also stays in the workspace at `$GITHUB_WORKSPACE/<snippet-file>`,
85
+ so a later step in the same job can read it directly — commit it, deploy it to your
86
+ snippet-viewer host, or push it to a blob store (S3/R2/GCS/Azure). The action exposes
87
+ its path as the `snippet-file` output too.
88
+
89
+ A later step can grab it via the output:
90
+
91
+ ```yaml
92
+ - id: snippets
93
+ uses: matrica-code/snippet-viewer/extractor@main
94
+ with:
95
+ paths: src
96
+ - run: aws s3 cp "${{ steps.snippets.outputs.snippet-file }}" s3://my-bucket/snippets.json --content-type application/json
97
+ ```
98
+
76
99
  ### Via npm / npx (Node repos)
77
100
 
78
101
  No install step needed — run the published package directly:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@matrica-code/snippet-extractor",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "type": "module",
5
5
  "description": "Multi-language (JS/TS/TSX/Java) extract-code snippet harvester. Produces the snippets.json consumed by snippet-viewer.",
6
6
  "keywords": [