@cairnkeep/cli 2.3.1 → 2.5.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.
Files changed (151) hide show
  1. package/CHANGELOG.md +85 -0
  2. package/README.md +232 -6
  3. package/bin/cairn +43 -2
  4. package/claude/capability-contract/hooks/capability-command-finish.sh +81 -0
  5. package/claude/capability-contract/hooks/capability-command-start.sh +76 -0
  6. package/claude/hooks/compaction-capture.sh +34 -0
  7. package/claude/hooks/memory-capture.sh +47 -5
  8. package/claude/hooks/memory-wakeup.sh +55 -2
  9. package/docs/building-an-overlay.md +4 -3
  10. package/docs/design/meta-agent.md +439 -0
  11. package/docs/harness-compatibility.md +117 -0
  12. package/docs/learning/CURRICULUM-MAP.md +91 -0
  13. package/docs/learning/FEATURE-GUIDE.md +86 -0
  14. package/docs/learning/PRODUCTION-PLAN.md +45 -14
  15. package/docs/learning/README.md +20 -1
  16. package/docs/learning/instructor-guide.md +6 -0
  17. package/docs/learning/lessons/L00-why-cairnkeep.md +20 -8
  18. package/docs/learning/lessons/L01-safe-trial.md +3 -3
  19. package/docs/learning/lessons/L02-installation.md +23 -5
  20. package/docs/learning/lessons/L03-first-project.md +7 -2
  21. package/docs/learning/lessons/L04-memory-fundamentals.md +4 -0
  22. package/docs/learning/lessons/L05-daily-workflow.md +4 -0
  23. package/docs/learning/lessons/L07-privacy-and-storage.md +3 -0
  24. package/docs/learning/lessons/L10-context-exploration.md +4 -2
  25. package/docs/learning/lessons/L12-managed-overlays.md +2 -0
  26. package/docs/learning/lessons/L13-session-evidence.md +71 -0
  27. package/docs/learning/lessons/L14-typed-memory.md +51 -0
  28. package/docs/learning/lessons/L15-capability-governance.md +56 -0
  29. package/docs/learning/lessons/L16-evaluation.md +67 -0
  30. package/docs/learning/lessons/L17-agent-boundary.md +55 -0
  31. package/docs/learning/templates/lesson-template.md +4 -1
  32. package/docs/learning/tracks/evidence-and-evaluation.md +20 -0
  33. package/docs/learning/tracks/operator.md +8 -2
  34. package/docs/learning/tracks/practitioner.md +6 -1
  35. package/docs/learning/tracks/quickstart.md +3 -0
  36. package/docs/learning/video-scripts/L00-why-cairnkeep.md +21 -17
  37. package/docs/learning/video-scripts/L02-installation.md +9 -2
  38. package/docs/learning/video-scripts/L03-first-project.md +3 -0
  39. package/docs/operating.md +567 -7
  40. package/docs/privacy-and-data-flow.md +417 -0
  41. package/docs/storage.md +252 -0
  42. package/examples/eval/README.md +42 -0
  43. package/examples/eval/adapter.json +12 -0
  44. package/examples/eval/bundled-fake.json +1 -0
  45. package/examples/eval/task-set.json +1 -0
  46. package/mcp-memory-server/dist/artifact-cli.js +184 -0
  47. package/mcp-memory-server/dist/artifact-schema.js +218 -0
  48. package/mcp-memory-server/dist/artifact-store.js +812 -0
  49. package/mcp-memory-server/dist/capability-adapter.js +286 -0
  50. package/mcp-memory-server/dist/capability-cli.js +361 -0
  51. package/mcp-memory-server/dist/capability-config.js +310 -0
  52. package/mcp-memory-server/dist/capability-harness.js +496 -0
  53. package/mcp-memory-server/dist/capability-registry.js +123 -0
  54. package/mcp-memory-server/dist/capability-schema.js +65 -0
  55. package/mcp-memory-server/dist/capability-store.js +431 -0
  56. package/mcp-memory-server/dist/compaction-normalize.js +267 -0
  57. package/mcp-memory-server/dist/eval-cli.js +523 -0
  58. package/mcp-memory-server/dist/eval-plan.js +346 -0
  59. package/mcp-memory-server/dist/eval-process.js +273 -0
  60. package/mcp-memory-server/dist/eval-report.js +609 -0
  61. package/mcp-memory-server/dist/eval-runner.js +827 -0
  62. package/mcp-memory-server/dist/eval-schema.js +368 -0
  63. package/mcp-memory-server/dist/eval-statistics.js +161 -0
  64. package/mcp-memory-server/dist/eval-workspace.js +313 -0
  65. package/mcp-memory-server/dist/failure-signature.js +141 -0
  66. package/mcp-memory-server/dist/index.js +600 -55
  67. package/mcp-memory-server/dist/node-cli.js +84 -0
  68. package/mcp-memory-server/dist/node-schema.js +170 -0
  69. package/mcp-memory-server/dist/node-store.js +455 -0
  70. package/mcp-memory-server/dist/note-cli.js +235 -0
  71. package/mcp-memory-server/dist/note-distiller.js +177 -0
  72. package/mcp-memory-server/dist/note-enrichment.js +93 -0
  73. package/mcp-memory-server/dist/note-schema.js +4 -0
  74. package/mcp-memory-server/dist/note-store.js +985 -0
  75. package/mcp-memory-server/dist/trajectory-cli.js +141 -0
  76. package/mcp-memory-server/dist/trajectory-normalize.js +448 -0
  77. package/mcp-memory-server/dist/trajectory-redaction.js +155 -0
  78. package/mcp-memory-server/dist/trajectory-schema.js +73 -0
  79. package/mcp-memory-server/dist/trajectory-store.js +339 -0
  80. package/mcp-memory-server/package.json +24 -2
  81. package/mcp-memory-server/scripts/fixtures/compaction-claude-code-2.1.219.json +9 -0
  82. package/mcp-memory-server/scripts/fixtures/compaction-claude-code-2.1.220.json +9 -0
  83. package/mcp-memory-server/scripts/fixtures/compaction-opencode-1.17.20-event.json +6 -0
  84. package/mcp-memory-server/scripts/fixtures/compaction-opencode-1.17.20-messages.json +119 -0
  85. package/mcp-memory-server/scripts/fixtures/compaction-unknown-version.json +17 -0
  86. package/opencode/capability-contract/plugins/capability-command.ts +319 -0
  87. package/opencode/command/graphify.md +25 -14
  88. package/opencode/plugins/memory-capture.ts +76 -10
  89. package/opencode/plugins/memory-wakeup.ts +58 -6
  90. package/package.json +8 -4
  91. package/pi/extensions/cairnkeep-trajectory.ts +55 -0
  92. package/schemas/artifact.schema.json +133 -0
  93. package/schemas/capability-callback.schema.json +68 -0
  94. package/schemas/capability-contract.schema.json +126 -0
  95. package/schemas/eval-adapter.schema.json +43 -0
  96. package/schemas/eval-protocol.schema.json +114 -0
  97. package/schemas/eval-report.schema.json +423 -0
  98. package/schemas/eval-task-set.schema.json +114 -0
  99. package/schemas/memory-node.schema.json +90 -0
  100. package/schemas/note.schema.json +112 -0
  101. package/schemas/trajectory-redaction.schema.json +25 -0
  102. package/schemas/trajectory.schema.json +82 -0
  103. package/scripts/bootstrap.sh +6 -0
  104. package/scripts/completion.sh +119 -5
  105. package/scripts/doctor.sh +284 -0
  106. package/scripts/fake-eval-adapter.mjs +120 -0
  107. package/scripts/fixtures/capability-harness-contracts.json +408 -0
  108. package/scripts/install-audit-timer.sh +3 -1
  109. package/scripts/lib/capability-opencode-plugin-harness.mjs +291 -0
  110. package/scripts/lib/trajectory-opencode-plugin-harness.mjs +25 -0
  111. package/scripts/lib/trajectory-pi-extension-harness.mjs +42 -0
  112. package/scripts/memory-wiki-audit.sh +49 -0
  113. package/scripts/smoke-bash32.sh +9 -0
  114. package/scripts/sync-claude-assets.sh +99 -6
  115. package/scripts/sync-opencode-graphify-assets.sh +24 -3
  116. package/scripts/sync-opencode-plugin-assets.sh +31 -5
  117. package/scripts/sync-opencode-security-assets.sh +24 -3
  118. package/scripts/sync-opencode-wiki-assets.sh +24 -3
  119. package/scripts/sync-pi-assets.sh +72 -0
  120. package/scripts/test-audit-timer.sh +98 -0
  121. package/scripts/test-bootstrap-untracked.sh +49 -0
  122. package/scripts/test-cli-dispatch.sh +41 -2
  123. package/scripts/test-compaction-hooks.sh +495 -0
  124. package/scripts/test-completion.sh +77 -0
  125. package/scripts/test-doctor.sh +348 -1
  126. package/scripts/test-eval-cli.sh +175 -0
  127. package/scripts/test-launcher-hooks.sh +630 -3
  128. package/scripts/test-learning-docs.sh +20 -4
  129. package/scripts/test-notes-cli.sh +114 -0
  130. package/scripts/test-package-install.sh +254 -0
  131. package/scripts/test-phase16-node-lifecycle.sh +50 -0
  132. package/scripts/test-phase17-artifact-lifecycle.sh +370 -0
  133. package/scripts/test-phase18-capability-lifecycle.sh +504 -0
  134. package/scripts/test-phase18-harness-boundary.sh +1060 -0
  135. package/scripts/test-phase19-eval-lifecycle.sh +1015 -0
  136. package/scripts/test-trajectory-cli.sh +87 -0
  137. package/scripts/test-trajectory-hooks.sh +142 -0
  138. package/scripts/test-uninstall.sh +231 -5
  139. package/scripts/uninstall.sh +38 -5
  140. package/scripts/verify-dependency-security.mjs +121 -0
  141. package/scripts/verify-docs-parity.sh +527 -1
  142. package/scripts/verify-phase18-runtime-evidence.mjs +895 -0
  143. package/scripts/verify-phase19-runtime-evidence.mjs +947 -0
  144. package/templates/capabilities.json.template +7 -0
  145. package/templates/env.example.template +51 -0
  146. package/templates/memory-wiki-audit.service.template +1 -1
  147. package/templates/start-claude.sh.template +36 -0
  148. package/templates/start-kimi.sh.template +39 -0
  149. package/templates/start-opencode.sh.template +47 -5
  150. package/templates/start-pi.sh.template +30 -0
  151. package/templates/trajectory-redaction.json.template +4 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "schema_version": 1,
