intentdocs 0.10.0 → 0.11.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 (30) hide show
  1. package/README.md +6 -1
  2. package/dist/chunk-64I7RLP3.js +171 -0
  3. package/dist/{chunk-IDNUBI2P.js → chunk-65EDM7QH.js} +6 -6
  4. package/dist/{chunk-NFIXRIHM.js → chunk-BNEU6TLJ.js} +55 -21
  5. package/dist/chunk-GFKZ5CRL.js +12 -0
  6. package/dist/{chunk-5USVG4DW.js → chunk-ID4B5RZ2.js} +42 -21
  7. package/dist/{chunk-EEKEF2FD.js → chunk-IORMKLAQ.js} +178 -121
  8. package/dist/{chunk-UF535HZL.js → chunk-K5SNF6CG.js} +13 -2
  9. package/dist/{chunk-HEHHSSUM.js → chunk-KPQ42YE6.js} +1 -1
  10. package/dist/{chunk-YUW3W43S.js → chunk-KTGQO3AE.js} +31 -8
  11. package/dist/{chunk-UR73WX5I.js → chunk-UQDMUKLP.js} +2 -2
  12. package/dist/{chunk-LXQXJULN.js → chunk-XZE2XP6O.js} +3 -3
  13. package/dist/ci-NOCV3XUV.js +11 -0
  14. package/dist/{complexity-ZOB3BPVD.js → complexity-OJVM37NF.js} +4 -4
  15. package/dist/{import-prd-MJUCIMHX.js → import-prd-5FCVXCYO.js} +14 -7
  16. package/dist/index.js +377 -359
  17. package/dist/{keys-5PA3D6CX.js → keys-2W5V56FS.js} +32 -11
  18. package/dist/{log-EVLWM64C.js → log-DFCCAAJN.js} +23 -7
  19. package/dist/{map-extract-W6WJLVOF.js → map-extract-YUCFLGJS.js} +2 -2
  20. package/dist/{map-import-LL4AIAQE.js → map-import-7RN2NEUZ.js} +7 -6
  21. package/dist/{map-schema-6GL2UKZQ.js → map-schema-5BEIJM2J.js} +1 -1
  22. package/dist/{projects-F7GMH66U.js → projects-AYAYVFKL.js} +2 -2
  23. package/dist/push-33V7ANJW.js +462 -0
  24. package/dist/{research-4ASCZSZN.js → research-SHO5SXVQ.js} +4 -4
  25. package/dist/scope-RRGJHS2G.js +13 -0
  26. package/dist/setup-UILQVYIB.js +14 -0
  27. package/package.json +6 -5
  28. package/dist/ci-LBOCMRKZ.js +0 -11
  29. package/dist/scope-S3LZZ3KB.js +0 -11
  30. package/dist/setup-YLUPBLK6.js +0 -14
@@ -4,11 +4,21 @@ import {
4
4
  } from "./chunk-WRRUCCVZ.js";
5
5
  import {
6
6
  requireValidAuth
7
- } from "./chunk-LXQXJULN.js";
7
+ } from "./chunk-XZE2XP6O.js";
8
8
  import "./chunk-UYTVTYNB.js";
9
9
 
10
10
  // src/commands/keys.ts
11
11
  var KEYS_DOC_URL = "https://console.anthropic.com/settings/keys";
