@webship.co/workspace-godaddy 1.0.11 → 1.0.13
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.
|
@@ -86,3 +86,17 @@ bash cmd-tools-godaddy.sh <project> --push
|
|
|
86
86
|
- One project at a time, named by the person.
|
|
87
87
|
- What the command prints about a refused credential is a finding: report it, do not work around it.
|
|
88
88
|
- Say what was not run. A deploy you did not see end is not deployed.
|
|
89
|
+
|
|
90
|
+
## The book
|
|
91
|
+
|
|
92
|
+
For any automated functional testing in this work (a Gherkin feature, a step definition, choosing a
|
|
93
|
+
step, a test run and its failures), read the book *Automated Functional Testing Recipes* first.
|
|
94
|
+
|
|
95
|
+
- **Where.** Use the first that exists: `.claude/automated-functional-testing-recipes/` in the project,
|
|
96
|
+
`~/.claude/automated-functional-testing-recipes/` (installed by webship/webship-js-ai-agent,
|
|
97
|
+
webship/webship-js-skills or webship/ai-agents), or
|
|
98
|
+
https://github.com/webship/webship-js-ai-agent/tree/2.0.x/automated-functional-testing-recipes
|
|
99
|
+
- **How.** Its `README.md` first, then the chapter that matches the task (one file per chapter,
|
|
100
|
+
named by its subject), not the single complete file.
|
|
101
|
+
- **Which wins.** The installed webship-js package and the step pack are the source of truth for
|
|
102
|
+
step phrasing. When they differ from the book, follow them and say so.
|
|
@@ -6,6 +6,7 @@ Get the site <project> ready to deploy to GoDaddy, and give me the deploy line
|
|
|
6
6
|
# ~/workspace/<folder> · container-based (DDEV by default) · <folder> is the sites folder of <project>
|
|
7
7
|
# do not deploy: the deploy asks for a confirmation in a terminal and that is mine to give
|
|
8
8
|
# never print a token or a key; link nothing, pull nothing
|
|
9
|
+
# a feature to write or a run to read: the book Automated Functional Testing Recipes first (its README.md, then the matching chapter), from .claude/automated-functional-testing-recipes/ in the project, ~/.claude/automated-functional-testing-recipes/ or https://github.com/webship/webship-js-ai-agent/tree/2.0.x/automated-functional-testing-recipes
|
|
9
10
|
|
|
10
11
|
1. cd ~/workspace/<folder> ; bash cmd-tools-godaddy.sh <project>
|
|
11
12
|
stop if it is not linked, and show me the line it prints for linking
|
|
@@ -106,3 +106,17 @@ bash core/scripts/plugins.sh --check godaddy # the commands
|
|
|
106
106
|
- **An environment here is a host name**: the linked domain, or one of its A or CNAME records.
|
|
107
107
|
- **A deploy is outward-facing.** The command asks before it sends anything, in a terminal: it is
|
|
108
108
|
not a step for an AI assistant to take on its own.
|
|
109
|
+
|
|
110
|
+
## The book
|
|
111
|
+
|
|
112
|
+
For any automated functional testing in this work (a Gherkin feature, a step definition, choosing a
|
|
113
|
+
step, a test run and its failures), read the book *Automated Functional Testing Recipes* first.
|
|
114
|
+
|
|
115
|
+
- **Where.** Use the first that exists: `.claude/automated-functional-testing-recipes/` in the project,
|
|
116
|
+
`~/.claude/automated-functional-testing-recipes/` (installed by webship/webship-js-ai-agent,
|
|
117
|
+
webship/webship-js-skills or webship/ai-agents), or
|
|
118
|
+
https://github.com/webship/webship-js-ai-agent/tree/2.0.x/automated-functional-testing-recipes
|
|
119
|
+
- **How.** Its `README.md` first, then the chapter that matches the task (one file per chapter,
|
|
120
|
+
named by its subject), not the single complete file.
|
|
121
|
+
- **Which wins.** The installed webship-js package and the step pack are the source of truth for
|
|
122
|
+
step phrasing. When they differ from the book, follow them and say so.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webship.co/workspace-godaddy",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"description": "GoDaddy for Webship Workspace: the GODADDY menu on every site row, the domain and its DNS from the GoDaddy API, the hosting account over SSH (get database and files, deploy with rsync, the error log), the GoDaddy console. It carries its AI items, each placed in the workspace folder of its kind: an agent, a skill, a command and a prompt. A provider of @webship.co/workspace-hosting.",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
# godaddy_do_push <project_path> <id> <env> deploy
|
|
12
12
|
# godaddy_do_logs <project_path> <id> <env>
|
|
13
13
|
# godaddy_do_activities <project_path> <id>
|
|
14
|
-
# godaddy_status <project_path> <id> the closing status block
|
|
14
|
+
# godaddy_status <project_path> <id> the closing status block; fails when the provider cannot be reached
|
|
15
15
|
|
|
16
16
|
GODADDY_LINK_FILE=".godaddy/workspace.yml";
|
|
17
17
|
|
|
@@ -152,7 +152,9 @@ function godaddy_project_tool() {
|
|
|
152
152
|
godaddy_do_activities "${project_path}" "${linked_id}" || true ;
|
|
153
153
|
fi
|
|
154
154
|
|
|
155
|
-
# Default (and after any verb): status.
|
|
155
|
+
# Default (and after any verb): status. The local part always shows; when the provider cannot be
|
|
156
|
+
# reached (no CLI, no login, no token), godaddy_status says what is missing and the run fails.
|
|
157
|
+
local status_rc=0;
|
|
156
158
|
echo "";
|
|
157
159
|
echo "*---------------------------------------------------------------------*";
|
|
158
160
|
echo " ${doc_name}/${PROJECT_NAME} on GoDaddy";
|
|
@@ -165,9 +167,10 @@ function godaddy_project_tool() {
|
|
|
165
167
|
local selected;
|
|
166
168
|
selected="$(godaddy_selected_env "${project_path}")";
|
|
167
169
|
echo " env: ${selected:-none selected — --environments then --select <name>}";
|
|
168
|
-
godaddy_status "${project_path}" "${linked_id}" ;
|
|
170
|
+
godaddy_status "${project_path}" "${linked_id}" || status_rc=1 ;
|
|
169
171
|
fi
|
|
170
172
|
echo "*---------------------------------------------------------------------*";
|
|
171
173
|
|
|
172
174
|
cd "${WORKSPACE_ROOT}/${doc_name}";
|
|
175
|
+
return ${status_rc} ;
|
|
173
176
|
}
|
|
@@ -6,15 +6,31 @@
|
|
|
6
6
|
# --link, --push, --pull-db and --pull-files each demand their flag, and nothing here ever changes
|
|
7
7
|
# a DNS record.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
# One value of core/config/plugin.godaddy.settings.yml, read the way scripts/host-install.sh reads it
|
|
10
|
+
# (quotes and a trailing comment stripped), or nothing: an empty value or CHANGE_ME is not set. The
|
|
11
|
+
# command parses only its folder's settings and the menu's verbs run it with no extra environment, so
|
|
12
|
+
# this file is where a run finds what the Settings page wrote.
|
|
13
|
+
function godaddy_setting() {
|
|
14
|
+
local file="${WORKSPACE_CONFIG}/plugin.godaddy.settings.yml" value;
|
|
15
|
+
[ -f "${file}" ] || return 0 ;
|
|
16
|
+
value="$(grep -E "^$1:" "${file}" | head -1 | sed -E 's/^[a-z_]+:[[:space:]]*//; s/[[:space:]]+#.*$//; s/[[:space:]]+$//')";
|
|
17
|
+
value="${value#[\"\']}"; value="${value%[\"\']}";
|
|
18
|
+
[ "${value}" == 'CHANGE_ME' ] && value="";
|
|
19
|
+
printf '%s' "${value}" ;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
# The dashboard hands its own jobs GODADDY_API_KEY, GODADDY_API_SECRET and GODADDY_SSH_KEY, which win.
|
|
23
|
+
function godaddy_key() { printf '%s' "${GODADDY_API_KEY:-$(godaddy_setting api_key)}" ; }
|
|
24
|
+
function godaddy_secret() { printf '%s' "${GODADDY_API_SECRET:-$(godaddy_setting api_secret)}" ; }
|
|
25
|
+
function godaddy_ssh_key() { local k="${GODADDY_SSH_KEY:-$(godaddy_setting ssh_key)}"; k="${k:-~/.ssh/id_ed25519}"; printf '%s' "${k/#\~/${HOME}}" ; }
|
|
12
26
|
|
|
13
27
|
function ensure_godaddy() {
|
|
28
|
+
local key secret;
|
|
14
29
|
for tool in curl python3 ; do
|
|
15
30
|
command -v "${tool}" > /dev/null 2>&1 || { echo "${tool} is not installed, and the GoDaddy tool needs it."; return 1; } ;
|
|
16
31
|
done
|
|
17
|
-
|
|
32
|
+
key="$(godaddy_key)"; secret="$(godaddy_secret)";
|
|
33
|
+
if [ -z "${key}" ] || [ "${key}" == 'CHANGE_ME' ] || [ -z "${secret}" ] || [ "${secret}" == 'CHANGE_ME' ] ; then
|
|
18
34
|
echo "No GoDaddy API key: set api_key and api_secret in core/config/plugin.godaddy.settings.yml (developer.godaddy.com → API Keys, production)." ;
|
|
19
35
|
return 1 ;
|
|
20
36
|
fi
|
|
@@ -22,14 +38,18 @@ function ensure_godaddy() {
|
|
|
22
38
|
}
|
|
23
39
|
|
|
24
40
|
function godaddy_api() {
|
|
25
|
-
|
|
41
|
+
local key secret;
|
|
42
|
+
key="$(godaddy_key)"; secret="$(godaddy_secret)";
|
|
43
|
+
# Never a request without the key and its secret: it would leave this machine for nothing.
|
|
44
|
+
[ -n "${key}" ] && [ -n "${secret}" ] || return 1 ;
|
|
45
|
+
curl -sS -m 30 -H "Authorization: sso-key ${key}:${secret}" -H "Accept: application/json" "https://api.godaddy.com/v1/$1" ;
|
|
26
46
|
}
|
|
27
47
|
|
|
28
48
|
# domain[,user@host:/remote/docroot]
|
|
29
49
|
function godaddy_do_link() {
|
|
30
50
|
local project_path="$1" spec="$2" domain ssh user host remote;
|
|
31
51
|
domain="${spec%%,*}"; ssh="${spec#*,}"; [ "${ssh}" == "${spec}" ] && ssh="";
|
|
32
|
-
godaddy_api "domains/${domain}" | python3 -c 'import json,sys; d=json.load(sys.stdin); sys.exit(1 if d.get("code") else 0)' \
|
|
52
|
+
godaddy_api "domains/${domain}" | python3 -c 'import json,sys; d=json.load(sys.stdin); sys.exit(1 if d.get("code") else 0)' 2>/dev/null \
|
|
33
53
|
|| { echo "The GoDaddy account does not have ${domain} (or the key cannot see it)."; return 1; } ;
|
|
34
54
|
godaddy_link_set "${project_path}" id "${domain}" ;
|
|
35
55
|
godaddy_link_set "${project_path}" env "${domain}" ;
|
|
@@ -59,9 +79,10 @@ for r in json.load(sys.stdin):
|
|
|
59
79
|
function godaddy_do_environments() {
|
|
60
80
|
local domain="$2";
|
|
61
81
|
godaddy_api "domains/${domain}" | python3 -c 'import json,sys
|
|
62
|
-
d=json.load(sys.stdin)
|
|
82
|
+
try: d=json.load(sys.stdin)
|
|
83
|
+
except ValueError: print(" (no answer from the GoDaddy API for %s)" % sys.argv[1]); sys.exit(1)
|
|
63
84
|
if d.get("code"): print(" " + str(d.get("message", d["code"]))); sys.exit(1)
|
|
64
|
-
print(" %-40s %-10s expires %s ns %s" % (d.get("domain",""), (d.get("status") or "").lower(), (d.get("expires") or "")[:10], ", ".join(d.get("nameServers") or [])))' || return 1 ;
|
|
85
|
+
print(" %-40s %-10s expires %s ns %s" % (d.get("domain",""), (d.get("status") or "").lower(), (d.get("expires") or "")[:10], ", ".join(d.get("nameServers") or [])))' "${domain}" 2>/dev/null || return 1 ;
|
|
65
86
|
godaddy_api "domains/${domain}/records" | python3 -c 'import json,sys
|
|
66
87
|
for r in json.load(sys.stdin):
|
|
67
88
|
if r.get("type") in ("A","CNAME"):
|
|
@@ -139,20 +160,29 @@ function godaddy_do_logs() {
|
|
|
139
160
|
|
|
140
161
|
function godaddy_do_dns() {
|
|
141
162
|
godaddy_api "domains/$2/records" | python3 -c 'import json,sys
|
|
142
|
-
for r in json.load(sys.stdin): print(" %-6s %-30s %-40s ttl %s" % (r.get("type",""), r.get("name",""), r.get("data",""), r.get("ttl","")))'
|
|
163
|
+
for r in json.load(sys.stdin): print(" %-6s %-30s %-40s ttl %s" % (r.get("type",""), r.get("name",""), r.get("data",""), r.get("ttl","")))' 2>/dev/null \
|
|
164
|
+
|| { echo " (could not list the DNS records of $2)"; return 1; } ;
|
|
143
165
|
}
|
|
144
166
|
|
|
145
167
|
function godaddy_status() {
|
|
146
|
-
local project_path="$1" domain="$2";
|
|
168
|
+
local project_path="$1" domain="$2" missing rc=0;
|
|
147
169
|
if [ -z "${domain}" ] ; then
|
|
148
170
|
echo " (the link is the domain, optionally ,user@host:/remote/docroot for the hosting)";
|
|
149
171
|
return 0 ;
|
|
150
172
|
fi
|
|
151
173
|
echo " hosting: $(godaddy_link_get "${project_path}" ssh):$(godaddy_link_get "${project_path}" remote)";
|
|
152
174
|
echo "";
|
|
153
|
-
|
|
154
|
-
|
|
175
|
+
# The domain and its DNS come from the GoDaddy API: without curl, python3 or the key, say once what
|
|
176
|
+
# is missing, in ensure_godaddy's words, call nothing, and fail. The link and the console still show.
|
|
177
|
+
if missing="$(ensure_godaddy)" ; then
|
|
178
|
+
godaddy_do_environments "${project_path}" "${domain}" || rc=1 ;
|
|
179
|
+
if [ "${DNS:-no}" == 'yes' ] && [ "${rc}" == 0 ] ; then echo ""; godaddy_do_dns "${project_path}" "${domain}" || rc=1 ; fi
|
|
180
|
+
else
|
|
181
|
+
[ -n "${missing}" ] && sed 's/^/ /' <<< "${missing}" ;
|
|
182
|
+
rc=1 ;
|
|
183
|
+
fi
|
|
155
184
|
echo "";
|
|
156
185
|
echo " Console: https://dcc.godaddy.com/control/portfolio/${domain}/settings";
|
|
157
186
|
echo " Data: --pull-db and --pull-files bring the site down into DDEV over SSH; --push deploys with rsync.";
|
|
187
|
+
return ${rc} ;
|
|
158
188
|
}
|