3
+ "capabilities": {},
4
+ "logging": {
5
+ "callbacks": false
6
+ }
7
+ }
@@ -17,6 +17,57 @@
17
17
  # scopes default to ~/.cairnkeep; project scope uses <server-cwd>/.agentfs/.
18
18
  # CAIRN_AGENTFS_BASE_DIR=~/.cairnkeep
19
19
  #
20
+ # Typed metadata, filters, logical note address spaces, and memory_import are
21
+ # OFF by default. Restart the memory server after changing this construction-
22
+ # time tool-schema flag. No model, API key, or network endpoint is required.
23
+ # CAIRN_TYPED_MEMORY_NODES=1
24
+ #
25
+ # The managed capability contract is OFF by default. Project state is managed
26
+ # with `cairn capabilities`; these environment variables are optional strict
27
+ # per-process overrides. Strict booleans: 1 | true | yes | on; 0 | false | no | off.
28
+ # Leave every key below unset unless the current process needs an explicit
29
+ # override. MCP capability changes require a memory-server restart.
30
+ # CAIRN_CAPABILITY_CONTRACT=
31
+ # CAIRN_CAPABILITY_LOGGING=
32
+ # CAIRN_CAPABILITY_MEMORY_WRITE=
33
+ # CAIRN_CAPABILITY_MEMORY_SEARCH=
34
+ # CAIRN_CAPABILITY_NOTES_DISTILL=
35
+ # CAIRN_CAPABILITY_WIKI=
36
+ # CAIRN_CAPABILITY_GRAPH=
37
+ # CAIRN_CAPABILITY_SECURITY_AUDIT=
38
+ # CAIRN_CAPABILITY_ROUTE_CHECK=
39
+ # CAIRN_CAPABILITY_CONTEXT_EXPLORE=
40
+ #
41
+ # CAIRN_NOTE_DISTILLATION remains a compatibility input for the existing
42
+ # offline note job; enabling the master contract does not enable notes or graph.
43
+ # CAIRN_NOTE_DISTILLATION=
44
+ # Callback logging also requires the master contract and local capture consent:
45
+ # CAIRN_TRAJECTORY_CAPTURE is separate required consent and remains OFF by default.
46
+ #
47
+ # Structured session trajectories are local and OFF by default. When enabled,
48
+ # Claude Code SessionEnd and OpenCode session-idle capture redacted events in
49
+ # <project>/.agentfs/trajectory.db. See docs/privacy-and-data-flow.md first.
50
+ # CAIRN_TRAJECTORY_CAPTURE=1
51
+ # CAIRN_TRAJECTORY_SESSION_MAX_BYTES=5242880
52
+ # CAIRN_TRAJECTORY_STORE_MAX_BYTES=268435456
53
+ # CAIRN_TRAJECTORY_RETENTION_DAYS=30
54
+ # Bootstrap creates .ai/trajectory-redaction.json for optional custom patterns.
55
+ # CAIRN_TRAJECTORY_REDACTION_FILE=.ai/trajectory-redaction.json
56
+ #
57
+ # Harness-produced compaction continuity and explicit artifact access are local
58
+ # and OFF by default. Either capability may be enabled independently; neither
59
+ # needs a model, API key, or network endpoint. HTTP artifact tools require the
60
+ # separate HTTP flag in addition to the existing authenticated HTTP settings.
61
+ # CAIRN_COMPACTION_CAPTURE=1
62
+ # CAIRN_ARTIFACT_STORE=1
63
+ # CAIRN_ARTIFACT_HTTP=1
64
+ # CAIRN_ARTIFACT_MAX_BYTES=1048576
65
+ # CAIRN_ARTIFACT_SESSION_MAX_BYTES=16777216
66
+ # CAIRN_ARTIFACT_STORE_MAX_BYTES=268435456
67
+ # CAIRN_ARTIFACT_RETENTION_DAYS=30
68
+ # CAIRN_COMPACTION_MAX_REVISIONS=8
69
+ # CAIRN_ARTIFACT_GENERATED_FILE_SNAPSHOT_MAX_BYTES=262144
70
+ #
20
71
  # The memory server runs locally over stdio by default. These HTTP settings are
