shipwright-cli 1.10.0 → 2.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/README.md +221 -55
- package/completions/_shipwright +264 -32
- package/completions/shipwright.bash +118 -26
- package/completions/shipwright.fish +80 -2
- package/dashboard/server.ts +208 -0
- package/docs/strategy/01-market-research.md +619 -0
- package/docs/strategy/02-mission-and-brand.md +587 -0
- package/docs/strategy/03-gtm-and-roadmap.md +759 -0
- package/docs/strategy/QUICK-START.txt +289 -0
- package/docs/strategy/README.md +172 -0
- package/docs/tmux-research/TMUX-ARCHITECTURE.md +567 -0
- package/docs/tmux-research/TMUX-AUDIT.md +925 -0
- package/docs/tmux-research/TMUX-BEST-PRACTICES-2025-2026.md +829 -0
- package/docs/tmux-research/TMUX-QUICK-REFERENCE.md +543 -0
- package/docs/tmux-research/TMUX-RESEARCH-INDEX.md +438 -0
- package/package.json +4 -2
- package/scripts/lib/helpers.sh +7 -0
- package/scripts/sw +323 -2
- package/scripts/sw-activity.sh +500 -0
- package/scripts/sw-adaptive.sh +925 -0
- package/scripts/sw-adversarial.sh +1 -1
- package/scripts/sw-architecture-enforcer.sh +1 -1
- package/scripts/sw-auth.sh +613 -0
- package/scripts/sw-autonomous.sh +754 -0
- package/scripts/sw-changelog.sh +704 -0
- package/scripts/sw-checkpoint.sh +1 -1
- package/scripts/sw-ci.sh +602 -0
- package/scripts/sw-cleanup.sh +1 -1
- package/scripts/sw-code-review.sh +698 -0
- package/scripts/sw-connect.sh +1 -1
- package/scripts/sw-context.sh +605 -0
- package/scripts/sw-cost.sh +44 -3
- package/scripts/sw-daemon.sh +568 -138
- package/scripts/sw-dashboard.sh +1 -1
- package/scripts/sw-db.sh +1380 -0
- package/scripts/sw-decompose.sh +539 -0
- package/scripts/sw-deps.sh +551 -0
- package/scripts/sw-developer-simulation.sh +1 -1
- package/scripts/sw-discovery.sh +412 -0
- package/scripts/sw-docs-agent.sh +539 -0
- package/scripts/sw-docs.sh +1 -1
- package/scripts/sw-doctor.sh +107 -1
- package/scripts/sw-dora.sh +615 -0
- package/scripts/sw-durable.sh +710 -0
- package/scripts/sw-e2e-orchestrator.sh +535 -0
- package/scripts/sw-eventbus.sh +393 -0
- package/scripts/sw-feedback.sh +479 -0
- package/scripts/sw-fix.sh +1 -1
- package/scripts/sw-fleet-discover.sh +567 -0
- package/scripts/sw-fleet-viz.sh +404 -0
- package/scripts/sw-fleet.sh +8 -1
- package/scripts/sw-github-app.sh +596 -0
- package/scripts/sw-github-checks.sh +4 -4
- package/scripts/sw-github-deploy.sh +1 -1
- package/scripts/sw-github-graphql.sh +1 -1
- package/scripts/sw-guild.sh +569 -0
- package/scripts/sw-heartbeat.sh +1 -1
- package/scripts/sw-hygiene.sh +559 -0
- package/scripts/sw-incident.sh +656 -0
- package/scripts/sw-init.sh +237 -24
- package/scripts/sw-instrument.sh +699 -0
- package/scripts/sw-intelligence.sh +1 -1
- package/scripts/sw-jira.sh +1 -1
- package/scripts/sw-launchd.sh +363 -28
- package/scripts/sw-linear.sh +1 -1
- package/scripts/sw-logs.sh +1 -1
- package/scripts/sw-loop.sh +267 -21
- package/scripts/sw-memory.sh +18 -1
- package/scripts/sw-mission-control.sh +487 -0
- package/scripts/sw-model-router.sh +545 -0
- package/scripts/sw-otel.sh +596 -0
- package/scripts/sw-oversight.sh +764 -0
- package/scripts/sw-pipeline-composer.sh +1 -1
- package/scripts/sw-pipeline-vitals.sh +1 -1
- package/scripts/sw-pipeline.sh +947 -35
- package/scripts/sw-pm.sh +758 -0
- package/scripts/sw-pr-lifecycle.sh +522 -0
- package/scripts/sw-predictive.sh +8 -1
- package/scripts/sw-prep.sh +1 -1
- package/scripts/sw-ps.sh +1 -1
- package/scripts/sw-public-dashboard.sh +798 -0
- package/scripts/sw-quality.sh +595 -0
- package/scripts/sw-reaper.sh +1 -1
- package/scripts/sw-recruit.sh +2248 -0
- package/scripts/sw-regression.sh +642 -0
- package/scripts/sw-release-manager.sh +736 -0
- package/scripts/sw-release.sh +706 -0
- package/scripts/sw-remote.sh +1 -1
- package/scripts/sw-replay.sh +520 -0
- package/scripts/sw-retro.sh +691 -0
- package/scripts/sw-scale.sh +444 -0
- package/scripts/sw-security-audit.sh +505 -0
- package/scripts/sw-self-optimize.sh +1 -1
- package/scripts/sw-session.sh +1 -1
- package/scripts/sw-setup.sh +263 -127
- package/scripts/sw-standup.sh +712 -0
- package/scripts/sw-status.sh +44 -2
- package/scripts/sw-strategic.sh +806 -0
- package/scripts/sw-stream.sh +450 -0
- package/scripts/sw-swarm.sh +620 -0
- package/scripts/sw-team-stages.sh +511 -0
- package/scripts/sw-templates.sh +4 -4
- package/scripts/sw-testgen.sh +566 -0
- package/scripts/sw-tmux-pipeline.sh +554 -0
- package/scripts/sw-tmux-role-color.sh +58 -0
- package/scripts/sw-tmux-status.sh +128 -0
- package/scripts/sw-tmux.sh +1 -1
- package/scripts/sw-trace.sh +485 -0
- package/scripts/sw-tracker-github.sh +188 -0
- package/scripts/sw-tracker-jira.sh +172 -0
- package/scripts/sw-tracker-linear.sh +251 -0
- package/scripts/sw-tracker.sh +117 -2
- package/scripts/sw-triage.sh +627 -0
- package/scripts/sw-upgrade.sh +1 -1
- package/scripts/sw-ux.sh +677 -0
- package/scripts/sw-webhook.sh +627 -0
- package/scripts/sw-widgets.sh +530 -0
- package/scripts/sw-worktree.sh +1 -1
- package/templates/pipelines/autonomous.json +2 -2
- package/tmux/shipwright-overlay.conf +35 -17
- package/tmux/tmux.conf +23 -21
package/scripts/sw-cost.sh
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
set -euo pipefail
|
|
7
7
|
trap 'echo "ERROR: $BASH_SOURCE:$LINENO exited with status $?" >&2' ERR
|
|
8
8
|
|
|
9
|
-
VERSION="1.
|
|
9
|
+
VERSION="2.1.0"
|
|
10
10
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
11
11
|
REPO_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
12
12
|
|
|
@@ -70,6 +70,12 @@ COST_DIR="${HOME}/.shipwright"
|
|
|
70
70
|
COST_FILE="${COST_DIR}/costs.json"
|
|
71
71
|
BUDGET_FILE="${COST_DIR}/budget.json"
|
|
72
72
|
|
|
73
|
+
# Source sw-db.sh for SQLite cost functions (if available)
|
|
74
|
+
_COST_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
75
|
+
if [[ -f "$_COST_SCRIPT_DIR/sw-db.sh" ]]; then
|
|
76
|
+
source "$_COST_SCRIPT_DIR/sw-db.sh" 2>/dev/null || true
|
|
77
|
+
fi
|
|
78
|
+
|
|
73
79
|
ensure_cost_dir() {
|
|
74
80
|
mkdir -p "$COST_DIR"
|
|
75
81
|
[[ -f "$COST_FILE" ]] || echo '{"entries":[],"summary":{}}' > "$COST_FILE"
|
|
@@ -143,6 +149,7 @@ cost_calculate() {
|
|
|
143
149
|
|
|
144
150
|
# cost_record <input_tokens> <output_tokens> <model> <stage> [issue]
|
|
145
151
|
# Records a cost entry to the cost file and events log.
|
|
152
|
+
# Tries SQLite first, always writes to JSON for backward compat.
|
|
146
153
|
cost_record() {
|
|
147
154
|
local input_tokens="${1:-0}"
|
|
148
155
|
local output_tokens="${2:-0}"
|
|
@@ -155,6 +162,12 @@ cost_record() {
|
|
|
155
162
|
local cost_usd
|
|
156
163
|
cost_usd=$(cost_calculate "$input_tokens" "$output_tokens" "$model")
|
|
157
164
|
|
|
165
|
+
# Try SQLite first
|
|
166
|
+
if type db_record_cost &>/dev/null; then
|
|
167
|
+
db_record_cost "$input_tokens" "$output_tokens" "$model" "$stage" "$cost_usd" "$issue" 2>/dev/null || true
|
|
168
|
+
fi
|
|
169
|
+
|
|
170
|
+
# Always write to JSON (dual-write period)
|
|
158
171
|
(
|
|
159
172
|
if command -v flock &>/dev/null; then
|
|
160
173
|
flock -w 10 200 2>/dev/null || { warn "Cost lock timeout"; }
|
|
@@ -197,9 +210,20 @@ cost_check_budget() {
|
|
|
197
210
|
|
|
198
211
|
ensure_cost_dir
|
|
199
212
|
|
|
213
|
+
# Try DB for budget info
|
|
200
214
|
local budget_enabled budget_usd
|
|
201
|
-
|
|
202
|
-
|
|
215
|
+
if type db_get_budget &>/dev/null && type db_available &>/dev/null && db_available 2>/dev/null; then
|
|
216
|
+
local db_budget
|
|
217
|
+
db_budget=$(db_get_budget 2>/dev/null || true)
|
|
218
|
+
if [[ -n "$db_budget" ]]; then
|
|
219
|
+
budget_enabled=$(echo "$db_budget" | cut -d'|' -f2)
|
|
220
|
+
budget_usd=$(echo "$db_budget" | cut -d'|' -f1)
|
|
221
|
+
[[ "$budget_enabled" == "1" ]] && budget_enabled="true"
|
|
222
|
+
fi
|
|
223
|
+
fi
|
|
224
|
+
# Fallback to JSON
|
|
225
|
+
budget_enabled="${budget_enabled:-$(jq -r '.enabled' "$BUDGET_FILE" 2>/dev/null || echo "false")}"
|
|
226
|
+
budget_usd="${budget_usd:-$(jq -r '.daily_budget_usd' "$BUDGET_FILE" 2>/dev/null || echo "0")}"
|
|
203
227
|
|
|
204
228
|
if [[ "$budget_enabled" != "true" || "$budget_usd" == "0" ]]; then
|
|
205
229
|
return 0
|
|
@@ -244,6 +268,17 @@ cost_check_budget() {
|
|
|
244
268
|
cost_remaining_budget() {
|
|
245
269
|
ensure_cost_dir
|
|
246
270
|
|
|
271
|
+
# Try DB for remaining budget (single query)
|
|
272
|
+
if type db_remaining_budget &>/dev/null && type db_available &>/dev/null && db_available 2>/dev/null; then
|
|
273
|
+
local db_result
|
|
274
|
+
db_result=$(db_remaining_budget 2>/dev/null || true)
|
|
275
|
+
if [[ -n "$db_result" ]]; then
|
|
276
|
+
echo "$db_result"
|
|
277
|
+
return 0
|
|
278
|
+
fi
|
|
279
|
+
fi
|
|
280
|
+
|
|
281
|
+
# Fallback to JSON
|
|
247
282
|
local budget_enabled budget_usd
|
|
248
283
|
budget_enabled=$(jq -r '.enabled' "$BUDGET_FILE" 2>/dev/null || echo "false")
|
|
249
284
|
budget_usd=$(jq -r '.daily_budget_usd' "$BUDGET_FILE" 2>/dev/null || echo "0")
|
|
@@ -792,6 +827,12 @@ budget_set() {
|
|
|
792
827
|
|
|
793
828
|
ensure_cost_dir
|
|
794
829
|
|
|
830
|
+
# Write to DB if available
|
|
831
|
+
if type db_set_budget &>/dev/null; then
|
|
832
|
+
db_set_budget "$amount" 2>/dev/null || true
|
|
833
|
+
fi
|
|
834
|
+
|
|
835
|
+
# Always write to JSON (dual-write)
|
|
795
836
|
local tmp_file
|
|
796
837
|
tmp_file=$(mktemp)
|
|
797
838
|
jq --arg amt "$amount" \
|