@codesummary/cli 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/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@codesummary/cli",
3
+ "version": "0.1.0",
4
+ "description": "Submit local workspaces to CodeSummary knowledge and hosted docs.",
5
+ "type": "module",
6
+ "bin": {
7
+ "codesummary": "bin/codesummary.js"
8
+ },
9
+ "engines": {
10
+ "node": ">=18"
11
+ },
12
+ "scripts": {
13
+ "smoke": "node ./bin/codesummary.js --help",
14
+ "test": "node --test",
15
+ "test:package": "bash ./scripts/package-smoke.sh",
16
+ "release:check": "bash ./scripts/release-check.sh"
17
+ },
18
+ "files": [
19
+ "bin",
20
+ "scripts/package-smoke.sh",
21
+ "README.md",
22
+ "RELEASE.md",
23
+ "ROADMAP.md"
24
+ ],
25
+ "license": "UNLICENSED",
26
+ "publishConfig": {
27
+ "access": "public"
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+ssh://git@github.com/CodeSummaryAI/codesummary-cli.git"
32
+ }
33
+ }
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
5
+ PACK_DIR="$(mktemp -d)"
6
+ INSTALL_DIR="$(mktemp -d)"
7
+ WORKSPACE_DIR="$(mktemp -d)"
8
+ CACHE_DIR="${TMPDIR:-/tmp}/codesummary-cli-npm-cache"
9
+ MANIFEST_OUTPUT="$WORKSPACE_DIR/manifest-output.json"
10
+
11
+ cleanup() {
12
+ rm -rf "$PACK_DIR" "$INSTALL_DIR" "$WORKSPACE_DIR"
13
+ }
14
+ trap cleanup EXIT
15
+
16
+ cd "$ROOT_DIR"
17
+ npm_config_cache="$CACHE_DIR" npm pack --pack-destination "$PACK_DIR" >/dev/null
18
+ PACKAGE_FILE="$(find "$PACK_DIR" -name '*.tgz' -print -quit)"
19
+
20
+ if [[ -z "$PACKAGE_FILE" ]]; then
21
+ echo "npm pack did not produce a tarball" >&2
22
+ exit 1
23
+ fi
24
+
25
+ npm_config_cache="$CACHE_DIR" npm install --prefix "$INSTALL_DIR" "$PACKAGE_FILE" >/dev/null
26
+
27
+ HELP_OUTPUT="$("$INSTALL_DIR/node_modules/.bin/codesummary" --help)"
28
+ if ! grep -q 'CodeSummary CLI' <<<"$HELP_OUTPUT"; then
29
+ echo "installed binary did not print CodeSummary help" >&2
30
+ exit 1
31
+ fi
32
+
33
+ if ! grep -q 'codesummary submit' <<<"$HELP_OUTPUT"; then
34
+ echo "installed binary help is missing submit command" >&2
35
+ exit 1
36
+ fi
37
+
38
+ mkdir -p "$WORKSPACE_DIR/src"
39
+ cat >"$WORKSPACE_DIR/README.md" <<'MD'
40
+ # Package smoke
41
+ MD
42
+ cat >"$WORKSPACE_DIR/src/index.js" <<'JS'
43
+ export const smoke = true
44
+ JS
45
+
46
+ (cd "$WORKSPACE_DIR" && "$INSTALL_DIR/node_modules/.bin/codesummary" manifest >"$MANIFEST_OUTPUT")
47
+
48
+ if ! grep -q '"files"' "$MANIFEST_OUTPUT"; then
49
+ echo "installed binary did not create a manifest in a repo workspace" >&2
50
+ exit 1
51
+ fi
52
+
53
+ if ! test -f "$WORKSPACE_DIR/.codesummary/manifest.json"; then
54
+ echo "installed binary did not write .codesummary/manifest.json" >&2
55
+ exit 1
56
+ fi
57
+
58
+ echo "Installed package smoke passed: $PACKAGE_FILE"