21
72
  # for the SERVER host of an explicit remote deployment, not a normal local
22
73
  # client. Setting MCP_HTTP_PORT REQUIRES a bearer token, or startup fails.
@@ -1,5 +1,5 @@
1
1
  [Unit]
2
- Description=Cairnkeep memory + wiki invalidation audit
2
+ Description=Cairnkeep memory + wiki audit and optional note distillation
3
3
 
4
4
  [Service]
5
5
  Type=oneshot
@@ -15,6 +15,31 @@
15
15
  # with $CAIRN_EXIT_STATUS set to the harness exit code.
16
16
  set -euo pipefail
17
17
  ROOT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
18
+
19
+ capability_contract_enabled() {
20
+ local value="${CAIRN_CAPABILITY_CONTRACT:-}"
21
+ value="${value#"${value%%[![:space:]]*}"}"
22
+ value="${value%"${value##*[![:space:]]}"}"
23
+ case "$value" in
24
+ 1|[Tt][Rr][Uu][Ee]|[Yy][Ee][Ss]|[Oo][Nn]) return 0 ;;
25
+ *) return 1 ;;
26
+ esac
27
+ }
28
+
29
+ resolve_cairn_root() {
30
+ local source dir
31
+ if ! source=$(type -P cairn); then
32
+ echo "cairn: capability contract requires the cairn executable on PATH" >&2
33
+ return 127
34
+ fi
35
+ while [[ -L "$source" ]]; do
36
+ dir=$(cd -P "$(dirname "$source")" && pwd)
37
+ source=$(readlink "$source")
38
+ [[ "$source" == /* ]] || source="$dir/$source"
39
+ done
40
+ cd -P "$(dirname "$source")/.." && pwd
41
+ }
42
+
18
43
  if [[ -f "$ROOT_DIR/.ai/.env" ]]; then
19
44
  set -a
20
45
  # shellcheck disable=SC1091
@@ -25,6 +50,17 @@ if [[ -f "$ROOT_DIR/.ai/pre-launch.sh" ]]; then
25
50
  # shellcheck disable=SC1091
26
51
  . "$ROOT_DIR/.ai/pre-launch.sh"
27
52
  fi
53
+
54
+ if capability_contract_enabled; then
55
+ CAIRN_RUNTIME_ROOT=$(resolve_cairn_root)
56
+ node "$CAIRN_RUNTIME_ROOT/mcp-memory-server/dist/capability-cli.js" \
57
+ harness-recover </dev/null >/dev/null 2>&1 || true
58
+ CLAUDE_CAPABILITY_ROOT="$ROOT_DIR/.ai/capability-contract/claude"
59
+ "$CAIRN_RUNTIME_ROOT/scripts/sync-claude-assets.sh" \
60
+ --apply --capability-overlay --live-root "$CLAUDE_CAPABILITY_ROOT" >/dev/null
61
+ export CLAUDE_CONFIG_DIR="$CLAUDE_CAPABILITY_ROOT"
62
+ fi
63
+
28
64
  cd "$ROOT_DIR"
29
65
 
30
66
  launch_args=()
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env bash
2
+ # Cairnkeep launcher for Kimi Code. Loads this repo's .ai/.env (if present),
3
+ # then launches Kimi from the repo root. Kimi reads a valid project .mcp.json
4
+ # and an optional .kimi-code/mcp.json override; it does not expand environment
5
+ # references in an HTTP URL, so remote URLs must be materialized by private
6
+ # machine configuration rather than committed to a shared project file.
7
+ #
8
+ # Wrapper seams (both optional, both no-ops when absent):
9
+ # .ai/pre-launch.sh sourced after .env, before launch. May export env
10
+ # or abort the launch by returning/exiting non-zero.
11
+ # .ai/post-exit.sh sourced after Kimi exits, with
12
+ # $CAIRN_EXIT_STATUS set to the exit code.
13
+ set -euo pipefail
14
+ ROOT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
15
+
16
+ if [[ -f "$ROOT_DIR/.ai/.env" ]]; then
17
+ set -a
18
+ # shellcheck disable=SC1091
19
+ . "$ROOT_DIR/.ai/.env"
20
+ set +a
21
+ fi
22
+ if [[ -f "$ROOT_DIR/.ai/pre-launch.sh" ]]; then
23
+ # shellcheck disable=SC1091
24
+ . "$ROOT_DIR/.ai/pre-launch.sh"
25
+ fi
26
+
27
+ cd "$ROOT_DIR"
28
+
29
+ if [[ -f "$ROOT_DIR/.ai/post-exit.sh" ]]; then
30
+ set +e
31
+ kimi "$@"
32
+ CAIRN_EXIT_STATUS=$?
33
+ set -e
34
+ export CAIRN_EXIT_STATUS
35
+ # shellcheck disable=SC1091
36
+ . "$ROOT_DIR/.ai/post-exit.sh" || true
37
+ exit "$CAIRN_EXIT_STATUS"
38
+ fi
39
+ exec kimi "$@"
@@ -6,11 +6,37 @@
6
6
  # Wrapper seams (all optional, all no-ops when absent):
7
7
  # .ai/pre-launch.sh sourced after .env, before launch. May export env
8
8
  # or abort the launch by returning / exiting non-zero.
9
- # CAIRN_EXTRA_SETTINGS path to an OpenCode config file layered via --config.
9
+ # CAIRN_EXTRA_SETTINGS path to an OpenCode config file layered via
10
+ # OPENCODE_CONFIG.
10
11
  # .ai/post-exit.sh sourced after OpenCode exits, with $CAIRN_EXIT_STATUS
11
12
  # set to the exit code.
12
13
  set -euo pipefail
13
14
  ROOT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
15
+
16
+ capability_contract_enabled() {
17
+ local value="${CAIRN_CAPABILITY_CONTRACT:-}"
18
+ value="${value#"${value%%[![:space:]]*}"}"
19
+ value="${value%"${value##*[![:space:]]}"}"
20
+ case "$value" in
21
+ 1|[Tt][Rr][Uu][Ee]|[Yy][Ee][Ss]|[Oo][Nn]) return 0 ;;
22
+ *) return 1 ;;
23
+ esac
24
+ }
25
+
26
+ resolve_cairn_root() {
27
+ local source dir
28
+ if ! source=$(type -P cairn); then
29
+ echo "cairn: capability contract requires the cairn executable on PATH" >&2
30
+ return 127
31
+ fi
32
+ while [[ -L "$source" ]]; do
33
+ dir=$(cd -P "$(dirname "$source")" && pwd)
34
+ source=$(readlink "$source")
35
+ [[ "$source" == /* ]] || source="$dir/$source"
36
+ done
37
+ cd -P "$(dirname "$source")/.." && pwd
38
+ }
39
+
14
40
  if [[ -f "$ROOT_DIR/.ai/.env" ]]; then
15
41
  set -a
16
42
  # shellcheck disable=SC1091
@@ -21,16 +47,32 @@ if [[ -f "$ROOT_DIR/.ai/pre-launch.sh" ]]; then
21
47
  # shellcheck disable=SC1091
22
48
  . "$ROOT_DIR/.ai/pre-launch.sh"
23
49
  fi
50
+
51
+ if capability_contract_enabled; then
52
+ CAIRN_RUNTIME_ROOT=$(resolve_cairn_root)
53
+ node "$CAIRN_RUNTIME_ROOT/mcp-memory-server/dist/capability-cli.js" \
54
+ harness-recover </dev/null >/dev/null 2>&1 || true
55
+ OPENCODE_CAPABILITY_ROOT="$ROOT_DIR/.ai/capability-contract/opencode"
56
+ "$CAIRN_RUNTIME_ROOT/scripts/sync-opencode-wiki-assets.sh" \
57
+ --apply --capability-overlay --live-root "$OPENCODE_CAPABILITY_ROOT" >/dev/null
58
+ "$CAIRN_RUNTIME_ROOT/scripts/sync-opencode-graphify-assets.sh" \
59
+ --apply --capability-overlay --live-root "$OPENCODE_CAPABILITY_ROOT" >/dev/null
60
+ "$CAIRN_RUNTIME_ROOT/scripts/sync-opencode-security-assets.sh" \
61
+ --apply --capability-overlay --live-root "$OPENCODE_CAPABILITY_ROOT" >/dev/null
62
+ "$CAIRN_RUNTIME_ROOT/scripts/sync-opencode-plugin-assets.sh" \
63
+ --apply --capability-overlay --live-root "$OPENCODE_CAPABILITY_ROOT" >/dev/null
64
+ export OPENCODE_CONFIG_DIR="$OPENCODE_CAPABILITY_ROOT"
65
+ fi
66
+
24
67
  cd "$ROOT_DIR"
25
68
 
26
- launch_args=()
27
69
  if [[ -n "${CAIRN_EXTRA_SETTINGS:-}" ]]; then
28
- launch_args+=(--config "$CAIRN_EXTRA_SETTINGS")
70
+ export OPENCODE_CONFIG="$CAIRN_EXTRA_SETTINGS"
29
71
  fi
30
72
 
31
73
  if [[ -f "$ROOT_DIR/.ai/post-exit.sh" ]]; then
32
74
  set +e
33
- opencode "${launch_args[@]}" "$@"
75
+ opencode "$@"
34
76
  CAIRN_EXIT_STATUS=$?
35
77
  set -e
36
78
  export CAIRN_EXIT_STATUS
@@ -38,4 +80,4 @@ if [[ -f "$ROOT_DIR/.ai/post-exit.sh" ]]; then
38
80
  . "$ROOT_DIR/.ai/post-exit.sh" || true
39
81
  exit "$CAIRN_EXIT_STATUS"
40
82
  fi
41
- exec opencode "${launch_args[@]}" "$@"
83
+ exec opencode "$@"
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env bash
2
+ # Cairnkeep launcher for Pi. Loads this repo's private .ai/.env, runs the same
3
+ # optional pre/post seams as the other launchers, and otherwise passes every
4
+ # argument to Pi unchanged. Pi has no generic settings-file layering flag, so
5
+ # CAIRN_EXTRA_SETTINGS is intentionally not translated into a CLI option.
6
+ set -euo pipefail
7
+ ROOT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
8
+ if [[ -f "$ROOT_DIR/.ai/.env" ]]; then
9
+ set -a
10
+ # shellcheck disable=SC1091
11
+ . "$ROOT_DIR/.ai/.env"
12
+ set +a
13
+ fi
14
+ if [[ -f "$ROOT_DIR/.ai/pre-launch.sh" ]]; then
15
+ # shellcheck disable=SC1091
16
+ . "$ROOT_DIR/.ai/pre-launch.sh"
17
+ fi
18
+ cd "$ROOT_DIR"
19
+
20
+ if [[ -f "$ROOT_DIR/.ai/post-exit.sh" ]]; then
21
+ set +e
22
+ pi "$@"
23
+ CAIRN_EXIT_STATUS=$?
24
+ set -e
25
+ export CAIRN_EXIT_STATUS
26
+ # shellcheck disable=SC1091
27
+ . "$ROOT_DIR/.ai/post-exit.sh" || true
28
+ exit "$CAIRN_EXIT_STATUS"
29
+ fi
30
+ exec pi "$@"
@@ -0,0 +1,4 @@
1
+ {
2
+ "version": 1,
3
+ "patterns": []
4
+ }