context101-cli 0.1.0 → 0.1.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "context101-cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "private": false,
5
5
  "description": "Context101 self-host CLI. Use `npx context101-cli` or the `context101` bin. The public npm package named context101 is Context7's MCP, not this tool.",
6
6
  "type": "module",
package/src/init.js CHANGED
@@ -15,10 +15,7 @@ import {
15
15
  printChecks,
16
16
  runChecks,
17
17
  } from "./checks.js";
18
- import {
19
- formatAccessResult,
20
- requestEmbeddingModelAccess,
21
- } from "./bedrock-access.js";
18
+ import { requestEmbeddingModelAccess } from "./bedrock-access.js";
22
19
  import {
23
20
  isKnownEmbeddingModel,
24
21
  listEmbeddingModels,
@@ -267,11 +264,22 @@ export async function runInit(opts, ctx) {
267
264
  "no Amplify-capable GitHub PAT yet — set CTX_GH_TOKEN to a ghp_ or github_pat_ token before deploy"
268
265
  );
269
266
  }
270
- io.write("");
271
- io.write(nextSteps(plan));
272
- io.write("");
273
267
 
274
- if (!answers.deploy) return 0;
268
+ let deploy = Boolean(answers.deploy);
269
+ if (!deploy && !opts.yes && tty) {
270
+ deploy = Boolean(
271
+ await askDeployNow(ctx, {
272
+ createRds: Boolean(answers.createRds),
273
+ seed: Boolean(answers.seed),
274
+ repository: answers.repository || "",
275
+ })
276
+ );
277
+ }
278
+
279
+ if (!deploy) {
280
+ io.write(nextSteps({ seed: answers.seed }));
281
+ return 0;
282
+ }
275
283
 
276
284
  if (answers.repository && !githubReadyForAmplify(checks, answers)) {
277
285
  io.err(
@@ -391,15 +399,28 @@ function withAwsAuth(env, { profile, accessKeyId, secretAccessKey } = {}) {
391
399
  return next;
392
400
  }
393
401
 
402
+ async function askDeployNow(ctx, details) {
403
+ if (typeof ctx.confirmDeploy === "function") {
404
+ return ctx.confirmDeploy(details);
405
+ }
406
+ const { promptDeployNow } = await import("./prompt.js");
407
+ return promptDeployNow(details);
408
+ }
409
+
394
410
  function printBedrockAccess(results, io) {
395
- io.write("Bedrock embedding access:");
396
- for (const result of results) {
397
- const line = formatAccessResult(result);
398
- if (result.status === "needs-console" || result.status === "failed") {
399
- io.warn(line);
400
- } else {
401
- io.dim(` ${line}`);
402
- }
411
+ const problems = (results || []).filter(
412
+ (result) => result.status === "needs-console" || result.status === "failed"
413
+ );
414
+ const granted = (results || []).filter((result) => result.status === "granted").length;
415
+ if (problems.length) {
416
+ const ids = problems
417
+ .slice(0, 2)
418
+ .map((result) => result.id)
419
+ .join(", ");
420
+ const extra = problems.length > 2 ? ` (+${problems.length - 2})` : "";
421
+ io.warn(`Bedrock: enable ${ids}${extra} in console → Model access`);
422
+ } else if (granted) {
423
+ io.ok("Bedrock access granted");
403
424
  }
404
425
  }
405
426
 
package/src/parse-args.js CHANGED
@@ -3,7 +3,7 @@ import { DRIVER_NEON, DRIVER_POSTGRES } from "./defaults.js";
3
3
  const FLAG_HELP = `
4
4
  Usage: context101 <command> [options]
5
5
 
6
- init write a local secrets file (default)
6
+ init write a local secrets file (default); TTY asks to deploy
7
7
  deploy deploy the AWS stack (loads deploy-env, invokes cdk)
8
8
  diff cdk diff with the same context flags
9
9
  synth cdk synth with the same context flags
@@ -21,7 +21,8 @@ instead of deleting MCP / Amplify. The CLI is the front door.
21
21
  npx context101-cli deploy
22
22
 
23
23
  --dry-run print the plan; write nothing, deploy nothing
24
- --yes, -y accept defaults (creates RDS if no --database-url)
24
+ --yes, -y accept defaults (creates RDS if no --database-url);
25
+ does not deploy unless --deploy is also passed
25
26
  --force overwrite an existing env file
26
27
  --dir <path> clone into this directory when not in a checkout
27
28
  --deploy-env <path> default: <repo>/cdk/.deploy-env
@@ -41,7 +42,7 @@ instead of deleting MCP / Amplify. The CLI is the front door.
41
42
  (brains still pick any Titan/Cohere model in the app)
42
43
  --skip-bedrock-access do not request Bedrock model access during init
43
44
  --seed first deploy uploads knowledge/ once
44
- --deploy deploy after writing (combine with --yes)
45
+ --deploy deploy after writing without asking
45
46
 
46
47
  deploy / diff / synth:
47
48
  --seed upload knowledge/ once (first deploy only)
package/src/plan.js CHANGED
@@ -83,29 +83,5 @@ function bootstrapLabel(plan) {
83
83
  }
84
84
 
85
85
  export function nextSteps(plan) {
86
- const rds = plan.createRds
87
- ? "CDK will create RDS Postgres and apply the control-plane schema. Fetch the secret via ControlPlaneDbSecretArn — the password is never printed."
88
- : null;
89
- const next = [
90
- `Next: ${deployCommand(plan.seed)}`,
91
- plan.seed ? null : "First time? add --seed to upload the example knowledge/ files once.",
92
- rds,
93
- ];
94
- if (plan.repository) {
95
- return [
96
- ...next,
97
- "After Amplify is up (~4 min), open /setup on WebAppDefaultDomain (or your own domain).",
98
- "Leave BETTER_AUTH_URL / APP_URL unset unless you bring your own host. CDK fills the Amplify default.",
99
- ]
100
- .filter(Boolean)
101
- .join("\n");
102
- }
103
- return [
104
- ...next,
105
- "Amplify is skipped — this deploy is the AWS stack only (no GitHub-watched web app).",
106
- "Run the web app from web/, or re-run init with --repo when you want Amplify.",
107
- "Leave BETTER_AUTH_URL / APP_URL unset unless you bring your own host.",
108
- ]
109
- .filter(Boolean)
110
- .join("\n");
86
+ return deployCommand(plan.seed);
111
87
  }
package/src/prompt.js CHANGED
@@ -6,12 +6,24 @@ import {
6
6
  import { inferDriver, inferPrepare } from "./env-file.js";
7
7
  import { normalizeRepoUrl } from "./repo.js";
8
8
 
9
+ export function deployNowMessage({ createRds = false } = {}) {
10
+ return createRds
11
+ ? "Deploy the stack now? (CDK + Docker; creates RDS)"
12
+ : "Deploy the stack now?";
13
+ }
14
+
15
+ export async function promptDeployNow(details = {}) {
16
+ const { confirm } = await import("@inquirer/prompts");
17
+ return confirm({
18
+ message: deployNowMessage(details),
19
+ default: false,
20
+ });
21
+ }
22
+
9
23
  export async function promptAnswers({ defaults, io, exec, env }) {
10
24
  const { confirm, input, password, select } = await import("@inquirer/prompts");
11
25
 
12
- io.write("This writes a local secrets file. Deploy afterwards with:");
13
- io.write(" context101 deploy");
14
- io.write("Press ^C to quit.");
26
+ io.write("This writes a local secrets file. Press ^C to quit.");
15
27
  io.write("");
16
28
 
17
29
  const region = await input({