addashboard-cli 0.11.0 → 0.13.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.
@@ -132,6 +132,24 @@ print(f"✓ 作業中プランを設定: {os.environ['ACC']} / {os.environ['PF']
132
132
  PY
133
133
  }
134
134
 
135
+ # ------------------------------------------------------------ planner env
136
+ # ブラウザはフォルダの絶対パスを知る手段が無いので、プランナーが「保存フォルダ(入稿計画/)」の
137
+ # 場所を案内できるように、配信元のスキルから絶対パスを渡す (.planner-env.json)。
138
+ # あわせて 入稿計画/ と目印ファイルを用意する (プランナーは目印の有無で入稿計画フォルダかを判定する)。
139
+ # 各自の環境のパスなので git では追跡せず、npm にも載せない。
140
+ write_planner_env() {
141
+ local plans="${SKILL_DIR}/入稿計画"
142
+ mkdir -p "$plans"
143
+ [ -f "${plans}/.ad-planner-plans" ] \
144
+ || printf 'ad-planner の入稿計画フォルダの目印です。消さないでください。\n' > "${plans}/.ad-planner-plans"
145
+ PLANS_DIR="$plans" OUT="${SKILL_DIR}/.planner-env.json" python3 - <<'PY'
146
+ import json, os
147
+ with open(os.environ["OUT"], "w", encoding="utf-8") as f:
148
+ json.dump({"plansDir": os.environ["PLANS_DIR"]}, f, ensure_ascii=False)
149
+ f.write("\n")
150
+ PY
151
+ }
152
+
135
153
  # file:// で開くと fetch('サンプルプラン.json') がブロックされ、
136
154
  # エラーも出ないまま空のプランナーが表示される。必ずHTTPで開く。
137
155
  cmd_planner() {
@@ -153,6 +171,7 @@ cmd_planner() {
153
171
  || die "--platform と --account は両方指定してください"
154
172
  write_active_plan "$platform" "$account"
155
173
  fi
174
+ write_planner_env
156
175
 
157
176
  if curl -sf -o /dev/null "$URL"; then
158
177
  echo "✓ 配信は起動済み(再利用)"
@@ -171,7 +190,15 @@ cmd_planner() {
171
190
  echo "✓ 起動しました"
172
191
  fi
173
192
 
174
- open "$URL"
193
+ # 素材の新規登録・入稿計画の保存は File System Access API (フォルダの読み書き) を使うので Chrome で開く。
194
+ # 素の `open` は BizAgent / VS Code のターミナルだと内蔵ブラウザに渡され、
195
+ # 内蔵ブラウザはフォルダの読み書きを許可しない (許可の確認も出ずに黙って拒否される)。
196
+ if [ -d "/Applications/Google Chrome.app" ] || [ -d "$HOME/Applications/Google Chrome.app" ]; then
197
+ open -a "Google Chrome" "$URL"
198
+ else
199
+ open "$URL"
200
+ echo " ⚠ Google Chrome が見つかりません。素材の登録と入稿計画の保存は Chrome 系ブラウザでしか動きません" >&2
201
+ fi
175
202
  echo " $URL"
176
203
  echo " 停止: adops.sh planner --stop"
177
204
  }
@@ -0,0 +1 @@
1
+ ad-planner の入稿計画フォルダの目印です。消さないでください。