@procrastivity/clast 0.0.1

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,108 @@
1
+ # clast-subcommands/whereami.bash — `clast whereami`.
2
+ #
3
+ # Reports what clast sees about the current directory: pwd, git root,
4
+ # registry status (stubbed until step 05), last snapshot (stubbed until
5
+ # step 04), and effective journal/projects/cutoff/machine settings.
6
+ # shellcheck shell=bash
7
+
8
+ clast_cmd_whereami() {
9
+ # Subcommand-level flag parsing. The dispatcher may have already set
10
+ # CLAST_JSON=1, but accept `--json` here too for ergonomics.
11
+ local json="${CLAST_JSON:-}"
12
+ while [[ $# -gt 0 ]]; do
13
+ case "$1" in
14
+ --json) json=1; shift ;;
15
+ -h|--help)
16
+ cat <<'EOF'
17
+ Usage: clast whereami [--json]
18
+
19
+ Show what clast sees about the current directory.
20
+ EOF
21
+ return 0
22
+ ;;
23
+ *)
24
+ clast_log_error "whereami: unexpected arg '$1'"
25
+ return 2
26
+ ;;
27
+ esac
28
+ done
29
+
30
+ local pwd_v git_root remote registered slug last_snapshot
31
+ local journal_dir projects_dir day_cutoff machine
32
+
33
+ pwd_v="$PWD"
34
+
35
+ git_root="$(git rev-parse --show-toplevel 2>/dev/null || true)"
36
+
37
+ remote=""
38
+ if [[ -n "$git_root" ]]; then
39
+ remote="$(git -C "$git_root" config --get remote.origin.url 2>/dev/null || true)"
40
+ fi
41
+
42
+ local _lookup="${git_root:-$PWD}"
43
+ if slug="$(clast_registry_resolve "$_lookup" 2>/dev/null)" && [[ -n "$slug" ]]; then
44
+ registered="yes"
45
+ else
46
+ registered="no"
47
+ slug=""
48
+ fi
49
+
50
+ # TODO(step-04): look up the most recent manifest entry for the
51
+ # resolved project and report its captured_at timestamp.
52
+ last_snapshot=""
53
+
54
+ journal_dir="$(clast_journal_dir)"
55
+ projects_dir="$(clast_projects_dir)"
56
+ day_cutoff="${CLAST_DAY_CUTOFF:-04:00}"
57
+
58
+ # Short hostname on both macOS and Linux. `hostname -s` works on both
59
+ # but is missing on some minimal images; fall back to plain `hostname`
60
+ # with any domain suffix stripped.
61
+ machine="$(hostname -s 2>/dev/null || hostname | cut -d. -f1)"
62
+
63
+ if [[ -n "$json" ]]; then
64
+ jq -n \
65
+ --arg pwd "$pwd_v" \
66
+ --arg git_root "$git_root" \
67
+ --arg registered "$registered" \
68
+ --arg slug "$slug" \
69
+ --arg remote "$remote" \
70
+ --arg last_snapshot "$last_snapshot" \
71
+ --arg journal_dir "$journal_dir" \
72
+ --arg projects_dir "$projects_dir" \
73
+ --arg day_cutoff "$day_cutoff" \
74
+ --arg machine "$machine" \
75
+ '{
76
+ pwd: $pwd,
77
+ git_root: (if $git_root == "" then null else $git_root end),
78
+ registered: $registered,
79
+ slug: (if $slug == "" then null else $slug end),
80
+ remote: (if $remote == "" then null else $remote end),
81
+ last_snapshot: (if $last_snapshot == "" then null else $last_snapshot end),
82
+ journal_dir: $journal_dir,
83
+ projects_dir: $projects_dir,
84
+ day_cutoff: $day_cutoff,
85
+ machine: $machine
86
+ }'
87
+ return 0
88
+ fi
89
+
90
+ # Human output: labeled key/value block, em-dash for nulls.
91
+ local dash="—"
92
+ _clast_whereami_row() {
93
+ local label="$1" value="$2"
94
+ if [[ -z "$value" ]]; then value="$dash"; fi
95
+ printf '%-15s %s\n' "$label:" "$value"
96
+ }
97
+
98
+ _clast_whereami_row "pwd" "$pwd_v"
99
+ _clast_whereami_row "git_root" "$git_root"
100
+ _clast_whereami_row "registered" "$registered"
101
+ _clast_whereami_row "slug" "$slug"
102
+ _clast_whereami_row "remote" "$remote"
103
+ _clast_whereami_row "last_snapshot" "$last_snapshot"
104
+ _clast_whereami_row "journal_dir" "$journal_dir"
105
+ _clast_whereami_row "projects_dir" "$projects_dir"
106
+ _clast_whereami_row "day_cutoff" "$day_cutoff"
107
+ _clast_whereami_row "machine" "$machine"
108
+ }
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@procrastivity/clast",
3
+ "version": "0.0.1",
4
+ "description": "Capture, curate, and surface Claude Code session history across all your projects.",
5
+ "homepage": "https://github.com/procrastivity/clast#readme",
6
+ "bin": {
7
+ "clast": "bin/clast"
8
+ },
9
+ "files": [
10
+ "bin/",
11
+ "lib/",
12
+ ".claude-plugin/",
13
+ "hooks/",
14
+ "examples/",
15
+ "README.md",
16
+ "LICENSE"
17
+ ],
18
+ "scripts": {
19
+ "test": "make test",
20
+ "lint": "make lint",
21
+ "prepublishOnly": "make lint && make test && make check-version-sync && ./contrib/npm-pack-check.sh"
22
+ },
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "https://github.com/procrastivity/clast.git"
26
+ },
27
+ "keywords": [
28
+ "claude-code",
29
+ "session",
30
+ "journal",
31
+ "history",
32
+ "cli"
33
+ ],
34
+ "author": "Beau",
35
+ "license": "MIT",
36
+ "engines": {
37
+ "node": ">=18"
38
+ }
39
+ }