12
+ var XAI_KEYS_URL = "https://console.x.ai/";
13
+ var ANTHROPIC_RE = /^sk-ant-[A-Za-z0-9_-]{24,250}$/;
14
+ var XAI_RE = /^xai-[A-Za-z0-9_-]{20,250}$/;
15
+ var OPENAI_PROJ_RE = /^sk-proj-[A-Za-z0-9_-]{20,250}$/;
16
+ var OPENAI_SK_RE = /^sk-[A-Za-z0-9_-]{20,250}$/;
17
+ function acceptedLocally(value) {
18
+ if (ANTHROPIC_RE.test(value) || XAI_RE.test(value) || OPENAI_PROJ_RE.test(value)) return true;
19
+ if (!OPENAI_SK_RE.test(value)) return false;
20
+ return !/^(sk-ant-|sk-proj-|sk-admin-|sk-svcacct-)/.test(value);
21
+ }
12
22
  async function byokRequest(method, body) {
13
23
  const auth = await requireValidAuth();
14
24
  const res = await fetch(`${auth.apiBase}/api/settings/byok`, {
@@ -25,15 +35,20 @@ async function byokRequest(method, body) {
25
35
  async function keysSet(key) {
26
36
  let value = key?.trim();
27
37
  if (!value) {
28
- console.log("\n Optionally add your Anthropic API key to unlock AI features on any plan.");
38
+ console.log("\n Optionally add an Anthropic, xAI, or OpenAI API key to unlock AI features on any plan.");
29
39
  console.log(" Your key is encrypted at rest and only used for your AI operations.");
30
- console.log(` Get one at: ${KEYS_DOC_URL}
31
- `);
32
- value = (await ask(" Anthropic API key (sk-ant-...): ")).trim();
40
+ console.log(` Anthropic keys start with sk-ant-. Get one at: ${KEYS_DOC_URL}`);
41
+ console.log(` xAI keys start with xai-. Get one at: ${XAI_KEYS_URL}`);
42
+ console.log(" OpenAI keys start with sk- or sk-proj-. Get one at: https://platform.openai.com/api-keys\n");
43
+ value = (await ask(" API key (sk-ant-..., xai-..., sk-..., or sk-proj-...): ")).trim();
33
44
  closePrompt();
34
45
  }
35
46
  if (!value) {
36
- console.error(" No key provided. Run `intentdocs keys set` to try again.");
47
+ console.error(" No key provided. Run `npx intentdocs keys set` to try again.");
48
+ process.exit(1);
49
+ }
50
+ if (!acceptedLocally(value)) {
51
+ console.error("\n \u2717 That key is not accepted. Use an sk-ant- key, an xai- key, an sk- key, or an sk-proj- key.");
37
52
  process.exit(1);
38
53
  }
39
54
  try {
@@ -59,12 +74,18 @@ async function keysStatus() {
59
74
  process.exit(1);
60
75
  }
61
76
  if (data?.enabled) {
77
+ const anthropic = data.anthropic?.mask || "not set";
78
+ const xai = data.xai?.mask || "not set";
79
+ const openai = data.openai?.mask || "not set";
62
80
  console.log(`
63
- Anthropic API key: ${data.maskedKey ?? "(stored but unreadable \u2014 re-run `intentdocs keys set`)"}`);
64
- console.log(" AI features run on your key.\n");
81
+ Anthropic API key: ${anthropic}`);
82
+ console.log(` xAI API key: ${xai}`);
83
+ console.log(` OpenAI API key: ${openai}`);
84
+ if (data.active_provider) console.log(` Active: ${data.active_provider}`);
85
+ console.log(" AI features run on your active key.\n");
65
86
  } else {
66
- console.log("\n No Anthropic API key set.");
67
- console.log(" Add one with `intentdocs keys set` to unlock AI features on any plan.\n");
87
+ console.log("\n No API key set.");
88
+ console.log(" Add an sk-ant-, xai-, sk-, or sk-proj- key with `npx intentdocs keys set` to unlock AI features on any plan.\n");
68
89
  }
69
90
  } catch {
70
91
  console.error(" \u2717 Could not reach intentdocs. Check your connection and try again.");
@@ -78,7 +99,7 @@ async function keysRemove() {
78
99
  console.error(" \u2717 Failed to remove your key.");
79
100
  process.exit(1);
80
101
  }
81
- console.log("\n Key removed. AI features fall back to your plan's platform limits.\n");
102
+ console.log("\n Key removed. Revoke it at the provider. AI features fall back when no key remains.\n");
82
103
  } catch {
83
104
  console.error(" \u2717 Could not reach intentdocs. Check your connection and try again.");
84
105
  process.exit(1);
@@ -1,7 +1,10 @@
1
+ import {
2
+ appendToNotes
3
+ } from "./chunk-GFKZ5CRL.js";
1
4
  import {
2
5
  appendNoteToContext,
3
6
  storyContextPath
4
- } from "./chunk-NFIXRIHM.js";
7
+ } from "./chunk-BNEU6TLJ.js";
5
8
  import {
6
9
  matchesStoryRef
7
10
  } from "./chunk-LQTPZL2Y.js";
@@ -9,18 +12,19 @@ import {
9
12
  amendDecision,
10
13
  apiFetch,
11
14
  listDecisions,
15
+ listStories,
12
16
  retractDecision
13
- } from "./chunk-YUW3W43S.js";
17
+ } from "./chunk-KTGQO3AE.js";
14
18
  import {
15
19
  requireConfig
16
- } from "./chunk-UF535HZL.js";
20
+ } from "./chunk-K5SNF6CG.js";
17
21
  import {
18
22
  ask,
19
23
  closePrompt,
20
24
  confirm,
21
25
  isInteractive
22
26
  } from "./chunk-WRRUCCVZ.js";
23
- import "./chunk-LXQXJULN.js";
27
+ import "./chunk-XZE2XP6O.js";
24
28
  import "./chunk-UYTVTYNB.js";
25
29
 
26
30
  // src/commands/log.ts
@@ -38,6 +42,18 @@ async function logDecision(title, opts) {
38
42
  closePrompt();
39
43
  return;
40
44
  }
45
+ let storyId;
46
+ if (opts?.story) {
47
+ const { stories } = await listStories(config);
48
+ const match = stories.find((s) => matchesStoryRef(s, opts.story));
49
+ if (!match) {
50
+ console.error(` No story found matching "${opts.story}" \u2014 decision not logged.`);
51
+ closePrompt();
52
+ process.exitCode = 1;
53
+ return;
54
+ }
55
+ storyId = match.id;
56
+ }
41
57
  const res = await apiFetch(config, "/decisions", {
42
58
  method: "POST",
43
59
  headers: { "Content-Type": "application/json" },
@@ -45,7 +61,7 @@ async function logDecision(title, opts) {
45
61
  title: title.trim(),
46
62
  description: description.trim(),
47
63
  category: opts?.category ?? "technical",
48
- story_id: opts?.story ?? void 0
64
+ story_id: storyId
49
65
  })
50
66
  });
51
67
  if (res.ok) {
@@ -69,7 +85,7 @@ async function listLoggedDecisions() {
69
85
  const config = requireConfig();
70
86
  const { decisions } = await listDecisions(config);
71
87
  if (decisions.length === 0) {
72
- console.log(" No decisions logged yet. Run `intent decide` to log one.");
88
+ console.log(" No decisions logged yet. Run `npx intentdocs decide` to log one.");
73
89
  return;
74
90
  }
75
91
  console.log();
@@ -182,7 +198,7 @@ async function logNote(storyId, note) {
182
198
  method: "PATCH",
183
199
  headers: { "Content-Type": "application/json" },
184
200
  body: JSON.stringify({
185
- stories: [{ id: match.id, notes: note.trim() }]
201
+ stories: [{ id: match.id, notes: appendToNotes(match.notes, note) }]
186
202
  })
187
203
  });
188
204
  if (res.ok) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  requireConfig
3
- } from "./chunk-UF535HZL.js";
3
+ } from "./chunk-K5SNF6CG.js";
4
4
  import "./chunk-UYTVTYNB.js";
5
5
 
6
6
  // src/commands/map-extract.ts
@@ -85,7 +85,7 @@ Field rules:
85
85
  4. Hand back to intentdocs
86
86
  After writing storymap.json, run:
87
87
 
88
- intent map import ./storymap.json
88
+ npx intentdocs map import ./storymap.json
89
89
 
90
90
  Then tell me (the founder): a one-paragraph summary of the map you produced, the count of stories by confidence level, and the top open questions you need me to answer.`;
91
91
  console.log("\n Copy the prompt below and paste it into your coding agent");
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  isPlanGated,
3
3
  printUpgradeMessage
4
- } from "./chunk-UR73WX5I.js";
4
+ } from "./chunk-UQDMUKLP.js";
5
5
  import {
6
6
  apiUrl,
7
7
  syncHeaders
8
- } from "./chunk-YUW3W43S.js";
8
+ } from "./chunk-KTGQO3AE.js";
9
9
  import {
10
10
  requireConfig
11
- } from "./chunk-UF535HZL.js";
11
+ } from "./chunk-K5SNF6CG.js";
12
12
  import {
13
13
  closePrompt,
14
14
  confirm
15
15
  } from "./chunk-WRRUCCVZ.js";
16
- import "./chunk-LXQXJULN.js";
16
+ import "./chunk-XZE2XP6O.js";
17
17
  import "./chunk-UYTVTYNB.js";
18
18
 
19
19
  // src/commands/map-import.ts
@@ -322,11 +322,12 @@ async function mapImport(filePath, opts) {
322
322
  return;
323
323
  }
324
324
  if (res.status === 401) {
325
- uploadSpinner.fail(" Sync token expired or invalid");
325
+ uploadSpinner.fail(" Your login is no longer valid");
326
326
  console.error(
327
- "\n Your sync token has expired. Run \x1B[36mstc link\x1B[0m to generate a fresh one.\n"
327
+ "\n Run \x1B[36mnpx intentdocs login\x1B[0m to log in again, then re-run the import.\n"
328
328
  );
329
329
  closePrompt();
330
+ process.exitCode = 1;
330
331
  return;
331
332
  }
332
333
  uploadSpinner.fail(" Upload failed");
@@ -2,7 +2,7 @@
2
2
  var SCHEMA = {
3
3
  $schema: "https://json-schema.org/draft/2020-12/schema",
4
4
  title: "IntentDocs Story Map",
5
- description: "Schema for storymap.json files produced by `intentdocs map extract` and consumed by `intentdocs map import`.",
5
+ description: "Schema for storymap.json files produced by `npx intentdocs map extract` and consumed by `npx intentdocs map import`.",
6
6
  type: "object",
7
7
  required: ["schema_version", "source", "product_summary", "backbone"],
8
8
  additionalProperties: false,
@@ -2,7 +2,7 @@ import {
2
2
  authenticatedFetch,
3
3
  bindingLabel,
4
4
  getAuth
5
- } from "./chunk-LXQXJULN.js";
5
+ } from "./chunk-XZE2XP6O.js";
6
6
  import "./chunk-UYTVTYNB.js";
7
7
 
8
8
  // src/commands/projects.ts
@@ -29,7 +29,7 @@ async function projects() {
29
29
  if (p.description) console.log(` ${p.description.slice(0, 100)}`);
30
30
  }
31
31
  console.log(`
32
- ${data.projects.length} ${data.projects.length === 1 ? "project" : "projects"}. Check one out with: intentdocs init
32
+ ${data.projects.length} ${data.projects.length === 1 ? "project" : "projects"}. Check one out with: npx intentdocs init
33
33
  `);
34
34
  }
35
35
  export {