@evcraddock/slug-cli 0.2.0 → 0.3.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/commands.js +18 -18
  2. package/package.json +1 -1
package/dist/commands.js CHANGED
@@ -19,8 +19,8 @@ Usage:
19
19
  slug [--config <file>] init <directory> --name <name> [--site-title <title>] [--template-url <url>] [--template-dir <dir>] [--json]
20
20
  slug [--config <file>] post list [--type article|link|note] [--status draft|published|all] [--tag <slug>] [--json]
21
21
  slug [--config <file>] post show <slug> [--json]
22
- slug [--config <file>] post create --type article|link|note --slug <slug> --content <text> [--title <text>] [--url <url>] [--excerpt <text>] [--tag <slug>]... [--source-id <id>] [--author-id <id>]... [--json]
23
- slug [--config <file>] post edit <slug> [--slug <new-slug>] [--title <text>] [--content <text>] [--url <url>] [--excerpt <text>] [--tag <slug>]... [--source-id <id>] [--author-id <id>]... [--json]
22
+ slug [--config <file>] post create --type article|link|note --slug <slug> --content <text> [--title <text>] [--url <url>] [--excerpt <text>] [--tag <slug>]... [--source-id <id>] [--credit-contact-id <id>]... [--json]
23
+ slug [--config <file>] post edit <slug> [--slug <new-slug>] [--title <text>] [--content <text>] [--url <url>] [--excerpt <text>] [--tag <slug>]... [--source-id <id>] [--credit-contact-id <id>]... [--json]
24
24
  slug [--config <file>] post delete <slug> [--json]
25
25
  slug [--config <file>] post publish <slug> [--json]
26
26
  slug [--config <file>] post unpublish <slug> [--json]
@@ -335,22 +335,20 @@ async function replaceGeneratedSitePlaceholders(directory, options) {
335
335
  await replaceTextFile(join(directory, "README.md"), [
336
336
  ["# Slugkit Template Site", `# ${options.siteTitle}`],
337
337
  [
338
- "This is the in-repo Slugkit template website. It is used for local CLI/API testing and is the source directory that future `slug init` work should copy into standalone site projects.\n\nGenerated sites should contain this website code, not the `slug` CLI source code.",
339
- "This is a standalone Slugkit-compatible website generated from the Slugkit template. This site owns its code and can be customized freely while preserving the Slugkit API contract.",
338
+ "This is the in-repo Slugkit template website. It is toolkit source used for local CLI/API development and for `slug init`; it is not itself the deployable website you hand to a site owner. Generated sites should contain this website code without the `slug` CLI source code.\n\nInitialized sites are standalone Slugkit-compatible websites. After `slug init`, the generated site owns its code and may customize routes, templates, styles, assets, and deployment freely while preserving the Slugkit API contract that the `slug` CLI uses.",
339
+ "This is a standalone Slugkit-compatible website generated from the Slugkit template. This site owns its code and can customize routes, templates, styles, assets, and deployment freely while preserving the Slugkit API contract that the `slug` CLI uses.",
340
340
  ],
341
341
  [
342
- "From the repository root:\n\n```bash\nmake dev\n```\n\nFrom this directory:\n\n```bash\nnpm run dev\n```",
343
- "From this generated site directory:\n\n```bash\nnpm run dev\n```",
342
+ "Local toolkit development can run `make garage-setup` from the Slugkit repository root after `make dev` starts Garage. Standalone initialized sites should configure these values for their own local or production S3-compatible service before uploading media.",
343
+ "Configure these values for your own local or production S3-compatible service before uploading media.",
344
344
  ],
345
345
  [
346
- "Run migrations from the repository root:",
347
- "Run migrations from this generated site directory:",
346
+ "## In-repository development\n\nWhen working inside the Slugkit toolkit repository, start the full local dev environment from the repository root:\n\n```bash\nmake dev\n```\n\nFrom `template/site`, you can also run the app and Tailwind watcher directly in separate terminals:\n\n```bash\nnpm run dev\nnpm run css:watch\n```\n\nRepository-root workspace commands are useful while developing the template itself:\n\n```bash\nnpm run db:migrate --workspace @slugkit/template-site\nnpm run db:status --workspace @slugkit/template-site\nnpm run test --workspace @slugkit/template-site\n```\n\nStandalone initialized sites should use the non-workspace commands shown in the quick start section.",
347
+ "## Local development\n\nRun the app and Tailwind watcher from this site directory in separate terminals:\n\n```bash\nnpm run dev\nnpm run css:watch\n```\n\nUse the non-workspace commands shown in the quick start section for migrations and local checks.",
348
348
  ],
349
- ["npm run db:migrate --workspace @slugkit/template-site", "npm run db:migrate"],
350
- ["npm run db:status --workspace @slugkit/template-site", "npm run db:status"],
351
349
  [
352
- "In repository-local development, run `make garage-setup` once from the repository root to create the local Garage bucket/key and fill the secret values below before normal `make dev` use.",
353
- "For local media development, configure these values for a local or remote S3-compatible service before uploading media.",
350
+ "## Related specs\n\n- [Web Spec 08: Template Setup Documentation](../../docs/web-specs/08-template-setup-documentation.md)\n- [CLI Spec 12: Site Init Command](../../docs/cli-specs/12-site-init-command.md)\n- [CLI Specs](../../docs/cli-specs/README.md)\n- [API Route Specs](../../docs/specs/README.md)",
351
+ "## Related Slugkit references\n\n- Slugkit API documentation is available from a running site at `/api/v1/docs`.\n- The CLI compatibility check is `slug doctor`.\n- The generated site marker is `.slugkit-site.json`.",
354
352
  ],
355
353
  ]);
356
354
  }
