@cratis/pi 7.170.7 → 7.170.9

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.
@@ -759,6 +759,11 @@ function base(word) { sub(/^.*\//, "", word); return word }
759
759
  function member(list, word) { return index(" " list " ", " " word " ") > 0 }
760
760
  function destructive(word) { return member("rm rmdir unlink shred mv", base(word)) }
761
761
  function shell(word) { return member("sh bash dash zsh ksh ash", base(word)) }
762
+ # Command-head recognition is shared by dispatch and directory tracking. time retains
763
+ # its option-aware wrapper handling below; grouping delimiters also split segments.
764
+ function command_prefix(word) {
765
+ return word ~ /^[A-Za-z_][A-Za-z0-9_]*=/ || member("then do else elif ! if while until { ( coproc", word)
766
+ }
762
767
  # Only these established execution prefixes expose another command position.
763
768
  function wrapper(word) {
764
769
  return member("sudo doas env command builtin exec nohup nice ionice timeout time stdbuf xargs setsid chroot nsenter busybox", base(word))
@@ -809,30 +814,77 @@ function arithmetic_prefix(text, i, quoted) {
809
814
  if (!quoted && substr(text, i, 2) == "((") return i + 2
810
815
  return 0
811
816
  }
812
- # Expand only the documented literal prefixes; never evaluate shell text.
813
- function resolved(word, quoted, cwd, uncertain, suffix, rest) {
814
- if (word ~ /^\$PWD(\/|$)/) word = cwd substr(word, 5)
815
- else if (word ~ /^\$\{PWD\}(\/|$)/) word = cwd substr(word, 7)
816
- else if (word ~ /^\$HOME(\/|$)/) word = ENVIRON["HOME"] substr(word, 6)
817
- else if (word ~ /^\$\{HOME\}(\/|$)/) word = ENVIRON["HOME"] substr(word, 8)
818
- else if (!quoted && word ~ /^~(\/|$)/) word = ENVIRON["HOME"] substr(word, 2)
819
- else if (!quoted && word ~ /^~\+(\/|$)/) word = cwd substr(word, 3)
820
- else if (!quoted && word ~ /^~/) return "!"
821
- if (word ~ /[$`]/) {
822
- # A variable prefix with a literal suffix is not evidence of a root operand.
823
- rest = word
824
- if (rest ~ /^\$\{[A-Za-z_][A-Za-z0-9_]*\}\//) sub(/^\$\{[A-Za-z_][A-Za-z0-9_]*\}\//, "", rest)
825
- else if (rest ~ /^\$[A-Za-z_][A-Za-z0-9_]*\//) sub(/^\$[A-Za-z_][A-Za-z0-9_]*\//, "", rest)
826
- else return "!"
827
- if (rest == "" || rest ~ /[$`]/) return "!"
828
- word = rest
817
+ # Exceptions need a whole-tool simple command, not a guess about earlier mutations.
818
+ # Quoted parentheses and parameter braces remain word data in the lexer.
819
+ function simple_command(text, d, n, i, head) {
820
+ head = base(W[d, 1])
821
+ if (!destructive(head) && head != "git" && head != "find") return 0
822
+ if (text ~ /`|\$\(/) return 0
823
+ for (i = 1; i <= n; i++) {
824
+ if (BC[d, i] || (K[d, i] != "word" && K[d, i] !~ /^(>|>>|>&|&>|&>>|<|<&)$/)) return 0
829
825
  }
826
+ return 1
827
+ }
828
+ function unquoted_expansion(raw, i, c, quote) {
829
+ for (i = 1; i <= length(raw); i++) {
830
+ c = substr(raw, i, 1)
831
+ if (c == "\\" && quote != "\047") { i++; continue }
832
+ if (quote != "") { if (c == quote) quote = ""; continue }
833
+ if (c == "\047" || c == "\"") { quote = c; continue }
834
+ if (c == "*" || c == "?" || c == "[" || c == "$" || c == "`") return 1
835
+ }
836
+ return 0
837
+ }
838
+ # Raw-source proof excludes splitting and mixed unquoted globs. A value of 2
839
+ # marks quoted predicate data, not an eligible environment path prefix.
840
+ function quoted_prefix(raw) {
841
+ if (raw ~ /^~/) return !unquoted_expansion(raw)
842
+ if (raw ~ /^"\$(\{(PWD|HOME|TMPDIR)\}|PWD|HOME|TMPDIR)(\/|")/ && !unquoted_expansion(raw)) return 1
843
+ return (raw ~ /^"[^"]*"$/ || raw ~ /^\047[^\047]*\047$/) ? 2 : 0
844
+ }
845
+ # Only raw, unquoted ~+ with a literal suffix can establish the initial cwd.
846
+ function literal_current_directory(raw, word) {
847
+ return raw == word && word ~ /^~\+(\/|$)/ && substr(word, 3) !~ /[$`~*?\[{}]/
848
+ }
849
+ # A destructive expansion exception must name only real descendant components.
850
+ function descendant_suffix(suffix, parts, count, i) {
851
+ if (suffix !~ /^\// || suffix ~ /[$`*?\[{}~]/ || index(suffix, "]") || index(suffix, "\\")) return 0
852
+ gsub(/\/+/, "/", suffix)
853
+ sub(/\/$/, "", suffix)
854
+ count = split(substr(suffix, 2), parts, "/")
855
+ if (!count) return 0
856
+ for (i = 1; i <= count; i++) {
857
+ if (parts[i] == "" || parts[i] == "." || parts[i] == "..") return 0
858
+ }
859
+ return 1
860
+ }
861
+ function environment_prefix(word, require_descendant, name, suffix, end) {
862
+ if (word ~ /^\$\{(PWD|HOME|TMPDIR)\}(\/|$)/) {
863
+ end = index(word, "}"); name = substr(word, 3, end - 3); suffix = substr(word, end + 1)
864
+ } else if (word ~ /^\$(PWD|HOME|TMPDIR)(\/|$)/) {
865
+ name = substr(word, 2); sub(/\/.*/, "", name); suffix = substr(word, length(name) + 2)
866
+ } else return "!"
867
+ if (require_descendant && !descendant_suffix(suffix)) return "!"
868
+ return (name == "PWD" ? ENVIRON["GSW_CWD"] : ENVIRON[name]) suffix
869
+ }
870
+ function resolved(word, quoted, cwd, uncertain, double_quoted, ordinary, expanded, suffix) {
871
+ expanded = word ~ /^\$/ || (!quoted && word ~ /^~/)
872
+ if (expanded && !ordinary && (!exception_allowed || double_quoted != 1)) return "!"
873
+ if (word ~ /^\$/) word = double_quoted == 1 ? environment_prefix(word, !ordinary) : "!"
874
+ else if (!quoted && word ~ /^~(\/|$)/) {
875
+ suffix = substr(word, 2)
876
+ word = ordinary || descendant_suffix(suffix) ? ENVIRON["HOME"] suffix : "!"
877
+ } else if (!quoted && word ~ /^~\+(\/|$)/) {
878
+ suffix = substr(word, 3)
879
+ word = ordinary || descendant_suffix(suffix) ? ENVIRON["GSW_CWD"] suffix : "!"
880
+ } else if (!quoted && word ~ /^~/) return "!"
881
+ if (word == "!" || word ~ /[$`]/ || (expanded && word ~ /^-/)) return "!"
830
882
  if (word ~ /^\//) return word
831
883
  if (uncertain) return "!"
832
884
  return cwd "/" word
833
885
  }
834
- function operand(word, quoted, cwd, uncertain) {
835
- if (word != "" && word != "{}") emit(resolved(word, quoted, cwd, uncertain))
886
+ function operand(word, quoted, cwd, uncertain, double_quoted) {
887
+ if (word != "" && word != "{}") emit(resolved(word, quoted, cwd, uncertain, double_quoted))
836
888
  }
837
889
  # Heredoc delimiters are quote-removed, never expanded or executed.
838
890
  function heredoc_word(text, start, i, c, quote, word, active) {
@@ -914,10 +966,11 @@ function data_substitutions(text, d, word, i, c, body, k) {
914
966
  }
915
967
  }
916
968
  }
917
- function lex(text, d, i, c, nextc, quote, word, quoted, active, n, body, k, pending, delimiter, strip, hd_index, end) {
969
+ function lex(text, d, i, c, nextc, quote, word, quoted, active, n, body, k, pending, delimiter, strip, hd_index, end, word_start) {
918
970
  n = 0; quote = ""; word = ""; active = 0; quoted = 0; pending = 0
919
971
  for (i = 1; i <= length(text); i++) {
920
972
  c = substr(text, i, 1); nextc = substr(text, i + 1, 1)
973
+ if (!active) word_start = i
921
974
  if (quote != "\047" && (k = arithmetic_prefix(text, i, quote != ""))) {
922
975
  body = arithmetic(text, k, arithmetic_bracket); unclassified(body)
923
976
  i = arithmetic_end; word = word "$__arithmetic"; active = 1; continue
@@ -949,7 +1002,7 @@ function lex(text, d, i, c, nextc, quote, word, quoted, active, n, body, k, p
949
1002
  }
950
1003
  if (c == "{" && nextc == "}") { word = word "{}"; i++; active = 1; continue }
951
1004
  if (c ~ /[ \t\r\n;&|(){}<>]/) {
952
- if (active) { W[d, ++n] = word; Q[d, n] = quoted; K[d, n] = "word"; T[d, n] = i - 1; F[d, n] = !quoted && word ~ /^[0-9]+$/ && substr(text, i - length(word), length(word)) == word; word = ""; active = quoted = 0 }
1005
+ if (active) { W[d, ++n] = word; Q[d, n] = quoted; DQ[d, n] = quoted_prefix(substr(text, word_start, i - word_start)); CT[d, n] = literal_current_directory(substr(text, word_start, i - word_start), word); K[d, n] = "word"; T[d, n] = i - 1; F[d, n] = !quoted && word ~ /^[0-9]+$/ && substr(text, i - length(word), length(word)) == word; word = ""; active = quoted = 0 }
953
1006
  if (c ~ /[ \t\r]/) continue
954
1007
  if (c == "<" && nextc == "<") {
955
1008
  if (substr(text, i, 3) == "<<<") { W[d, ++n] = "<<<"; K[d, n] = "<<<"; T[d, n] = i; i += 2; continue }
@@ -984,7 +1037,7 @@ function lex(text, d, i, c, nextc, quote, word, quoted, active, n, body, k, p
984
1037
  }
985
1038
  word = word c; active = 1
986
1039
  }
987
- if (active) { W[d, ++n] = word; Q[d, n] = quoted; K[d, n] = "word" }
1040
+ if (active) { W[d, ++n] = word; Q[d, n] = quoted; DQ[d, n] = quoted_prefix(substr(text, word_start)); CT[d, n] = literal_current_directory(substr(text, word_start), word); K[d, n] = "word" }
988
1041
  if (quote != "" || pending) unclassified(remaining(d, 1, n))
989
1042
  return n
990
1043
  }
@@ -1019,7 +1072,7 @@ function wrapper_flag(program, option) {
1019
1072
  # Dispatch uses an argv copy, never shell source. Every prefix shares the same
1020
1073
  # redirection tail and inherited pipe input; splitting env argv cannot discard either.
1021
1074
  function copy_token(source, from, dest, to, j) {
1022
- W[dest, to] = W[source, from]; Q[dest, to] = Q[source, from]; K[dest, to] = K[source, from]
1075
+ W[dest, to] = W[source, from]; Q[dest, to] = Q[source, from]; DQ[dest, to] = DQ[source, from]; K[dest, to] = K[source, from]
1023
1076
  H[dest, to] = H[source, from]; T[dest, to] = T[source, from]; F[dest, to] = F[source, from]
1024
1077
  BC[dest, to] = BC[source, from]
1025
1078
  for (j = 1; j <= BC[source, from]; j++) B[dest, to, j] = B[source, from, j]
@@ -1079,7 +1132,7 @@ function env_words(text, slot, i, c, nextc, quote, word, active, n) {
1079
1132
  function executable(d, start, end, i, j, program, option, split_at, text, slot, count, first, expansions) {
1080
1133
  prefix_uncertain = 0; prefix_fed = 0; dispatch_end = end; i = start
1081
1134
  while (i <= end) {
1082
- if (W[d, i] ~ /^[A-Za-z_][A-Za-z0-9_]*=/) { i++; continue }
1135
+ if (command_prefix(W[d, i])) { i++; continue }
1083
1136
  program = base(W[d, i])
1084
1137
  if (!wrapper(program)) return redirection(d, i) ? 0 : i
1085
1138
  if (member("chroot nsenter", program)) prefix_uncertain = 1
@@ -1123,7 +1176,7 @@ function removal(d, verb, end, cwd, uncertain, findpaths, i, w, count, option
1123
1176
  if (w ~ /^--target-directory=/ || w ~ /^-t./) { target = 1; continue }
1124
1177
  }
1125
1178
  if (options && w ~ /^-/) continue
1126
- O[d, ++count] = w; OQ[d, count] = Q[d, i]
1179
+ O[d, ++count] = w; OQ[d, count] = Q[d, i]; ODQ[d, count] = DQ[d, i]
1127
1180
  }
1128
1181
  if (base(W[d, verb]) == "mv" && !target) count--
1129
1182
  for (j = 1; j <= count; j++) {
@@ -1131,7 +1184,7 @@ function removal(d, verb, end, cwd, uncertain, findpaths, i, w, count, option
1131
1184
  if (w == "{}") {
1132
1185
  if (findpaths != "") emit(findpaths)
1133
1186
  else emit("!")
1134
- } else operand(w, OQ[d, j], cwd, uncertain)
1187
+ } else operand(w, OQ[d, j], cwd, uncertain, ODQ[d, j])
1135
1188
  sources++
1136
1189
  }
1137
1190
  }
@@ -1140,7 +1193,7 @@ function git_clean(d, verb, end, cwd, uncertain, findpaths, depth, fed, i, j,
1140
1193
  for (i = verb + 1; i <= end; i++) {
1141
1194
  w = W[d, i]
1142
1195
  if (w == "-C") {
1143
- cwd = resolved(W[d, ++i], Q[d, i], cwd, uncertain)
1196
+ cwd = resolved(W[d, ++i], Q[d, i], cwd, uncertain, DQ[d, i])
1144
1197
  if (cwd == "!") uncertain = 1
1145
1198
  } else if (w == "-c") {
1146
1199
  alias = W[d, ++i]
@@ -1148,8 +1201,9 @@ function git_clean(d, verb, end, cwd, uncertain, findpaths, depth, fed, i, j,
1148
1201
  name = alias; sub(/^alias\./, "", name); sub(/=.*/, "", name)
1149
1202
  sub(/^[^=]*=/, "", alias); A[call, name] = alias
1150
1203
  }
1204
+ } else if (w ~ /[$`]/) { emit("!"); return }
1151
1205
  # Git 2.50.1 git.c handle_options(), plus legacy --super-prefix.
1152
- } else if (member("--git-dir --work-tree --namespace --config-env --attr-source --super-prefix --shallow-file", w)) i++
1206
+ else if (member("--git-dir --work-tree --namespace --config-env --attr-source --super-prefix --shallow-file", w)) i++
1153
1207
  else if (w ~ /^--(git-dir|work-tree|namespace|config-env|attr-source|super-prefix|exec-path)=/) continue
1154
1208
  else if (member("-h --help -v --version --html-path --man-path --info-path --exec-path", w) || w ~ /^--list-cmds=/) return
1155
1209
  else if (member("-p --paginate -P --no-pager --no-replace-objects --no-lazy-fetch --no-optional-locks --no-advice --bare --literal-pathspecs --no-literal-pathspecs --glob-pathspecs --noglob-pathspecs --icase-pathspecs", w)) continue
@@ -1171,6 +1225,9 @@ function git_clean(d, verb, end, cwd, uncertain, findpaths, depth, fed, i, j,
1171
1225
  for (i = subcommand + 1; i <= end; i++) {
1172
1226
  w = W[d, i]
1173
1227
  if (K[d, i] ~ /^[<>]/) break
1228
+ # An expansion may supply Git options, even when shell-quoted. Only an
1229
+ # eligible, fully double-quoted environment path has a proven argv shape.
1230
+ if (w ~ /[$`]/ && (!DQ[d, i] || resolved(w, Q[d, i], cwd, uncertain, DQ[d, i]) == "!")) { emit("!"); return }
1174
1231
  if (!skip && w == "--") { skip = 1; continue }
1175
1232
  if (!skip && w == "--exclude") { i++; continue }
1176
1233
  if (!skip && w ~ /^--exclude=/) continue
@@ -1193,7 +1250,7 @@ function git_clean(d, verb, end, cwd, uncertain, findpaths, depth, fed, i, j,
1193
1250
  if (w ~ /^:\// || w ~ /^:\(top/) emit(ENVIRON["GSW_ROOT"])
1194
1251
  else if (w ~ /^:\(/) emit("!")
1195
1252
  else if (w == "{}" && findpaths != "") emit(findpaths)
1196
- else operand(w, Q[d, i], cwd, uncertain)
1253
+ else operand(w, Q[d, i], cwd, uncertain, DQ[d, i])
1197
1254
  }
1198
1255
  if (!paths) operand(".", 0, cwd, uncertain)
1199
1256
  }
@@ -1202,14 +1259,24 @@ function find_command(d, verb, end, cwd, uncertain, depth, fed, i, j, start,
1202
1259
  for (i = verb + 1; i <= end; i++) {
1203
1260
  w = W[d, i]
1204
1261
  if (member("-H -L -P", w)) continue
1262
+ # A bare expanded word may be a predicate rather than a starting path;
1263
+ # an unquoted expansion can additionally supply several argument words.
1264
+ if (w ~ /[$`]/ && (!Q[d, i] || (w !~ /\// && environment_prefix(w) == "!"))) { emit("!"); return }
1205
1265
  if (w ~ /^-/ || w == "!" || w == "(") break
1206
- p = resolved(w, Q[d, i], cwd, uncertain)
1266
+ p = resolved(w, Q[d, i], cwd, uncertain, DQ[d, i])
1207
1267
  FP[depth, ++have] = p
1208
1268
  }
1209
1269
  if (!have) FP[depth, ++have] = resolved(".", 0, cwd, uncertain)
1210
1270
  for (j = 1; j <= have; j++) paths = paths (j == 1 ? "" : "\n") FP[depth, j]
1211
1271
  for (; i <= end; i++) {
1212
1272
  w = W[d, i]
1273
+ # Arguments to known predicates are data, not possible injected actions.
1274
+ if (member("-name -iname -path -ipath -wholename -iwholename -regex -iregex -lname -ilname -type -xtype -size -user -group -uid -gid -perm -mtime -atime -ctime -mmin -amin -cmin -newer -newermt -maxdepth -mindepth -printf -fprint -fprint0 -samefile -links -inum -fstype -used -context", w)) {
1275
+ i++
1276
+ if (W[d, i] ~ /[$`]/ && !DQ[d, i]) { emit("!"); return }
1277
+ continue
1278
+ }
1279
+ if (w ~ /[$`]/) { emit("!"); return }
1213
1280
  if (w == "-delete") deleted = 1
1214
1281
  if (member("-exec -execdir -ok -okdir", w)) {
1215
1282
  start = i + 1
@@ -1324,13 +1391,17 @@ function shell_command(d, head, end, cwd, uncertain, depth, pipe, fed, i, j,
1324
1391
  script = stdin_data(d, head + 1, end, pipe)
1325
1392
  if (script != "") parse(script, cwd, uncertain, depth + 1, fed)
1326
1393
  }
1327
- function segment(d, start, end, cwd, uncertain, depth, findpaths, pipe, fed, outgoing, head, i, j, k, w, script, context) {
1394
+ function segment(d, start, end, cwd, uncertain, depth, findpaths, pipe, fed, outgoing, head, i, j, k, w, script, context, target) {
1328
1395
  if (start > end) return ""
1396
+ exception_allowed = simple_tool && d == 0 && start == 1 && end == N[0]
1329
1397
  # Substitutions/redirections execute in the calling shell, even for unknown programs.
1330
1398
  if (depth > 4) unclassified(remaining(d, start, end))
1331
1399
  for (i = start; depth <= 4 && i <= end; i++) {
1332
1400
  for (k = 1; k <= BC[d, i]; k++) parse(B[d, i, k], cwd, uncertain, depth + 1, 0)
1333
- if ((K[d, i] == ">" || K[d, i] == "&>") && i < end && W[d, i + 1] !~ /[$`]/ && W[d, i + 1] != "/dev/null") operand(W[d, i + 1], Q[d, i + 1], cwd, uncertain)
1401
+ if ((K[d, i] == ">" || K[d, i] == "&>") && i < end && W[d, i + 1] !~ /[$`]/ && W[d, i + 1] != "/dev/null") {
1402
+ target = resolved(W[d, i + 1], Q[d, i + 1], cwd, uncertain, DQ[d, i + 1], 1)
1403
+ emit(target)
1404
+ }
1334
1405
  }
1335
1406
  d = dispatch(d, start, end); head = dispatch_head; end = dispatch_end
1336
1407
  context = uncertain || prefix_uncertain; fed = fed || prefix_fed
@@ -1358,22 +1429,31 @@ function segment(d, start, end, cwd, uncertain, depth, findpaths, pipe, fed, out
1358
1429
  function parse(text, cwd, uncertain, depth, fed, n, i, start, kind, level, head, path, old, j, pipe, data) {
1359
1430
  # Lex before the depth fallback so properly terminated heredoc bodies stay data.
1360
1431
  # A depth slot may be reused by several script words.
1361
- for (i = 1; i <= N[depth]; i++) { delete W[depth, i]; delete Q[depth, i]; delete K[depth, i]; delete H[depth, i]; delete T[depth, i]; delete F[depth, i]; BC[depth, i] = 0 }
1432
+ for (i = 1; i <= N[depth]; i++) { delete W[depth, i]; delete Q[depth, i]; delete DQ[depth, i]; delete CT[depth, i]; delete K[depth, i]; delete H[depth, i]; delete T[depth, i]; delete F[depth, i]; BC[depth, i] = 0 }
1362
1433
  n = lex(text, depth); N[depth] = n; start = 1; level = 0
1434
+ if (depth == 0) simple_tool = simple_command(text, depth, n)
1363
1435
  for (i = 1; i <= n + 1; i++) {
1364
1436
  kind = K[depth, i]
1365
1437
  if (i <= n && kind != ";" && kind != "\n" && kind != "&" && kind != "&&" && kind != "|" && kind != "|&" && kind != "||" && kind != "(" && kind != ")" && kind != "{" && kind != "}") continue
1366
1438
  data = segment(depth, start, i - 1, cwd, uncertain, depth, "", pipe, fed, kind)
1367
1439
  pipe = (kind == "|" || kind == "|&" ? data : "")
1368
1440
  head = start
1369
- while (head < i && W[depth, head] ~ /^[A-Za-z_][A-Za-z0-9_]*=/) head++
1441
+ while (head < i && command_prefix(W[depth, head])) head++
1370
1442
  if (kind != "|" && kind != "|&" && member("cd pushd popd", W[depth, head])) {
1371
- path = W[depth, head + 1]
1372
- if (path == "--") path = W[depth, head + 2]
1373
- if (W[depth, head] == "popd" || path == "" || path == "-") uncertain = 1
1443
+ old = ""
1444
+ for (j = head + 1; j < i; j++) {
1445
+ if (K[depth, j] == "word" && W[depth, j] ~ /^-/) { old = "!"; break }
1446
+ }
1447
+ j = head + 1
1448
+ path = W[depth, j]
1449
+ if (old == "!" || W[depth, head] == "popd" || path == "") uncertain = 1
1374
1450
  else {
1375
- if (path ~ /[$`]/ && path !~ /^\$(PWD|HOME)(\/|$)/ && path !~ /^\$\{(PWD|HOME)\}(\/|$)/) old = "!"
1376
- else old = resolved(path, Q[depth, head + 1], cwd, uncertain)
1451
+ # The sole expansion proof is an initial, top-level cd ~+/literal.
1452
+ # Nested/later destinations never consult an environment prefix.
1453
+ if (depth == 0 && level == 0 && start == 1 && head == 1 && W[depth, head] == "cd" && CT[depth, j] && !uncertain) old = ENVIRON["GSW_CWD"] substr(path, 3)
1454
+ else if (path ~ /[$`~*?\[{}]/) old = "!"
1455
+ else if (path ~ /^\//) old = path
1456
+ else old = uncertain ? "!" : cwd "/" path
1377
1457
  if (old == "!") uncertain = 1
1378
1458
  else { cwd = old; uncertain = 0 }
1379
1459
  }
@@ -29,11 +29,11 @@ namespace. `ChronicleConnectionString` lives in `Cratis.Chronicle.Connections`
29
29
 
30
30
  ```
31
31
  chronicle://host[:port]/?opts
32
- chronicle://user:pass@host[:port]/?opts
33
32
  chronicle+srv://host/?opts
34
33
  ```
35
34
 
36
- Default port `35000`. `Default` is `chronicle://localhost:35000`;
35
+ Credentials go in the authority part, before the host, as a user name and
36
+ password separated by a colon and followed by an at sign. Default port `35000`. `Default` is `chronicle://localhost:35000`;
37
37
  `Development` adds the `chronicle-dev-client` / `chronicle-dev-secret`
38
38
  credentials. Query options: `apiKey`, `auth`, `skipTlsValidation`, `disableTls`,
39
39
  `skipCompatibilityCheck`, `skipKeepAlive`, `serverless`, `loadBalancer`,
@@ -8,7 +8,6 @@ This reference holds the connection string grammar, query keys, development cred
8
8
 
9
9
  ```
10
10
  chronicle://<host>[:<port>][,<host>[:<port>]...][?<options>]
11
- chronicle://<username>:<password>@<host>[:<port>][,...][?<options>]
12
11
  chronicle+srv://<host>[:<port>][?<options>]
13
12
  ```
14
13
 
@@ -16,7 +15,7 @@ Default port is `35000`. Recognized query keys, lowercased at parse time
16
15
  (`ChronicleConnectionString` parser): `disabletls`, `skiptlsvalidation`,
17
16
  `loadbalancer`, `srvnameserver`. `apiKey` is parsed but rejected at client
18
17
  creation with `IllegalArgumentException`: the kernel has no API-key authentication.
19
- Use `user:password@`. Omitting credentials selects `chronicle-dev-client` /
18
+ Supply credentials in the authority part, before the host, as user name and password separated by a colon and followed by an at sign. Omitting credentials selects `chronicle-dev-client` /
20
19
  `chronicle-dev-secret`; these are development credentials, not a production setup. `ChronicleConnectionString.parse(String)` is on the companion, and `ChronicleConnectionString.DEVELOPMENT` points at
21
20
  `localhost:35000` with the `chronicle-dev-client` / `chronicle-dev-secret`
22
21
  credentials.
@@ -67,6 +67,12 @@ var mongo = builder.AddCratisChronicleMongoDB();
67
67
  var chronicle = builder.AddCratisChronicle("chronicle", c => c.WithMongoDB(mongo));
68
68
  var grpc = chronicle.GetEndpoint("grpc");
69
69
 
70
+ // The development client id and secret come from the AppHost's own configuration
71
+ // (see `cratis-chronicle-client-dotnet`), never from literals in source.
72
+ const string scheme = "chronicle://";
73
+ var chronicleClient = builder.Configuration["Chronicle:Client"];
74
+ var chronicleSecret = builder.Configuration["Chronicle:Secret"];
75
+
70
76
  AddService<Projects.Ordering>("ordering", "Ordering");
71
77
  AddService<Projects.Billing>("billing", "Billing");
72
78
 
@@ -76,7 +82,7 @@ void AddService<TProject>(string name, string eventStore)
76
82
  where TProject : IProjectMetadata, new() =>
77
83
  builder.AddProject<TProject>(name)
78
84
  .WithEnvironment("Cratis__Chronicle__ConnectionString",
79
- $"chronicle://chronicle-dev-client:chronicle-dev-secret@{grpc.Property(EndpointProperty.HostAndPort)}")
85
+ $"{scheme}{chronicleClient}:{chronicleSecret}@{grpc.Property(EndpointProperty.HostAndPort)}")
80
86
  .WithEnvironment("Cratis__Chronicle__EventStore", eventStore)
81
87
  .WithEnvironment("Cratis__MongoDB__Server", mongo.Resource.ConnectionStringExpression)
82
88
  .WithEnvironment("Cratis__MongoDB__Database", eventStore)
@@ -114,7 +120,8 @@ gate each step on health. Chronicle publishes 35000 (clients, Workbench, health
114
120
  TLS) to `127.0.0.1` only; its dedicated health port (8080 here, HTTP without TLS)
115
121
  stays inside the network for the health check; the Orleans ports 11111 and 30000
116
122
  stay unpublished for a single node. Services reach the kernel at
117
- `chronicle://chronicle-dev-client:chronicle-dev-secret@chronicle:35000`. Read
123
+ the `chronicle` service name on port 35000, with the development client id and
124
+ secret in the connection string (`cratis-chronicle-client-dotnet`). Read
118
125
  [references/docker-compose.md](references/docker-compose.md) for the complete file
119
126
  and the per-service settings.
120
127
 
@@ -17,6 +17,13 @@ Chronicle kernel backed by a single-node MongoDB replica set. The Chronicle imag
17
17
  the development image without bundled MongoDB, so it uses the replica set below and
18
18
  accepts the well-known development client.
19
19
 
20
+ Before `docker compose up`, create `chronicle-client.env` next to the compose file
21
+ and keep it out of version control. It holds one setting,
22
+ `Cratis__Chronicle__ConnectionString`, whose value is a `chronicle://` connection
23
+ string for the kernel's service name `chronicle` and port `35000`, carrying the
24
+ development client id and secret (see `cratis-chronicle-client-dotnet`). Both
25
+ services read it through `env_file`, so no credential appears in the compose file.
26
+
20
27
  ```yaml
21
28
  services:
22
29
  mongodb:
@@ -76,8 +83,9 @@ services:
76
83
  depends_on:
77
84
  chronicle:
78
85
  condition: service_healthy
86
+ env_file:
87
+ - ./chronicle-client.env
79
88
  environment:
80
- Cratis__Chronicle__ConnectionString: chronicle://chronicle-dev-client:chronicle-dev-secret@chronicle:35000
81
89
  Cratis__Chronicle__EventStore: Ordering
82
90
  Cratis__MongoDB__Server: mongodb://mongodb:27017/?replicaSet=rs0&directConnection=true
83
91
  Cratis__MongoDB__Database: Ordering
@@ -89,8 +97,9 @@ services:
89
97
  depends_on:
90
98
  chronicle:
91
99
  condition: service_healthy
100
+ env_file:
101
+ - ./chronicle-client.env
92
102
  environment:
93
- Cratis__Chronicle__ConnectionString: chronicle://chronicle-dev-client:chronicle-dev-secret@chronicle:35000
94
103
  Cratis__Chronicle__EventStore: Billing
95
104
  Cratis__MongoDB__Server: mongodb://mongodb:27017/?replicaSet=rs0&directConnection=true
96
105
  Cratis__MongoDB__Database: Billing
@@ -24,6 +24,13 @@ accept it. A hook (an outlet or toolbar `button` naming a State Change `slice`)
24
24
  (`outlet rowActions of actions for item`); a hook's `enabled when` that reads `item` while it
25
25
  acts `for screen` is `PLAY0915` (Requires Screenplay 6.0 or later).
26
26
 
27
+ `for item` and `for screen` are contextual words, not reserved names. A command, or the last
28
+ segment of a dotted command name, may still be called `for`: `action for` names command `for`
29
+ with no subject, `action for for screen` names command `for` acting on the screen, and
30
+ `action Work.Items.Details.for for item` keeps the dotted name. Label text such as
31
+ `label "Retry for screen"` stays text. Keep these identifiers when repairing or migrating
32
+ actions; do not rename them to avoid the subject clause.
33
+
27
34
  ```screenplay
28
35
  concept TaskId : Uuid
29
36
  concept Title : String
@@ -5,6 +5,7 @@
5
5
  "assertions": [
6
6
  { "kind": "skill-contains", "value": "PLAY0819", "file": "references/action-subjects.md" },
7
7
  { "kind": "skill-contains", "value": "never bulk-accept", "file": "references/action-subjects.md" },
8
+ { "kind": "skill-contains", "value": "contextual words, not reserved names", "file": "references/action-subjects.md" },
8
9
  { "kind": "skill-contains", "value": "Repair repeated advisories one occurrence at a time", "file": "references/action-subjects.md" },
9
10
  { "kind": "skill-contains", "value": "Handles are revision-bound: refetch them after every apply.", "file": "references/action-subjects.md" },
10
11
  { "kind": "skill-contains", "value": "registerQueryIdentity", "file": "references/scene-runtime-boundaries.md" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cratis/pi",
3
- "version": "7.170.7",
3
+ "version": "7.170.9",
4
4
  "description": "Configuration-aware Cratis AI integration for Pi",
5
5
  "type": "module",
6
6
  "files": [