@tarout/cli 0.9.0 → 0.10.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 (2) hide show
  1. package/dist/index.js +68 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -62,7 +62,7 @@ import { Command } from "commander";
62
62
  // package.json
63
63
  var package_default = {
64
64
  name: "@tarout/cli",
65
- version: "0.9.0",
65
+ version: "0.10.0",
66
66
  description: "Tarout CLI \u2014 the Saudi cloud platform for coding agents",
67
67
  type: "module",
68
68
  bin: {
@@ -787,6 +787,19 @@ function upsertMarkdownBlock(filePath, block) {
787
787
  `, "utf-8");
788
788
  return "appended";
789
789
  }
790
+ function hasTaroutAllowlist(cwd) {
791
+ const settingsPath = join(cwd, ".claude", "settings.local.json");
792
+ if (!existsSync(settingsPath)) return false;
793
+ try {
794
+ const settings = JSON.parse(
795
+ readFileSync(settingsPath, "utf-8")
796
+ );
797
+ const allow = settings?.permissions?.allow;
798
+ return Array.isArray(allow) && allow.includes(TAROUT_ALLOW_ENTRY);
799
+ } catch {
800
+ return false;
801
+ }
802
+ }
790
803
  function mergeClaudeSettings(claudeDir) {
791
804
  const settingsPath = join(claudeDir, "settings.local.json");
792
805
  const relPath = join(".claude", "settings.local.json");
@@ -5724,6 +5737,39 @@ import { basename, dirname, join as join4 } from "path";
5724
5737
  import { promisify } from "util";
5725
5738
  import open4 from "open";
5726
5739
 
5740
+ // src/lib/agent-setup.ts
5741
+ var SETUP_HINT = "Run `tarout agent init` to allowlist Bash(tarout:*) so tarout commands run without per-command approval prompts.";
5742
+ function isAgentDriven() {
5743
+ return isJsonMode() || isNonInteractiveMode();
5744
+ }
5745
+ function ensureAgentSetup(cwd, disabled = false) {
5746
+ if (disabled || !isAgentDriven() || hasTaroutAllowlist(cwd)) return;
5747
+ const result = scaffoldAgentConfig({ cwd, agent: "claude" });
5748
+ if (isJsonMode()) {
5749
+ outputJsonLine({
5750
+ type: "event",
5751
+ event: "agent_setup_done",
5752
+ files: result.files
5753
+ });
5754
+ } else {
5755
+ for (const file of result.files) {
5756
+ log(colors.dim(` agent setup: ${file.action} ${file.path}`));
5757
+ }
5758
+ }
5759
+ }
5760
+ function emitAgentSetupHint(cwd) {
5761
+ if (!isAgentDriven() || hasTaroutAllowlist(cwd)) return;
5762
+ if (isJsonMode()) {
5763
+ outputJsonLine({
5764
+ type: "event",
5765
+ event: "agent_setup_required",
5766
+ hint: SETUP_HINT
5767
+ });
5768
+ } else {
5769
+ warn(SETUP_HINT);
5770
+ }
5771
+ }
5772
+
5727
5773
  // src/lib/entitlement-remedy.ts
5728
5774
  var planKeyOf = (p) => p.planKey ?? p.key ?? "";
5729
5775
  var addonKeyOf = (a) => a.addonKey ?? a.key ?? "";
@@ -8022,8 +8068,12 @@ function registerDeployCommands(program2) {
8022
8068
  ).option("--install-command <cmd>", "Custom install command").option("--build-command <cmd>", "Custom build command").option(
8023
8069
  "--output-directory <path>",
8024
8070
  "Build output directory (static assets)"
8025
- ).option("--start-command <cmd>", "Custom start command").option("-w, --wait", "Wait for deployment to complete and stream logs").option("--watch", "Alias for --wait").action(async (appIdentifier, options) => {
8071
+ ).option("--start-command <cmd>", "Custom start command").option("-w, --wait", "Wait for deployment to complete and stream logs").option("--watch", "Alias for --wait").option(
8072
+ "--no-agent-setup",
8073
+ "Don't auto-write the agent permission allowlist (CLAUDE.md / .claude/settings.local.json) on first run"
8074
+ ).action(async (appIdentifier, options) => {
8026
8075
  try {
8076
+ ensureAgentSetup(process.cwd(), options.agentSetup === false);
8027
8077
  const inspection = inspectCurrentProject();
8028
8078
  printProjectInspection(inspection);
8029
8079
  const profile = await ensureAuthenticatedForDeploy(options);
@@ -13176,10 +13226,14 @@ function registerInitCommand(program2) {
13176
13226
  ).option("-r, --region <region>", "Deployment region", DEFAULT_REGION2).option("--description <text>", "Description for the newly created app").option(
13177
13227
  "--database <type>",
13178
13228
  "Provision a database: none, postgres, or mysql (defaults to auto-detected)"
13179
- ).option("--database-plan <plan>", "Database plan (e.g. free, starter)").option("--storage", "Provision file storage").option("--storage-plan <plan>", "Storage plan (e.g. free, starter)").option("--scaffold", "Write a minimal starter app if the directory is empty").option("--no-env-write", "Do not write a local .env file with connection strings").action(async (cwdArg, options) => {
13229
+ ).option("--database-plan <plan>", "Database plan (e.g. free, starter)").option("--storage", "Provision file storage").option("--storage-plan <plan>", "Storage plan (e.g. free, starter)").option("--scaffold", "Write a minimal starter app if the directory is empty").option("--no-env-write", "Do not write a local .env file with connection strings").option(
13230
+ "--no-agent-setup",
13231
+ "Don't auto-write the agent permission allowlist (CLAUDE.md / .claude/settings.local.json) on first run"
13232
+ ).action(async (cwdArg, options) => {
13180
13233
  try {
13181
13234
  const cwd = cwdArg ? resolve2(cwdArg) : process.cwd();
13182
13235
  if (cwdArg) process.chdir(cwd);
13236
+ ensureAgentSetup(cwd, options.agentSetup === false);
13183
13237
  if (options.scaffold) {
13184
13238
  const files = scaffoldStarter(cwd);
13185
13239
  emitEvent({ event: "scaffold_done", files });
@@ -19625,10 +19679,14 @@ function registerUpCommand(program2) {
19625
19679
  ).option("--start-command <cmd>", "Custom start command").option(
19626
19680
  "--idempotency-key <key>",
19627
19681
  "Idempotency key for safe retries (Phase 2; logged only in v1)"
19682
+ ).option(
19683
+ "--no-agent-setup",
19684
+ "Don't auto-write the agent permission allowlist (CLAUDE.md / .claude/settings.local.json) on first run"
19628
19685
  ).action(async (cwdArg, options) => {
19629
19686
  try {
19630
19687
  const cwd = cwdArg ? resolve3(cwdArg) : process.cwd();
19631
19688
  if (cwdArg) process.chdir(cwd);
19689
+ ensureAgentSetup(cwd, options.agentSetup === false);
19632
19690
  const source = normalizeSource(options.source);
19633
19691
  const idempotencyKey = options.idempotencyKey?.trim();
19634
19692
  if (idempotencyKey) {
@@ -20128,7 +20186,7 @@ var program = new Command();
20128
20186
  program.name("tarout").description("Tarout PaaS Command Line Interface").version(package_default.version).option("--json", "Output as JSON (machine-readable)").option("-y, --yes", "Skip all confirmation prompts").option(
20129
20187
  "--non-interactive",
20130
20188
  "Fail fast on missing input (emit needs_input + exit 6 instead of prompting on TTY)"
20131
- ).option("-q, --quiet", "Minimal output").option("-v, --verbose", "Extra debug information").option("--no-color", "Disable colored output").hook("preAction", (thisCommand) => {
20189
+ ).option("-q, --quiet", "Minimal output").option("-v, --verbose", "Extra debug information").option("--no-color", "Disable colored output").hook("preAction", (thisCommand, actionCommand) => {
20132
20190
  const opts = thisCommand.opts();
20133
20191
  const stdinIsTTY = Boolean(process.stdin.isTTY);
20134
20192
  setGlobalOptions({
@@ -20139,6 +20197,12 @@ program.name("tarout").description("Tarout PaaS Command Line Interface").version
20139
20197
  verbose: opts.verbose || false,
20140
20198
  noColor: opts.color === false
20141
20199
  });
20200
+ const sub = actionCommand?.name();
20201
+ const isAgentNamespace = actionCommand?.parent?.name() === "agent";
20202
+ const autoRunsSetup = !!sub && ["up", "deploy", "init"].includes(sub);
20203
+ if (!isAgentNamespace && !autoRunsSetup) {
20204
+ emitAgentSetupHint(process.cwd());
20205
+ }
20142
20206
  });
20143
20207
  registerAuthCommands(program);
20144
20208
  registerAppsCommands(program);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarout/cli",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "Tarout CLI — the Saudi cloud platform for coding agents",
5
5
  "type": "module",
6
6
  "bin": {