@webship.co/workspace-azure 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.
@@ -82,3 +82,17 @@ bash cmd-tools-azure.sh <project> --push
82
82
  - One project at a time, named by the person.
83
83
  - What the command prints about a refused credential is a finding: report it, do not work around it.
84
84
  - Say what was not run. A deploy you did not see end is not deployed.
85
+
86
+ ## The book
87
+
88
+ For any automated functional testing in this work (a Gherkin feature, a step definition, choosing a
89
+ step, a test run and its failures), read the book *Automated Functional Testing Recipes* first.
90
+
91
+ - **Where.** Use the first that exists: `.claude/automated-functional-testing-recipes/` in the project,
92
+ `~/.claude/automated-functional-testing-recipes/` (installed by webship/webship-js-ai-agent,
93
+ webship/webship-js-skills or webship/ai-agents), or
94
+ https://github.com/webship/webship-js-ai-agent/tree/2.0.x/automated-functional-testing-recipes
95
+ - **How.** Its `README.md` first, then the chapter that matches the task (one file per chapter,
96
+ named by its subject), not the single complete file.
97
+ - **Which wins.** The installed webship-js package and the step pack are the source of truth for
98
+ 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 Azure, 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-azure.sh <project>
11
12
  stop if it is not linked, and show me the line it prints for linking
@@ -94,3 +94,17 @@ bash core/scripts/plugins.sh --check azure # the commands it
94
94
  - **A deploy is a zip deploy**: the current code is zipped with `git archive` and pushed to the selected slot (`az webapp deploy --type zip`). What is not committed is not in it. It asks before it deploys.
95
95
  - **A deploy is outward-facing.** The command asks before it sends anything, in a terminal: it is
96
96
  not a step for an AI assistant to take on its own.
97
+
98
+ ## The book
99
+
100
+ For any automated functional testing in this work (a Gherkin feature, a step definition, choosing a
101
+ step, a test run and its failures), read the book *Automated Functional Testing Recipes* first.
102
+
103
+ - **Where.** Use the first that exists: `.claude/automated-functional-testing-recipes/` in the project,
104
+ `~/.claude/automated-functional-testing-recipes/` (installed by webship/webship-js-ai-agent,
105
+ webship/webship-js-skills or webship/ai-agents), or
106
+ https://github.com/webship/webship-js-ai-agent/tree/2.0.x/automated-functional-testing-recipes
107
+ - **How.** Its `README.md` first, then the chapter that matches the task (one file per chapter,
108
+ named by its subject), not the single complete file.
109
+ - **Which wins.** The installed webship-js package and the step pack are the source of truth for
110
+ 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-azure",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "description": "Azure App Service for Webship Workspace: the AZURE menu on every site row, the web app and its deployment slots with their URLs, zip deploy, log tail, deployment history. 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
  # azure_do_push <project_path> <id> <env> deploy
12
12
  # azure_do_logs <project_path> <id> <env>
13
13
  # azure_do_activities <project_path> <id>
14
- # azure_status <project_path> <id> the closing status block
14
+ # azure_status <project_path> <id> the closing status block; fails when the provider cannot be reached
15
15
 
16
16
  AZURE_LINK_FILE=".azure/workspace.yml";
17
17
 
@@ -152,7 +152,9 @@ function azure_project_tool() {
152
152
  azure_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), azure_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 Azure";
@@ -165,9 +167,10 @@ function azure_project_tool() {
165
167
  local selected;
166
168
  selected="$(azure_selected_env "${project_path}")";
167
169
  echo " env: ${selected:-none selected — --environments then --select <name>}";
168
- azure_status "${project_path}" "${linked_id}" ;
170
+ azure_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
  }
@@ -42,10 +42,13 @@ function azure_list_environments() {
42
42
  }
43
43
 
44
44
  function azure_do_environments() {
45
- local project_path="$1";
45
+ local project_path="$1" row;
46
+ # Read first, then print: piped straight into awk, a failed az left awk's own success as the answer
47
+ # and an empty list on the screen.
46
48
  # shellcheck disable=SC2046
47
- az webapp show -g "$(azure_rg "${project_path}")" -n "$(azure_app "${project_path}")" $(azure_sub) -o tsv --query '[name, state, defaultHostName]' 2>/dev/null \
48
- | awk '{ printf " %-24s %-10s https://%s\n", "production", tolower($2), $3 }' || { echo " (could not read the web app — check az account show)"; return 1; } ;
49
+ row="$(az webapp show -g "$(azure_rg "${project_path}")" -n "$(azure_app "${project_path}")" $(azure_sub) -o tsv --query '[name, state, defaultHostName]' 2>/dev/null)" && [ -n "${row}" ] \
50
+ || { echo " (could not read the web app — check az account show)"; return 1; } ;
51
+ printf '%s\n' "${row}" | awk '{ printf " %-24s %-10s https://%s\n", "production", tolower($2), $3 }' ;
49
52
  # shellcheck disable=SC2046
50
53
  az webapp deployment slot list -g "$(azure_rg "${project_path}")" -n "$(azure_app "${project_path}")" $(azure_sub) -o tsv --query '[].[name, state, defaultHostName]' 2>/dev/null \
51
54
  | awk '{ printf " %-24s %-10s https://%s\n", $1, tolower($2), $3 }' ;
@@ -80,19 +83,27 @@ function azure_do_activities() {
80
83
  # shellcheck disable=SC2046
81
84
  az webapp log deployment list -g "$(azure_rg "${project_path}")" -n "$(azure_app "${project_path}")" $(azure_sub) -o json 2>/dev/null | python3 -c 'import json,sys
82
85
  for d in json.load(sys.stdin)[:10]:
83
- print(" %-20s %-10s %s" % ((d.get("received_time") or d.get("start_time") or "")[:19], "ok" if d.get("complete") else "running", (d.get("message") or d.get("id") or "")[:60]))' \
86
+ print(" %-20s %-10s %s" % ((d.get("received_time") or d.get("start_time") or "")[:19], "ok" if d.get("complete") else "running", (d.get("message") or d.get("id") or "")[:60]))' 2>/dev/null \
84
87
  || echo " (could not list the deployments)" ;
85
88
  }
86
89
 
87
90
  function azure_status() {
88
- local project_path="$1" id="$2";
91
+ local project_path="$1" id="$2" missing rc=0;
89
92
  if [ -z "${id}" ] ; then
90
93
  echo " (the link is resource-group/web-app-name; az webapp list)";
91
94
  return 0 ;
92
95
  fi
93
96
  echo "";
94
- azure_do_environments "${project_path}" ;
97
+ # Without az or its login nothing below can answer: say once what is missing, in ensure_azure's
98
+ # words, and fail. The link and the console are known here and still show.
99
+ if missing="$(ensure_azure)" ; then
100
+ azure_do_environments "${project_path}" || rc=1 ;
101
+ else
102
+ [ -n "${missing}" ] && sed 's/^/ /' <<< "${missing}" ;
103
+ rc=1 ;
104
+ fi
95
105
  echo "";
96
106
  echo " Console: https://portal.azure.com/ → App Services → $(azure_app "${project_path}")";
97
107
  echo " --push zip-deploys the committed tree to the selected slot; --logs tails it.";
108
+ return ${rc} ;
98
109
  }