@@ -657,8 +655,9 @@ async function runLoginCommand(context, args) {
657
655
  const config = await readConfig(context.configPath);
658
656
  const apiBaseUrl = normalizeUrl(args[0] ?? config.apiBaseUrl ?? (await promptForValue(context, "API base URL: ")));
659
657
  const authUrl = createBrowserAuthUrl(apiBaseUrl);
660
- context.writer.stdout("Open this URL to create an API key:");
658
+ context.writer.stdout("Open this URL to log in and create an API key:");
661
659
  context.writer.stdout(authUrl);
660
+ context.writer.stdout("If a browser does not open, copy the URL into your browser manually.");
662
661
  if (context.openUrl !== undefined) {
663
662
  try {
664
663
  await context.openUrl(authUrl);
@@ -667,6 +666,7 @@ async function runLoginCommand(context, args) {
667
666
  context.writer.stdout("Could not open a browser automatically.");
668
667
  }
669
668
  }
669
+ context.writer.stdout(`Paste the API key from the website. The CLI will verify it and save it to ${context.configPath}.`);
670
670
  const apiKey = (await promptForValue(context, "API key: ")).trim();
671
671
  if (apiKey === "") {
672
672
  throw createInvalidUsageError("API key is required");
@@ -742,7 +742,7 @@ async function runPostsCreateCommand(context, args) {
742
742
  "excerpt",
743
743
  "tag",
744
744
  "source-id",
745
- "author-id",
745
+ "credit-contact-id",
746
746
  ]);
747
747
  const body = createPostMutationInput(parsed.options, true);
748
748
  const api = await createConfiguredApiContext(context);
@@ -768,7 +768,7 @@ async function runPostsEditCommand(context, args) {
768
768
  "excerpt",
769
769
  "tag",
770
770
  "source-id",
771
- "author-id",
771
+ "credit-contact-id",
772
772
  ]);
773
773
  const body = createPostMutationInput(parsed.options, false);
774
774
  if (Object.keys(body).length === 0) {
@@ -828,7 +828,7 @@ function parsePostFlags(args, allowed) {
828
828
  if (value === undefined || value.startsWith("--")) {
829
829
  throw createInvalidUsageError(`Option --${key} requires a value`);
830
830
  }
831
- if (key === "tag" || key === "author-id") {
831
+ if (key === "tag" || key === "credit-contact-id") {
832
832
  const current = options[key];
833
833
  options[key] = [...(Array.isArray(current) ? current : []), value];
834
834
  }
@@ -851,8 +851,8 @@ function createPostMutationInput(options, requireCreateFields) {
851
851
  if (Array.isArray(options.tag)) {
852
852
  input.tagSlugs = options.tag;
853
853
  }
854
- if (Array.isArray(options["author-id"])) {
855
- input.authorIds = options["author-id"].map((value) => readPositiveInteger(value, "author-id"));
854
+ if (Array.isArray(options["credit-contact-id"])) {
855
+ input.creditContactIds = options["credit-contact-id"].map((value) => readPositiveInteger(value, "credit-contact-id"));
856
856
  }
857
857
  if (requireCreateFields) {
858
858
  for (const key of ["type", "slug", "content"]) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evcraddock/slug-cli",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Command-line tool for Slugkit sites.",
5
5
  "private": false,
6
6
  "type": "module",