intentdocs 0.12.1 → 0.12.2
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/dist/{chunk-SDXDVNNP.js → chunk-2NSRHMTH.js} +1 -1
- package/dist/{chunk-5GATVQEI.js → chunk-2VM54R5K.js} +1 -1
- package/dist/{chunk-Q6BSSJK5.js → chunk-7ONMS2RJ.js} +2 -2
- package/dist/{chunk-RGFGTIIH.js → chunk-HWMSGXLQ.js} +9 -0
- package/dist/{pull-MDI63WI7.js → chunk-JDK3RCQU.js} +31 -10
- package/dist/{ci-CWPLSRCQ.js → ci-LG4NM2DU.js} +2 -2
- package/dist/{complexity-HLJTXY55.js → complexity-6XVLG3EH.js} +1 -1
- package/dist/{import-prd-FQI4J45M.js → import-prd-DTO5LTWA.js} +1 -1
- package/dist/index.js +22 -22
- package/dist/{log-VTIAG4PC.js → log-ELEPANI3.js} +1 -1
- package/dist/{map-extract-4C44YGGD.js → map-extract-MUGIIXTP.js} +1 -1
- package/dist/{map-import-TSSDU766.js → map-import-TDBELC77.js} +1 -1
- package/dist/pull-6GAAR6NP.js +17 -0
- package/dist/{push-7LJ654MJ.js → push-62T2TMKN.js} +25 -4
- package/dist/{research-L27DLYXC.js → research-XMUAQOVB.js} +1 -1
- package/dist/{scope-ORIFXV4P.js → scope-PFHPW6Y6.js} +2 -2
- package/dist/{setup-W4PKG6GB.js → setup-5ZNAOKQK.js} +2 -2
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
checkoutConfig,
|
|
6
6
|
hasConfig,
|
|
7
7
|
writeConfig
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-HWMSGXLQ.js";
|
|
9
9
|
import {
|
|
10
10
|
ask,
|
|
11
11
|
closePrompt,
|
|
@@ -196,7 +196,7 @@ async function scope(projectId) {
|
|
|
196
196
|
" Configure your AI tool (Claude Code / Cursor) with intentdocs agent workflows?"
|
|
197
197
|
);
|
|
198
198
|
if (wantSetup) {
|
|
199
|
-
const { setup } = await import("./setup-
|
|
199
|
+
const { setup } = await import("./setup-5ZNAOKQK.js");
|
|
200
200
|
await setup();
|
|
201
201
|
return;
|
|
202
202
|
}
|
|
@@ -442,6 +442,14 @@ function newFeature(key, remote) {
|
|
|
442
442
|
return `${[head, ...scenarios].join("\n\n")}
|
|
443
443
|
`;
|
|
444
444
|
}
|
|
445
|
+
function freeKeys(prefix, used, count) {
|
|
446
|
+
let top = 0;
|
|
447
|
+
for (const key of used) {
|
|
448
|
+
const m = new RegExp(`^${prefix}-(\\d+)$`).exec(key);
|
|
449
|
+
if (m) top = Math.max(top, Number(m[1]));
|
|
450
|
+
}
|
|
451
|
+
return Array.from({ length: count }, (_, i) => `${prefix}-${top + 1 + i}`);
|
|
452
|
+
}
|
|
445
453
|
|
|
446
454
|
// src/lib/config.ts
|
|
447
455
|
import { readFileSync as readFileSync2, writeFileSync, mkdirSync, existsSync as existsSync2 } from "fs";
|
|
@@ -526,6 +534,7 @@ export {
|
|
|
526
534
|
classify,
|
|
527
535
|
renderFeature,
|
|
528
536
|
newFeature,
|
|
537
|
+
freeKeys,
|
|
529
538
|
checkoutConfig,
|
|
530
539
|
hasConfig,
|
|
531
540
|
readConfig,
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
classify,
|
|
6
6
|
featureFiles,
|
|
7
7
|
findIntentDir,
|
|
8
|
+
freeKeys,
|
|
8
9
|
newFeature,
|
|
9
10
|
parseFeature,
|
|
10
11
|
readIntentFolder,
|
|
@@ -15,15 +16,13 @@ import {
|
|
|
15
16
|
specOfPushStory,
|
|
16
17
|
specOfStory,
|
|
17
18
|
writeSyncBase
|
|
18
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-HWMSGXLQ.js";
|
|
19
20
|
import {
|
|
20
21
|
choose,
|
|
21
22
|
closePrompt,
|
|
22
23
|
confirm,
|
|
23
24
|
isInteractive
|
|
24
25
|
} from "./chunk-WRRUCCVZ.js";
|
|
25
|
-
import "./chunk-XZE2XP6O.js";
|
|
26
|
-
import "./chunk-UYTVTYNB.js";
|
|
27
26
|
|
|
28
27
|
// src/commands/pull.ts
|
|
29
28
|
import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "fs";
|
|
@@ -254,6 +253,8 @@ function planUnits(deps, response, base, nextBase, outcome) {
|
|
|
254
253
|
});
|
|
255
254
|
}
|
|
256
255
|
}
|
|
256
|
+
const synced = Object.keys(base.stories).length > 0;
|
|
257
|
+
const numberTaken = (key, mine, theirs) => synced && !(key in base.stories) && specOfPushStory(mine).title !== theirs.title;
|
|
257
258
|
const live = response.stories.filter((s) => s.key);
|
|
258
259
|
outcome.cancelled = live.filter((s) => s.cancelled_at && files.has(s.key)).map((s) => s.key);
|
|
259
260
|
for (const story of live.filter((s) => !s.cancelled_at)) {
|
|
@@ -261,7 +262,9 @@ function planUnits(deps, response, base, nextBase, outcome) {
|
|
|
261
262
|
const theirs = specOfStory(story, storymap.activities ?? []);
|
|
262
263
|
const mine = local.get(key);
|
|
263
264
|
const path = files.get(key);
|
|
264
|
-
if (mine && path) {
|
|
265
|
+
if (mine && path && numberTaken(key, mine, theirs)) {
|
|
266
|
+
outcome.numberTaken.push(key);
|
|
267
|
+
} else if (mine && path) {
|
|
265
268
|
const kind = classify(specOfPushStory(mine), theirs, base.stories[key]);
|
|
266
269
|
if (kind === null) nextBase.stories[key] = theirs;
|
|
267
270
|
else if (kind === "local") outcome.localOnly.push(key);
|
|
@@ -320,7 +323,7 @@ function planUnits(deps, response, base, nextBase, outcome) {
|
|
|
320
323
|
}
|
|
321
324
|
const statusChanges = [];
|
|
322
325
|
const notMoved = [];
|
|
323
|
-
for (const s of live.filter((s2) => !s2.cancelled_at && STATUSES.has(s2.status) && state.stories?.[s2.key])) {
|
|
326
|
+
for (const s of live.filter((s2) => !s2.cancelled_at && STATUSES.has(s2.status) && state.stories?.[s2.key] && !outcome.numberTaken.includes(s2.key))) {
|
|
324
327
|
const key = s.key;
|
|
325
328
|
const mine = state.stories[key].status ?? "todo";
|
|
326
329
|
const was = base.statuses[key];
|
|
@@ -345,7 +348,7 @@ function planUnits(deps, response, base, nextBase, outcome) {
|
|
|
345
348
|
}
|
|
346
349
|
});
|
|
347
350
|
}
|
|
348
|
-
for (const story of live.filter((s) => !s.cancelled_at && s.agent_plan && files.has(s.key) && local.has(s.key))) {
|
|
351
|
+
for (const story of live.filter((s) => !s.cancelled_at && s.agent_plan && files.has(s.key) && local.has(s.key) && !outcome.numberTaken.includes(s.key))) {
|
|
349
352
|
const key = story.key;
|
|
350
353
|
const plan = story.agent_plan;
|
|
351
354
|
if ((base.plans[key] ?? 0) >= plan.version) continue;
|
|
@@ -369,11 +372,23 @@ function planUnits(deps, response, base, nextBase, outcome) {
|
|
|
369
372
|
}
|
|
370
373
|
return units;
|
|
371
374
|
}
|
|
375
|
+
function numberTakenAdvice(keys, used) {
|
|
376
|
+
const prefix = keys[0].replace(/-\d+$/, "");
|
|
377
|
+
const next = freeKeys(prefix, used, keys.length);
|
|
378
|
+
return [
|
|
379
|
+
`
|
|
380
|
+
${keys.join(", ")} ${keys.length === 1 ? "is" : "are"} used by a different story in intentdocs, made since this folder last synced. Neither was changed.`,
|
|
381
|
+
" 1. Give the folder's " + (keys.length === 1 ? "story a number" : "stories numbers") + " that isn't taken: " + keys.map((k, i) => `${k} \u2192 ${next[i]}`).join(", ") + ".",
|
|
382
|
+
" Change it in the feature file's tag, storymap.yaml, state.yaml and any plans/<key>.v*.md.",
|
|
383
|
+
" 2. Run `intentdocs pull` to bring intentdocs' " + keys.join(", ") + " into the folder.",
|
|
384
|
+
" 3. Run `intentdocs push` to send the renumbered " + (keys.length === 1 ? "story" : "stories") + "."
|
|
385
|
+
];
|
|
386
|
+
}
|
|
372
387
|
async function runPull(deps) {
|
|
373
388
|
const response = await deps.listStories();
|
|
374
389
|
const base = deps.readSyncBase();
|
|
375
390
|
const nextBase = structuredClone(base);
|
|
376
|
-
const outcome = { units: [], written: [], localOnly: [], cancelled: [], statusNotMoved: [] };
|
|
391
|
+
const outcome = { units: [], written: [], localOnly: [], cancelled: [], statusNotMoved: [], numberTaken: [] };
|
|
377
392
|
outcome.units = planUnits(deps, response, base, nextBase, outcome);
|
|
378
393
|
const disk = new Files(deps.readFile);
|
|
379
394
|
for (const unit of outcome.units) {
|
|
@@ -394,11 +409,15 @@ Changed only in the repo, so nothing to pull: ${outcome.localOnly.join(", ")}. \
|
|
|
394
409
|
deps.log(`
|
|
395
410
|
intentdocs hasn't moved these since the last sync, so their status here is kept: ${outcome.statusNotMoved.join(", ")}.`);
|
|
396
411
|
if (outcome.cancelled.length) deps.log(`Cancelled in intentdocs, left as they are here: ${outcome.cancelled.join(", ")}.`);
|
|
412
|
+
if (outcome.numberTaken.length) {
|
|
413
|
+
const used = [...response.stories.map((s) => s.key ?? ""), ...featureFiles(findIntentDir(deps.cwd)).keys()];
|
|
414
|
+
for (const line of numberTakenAdvice(outcome.numberTaken, used)) deps.log(line);
|
|
415
|
+
}
|
|
397
416
|
const safe = outcome.units.filter((u) => u.kind === "web");
|
|
398
417
|
const risky = outcome.units.filter((u) => u.kind !== "web");
|
|
399
418
|
const apply = /* @__PURE__ */ new Set();
|
|
400
419
|
if (outcome.units.length === 0) {
|
|
401
|
-
if (!outcome.localOnly.length && !outcome.statusNotMoved.length) deps.log("\nThe repo already matches intentdocs.");
|
|
420
|
+
if (!outcome.localOnly.length && !outcome.statusNotMoved.length && !outcome.numberTaken.length) deps.log("\nThe repo already matches intentdocs.");
|
|
402
421
|
} else if (deps.yes) {
|
|
403
422
|
for (const u of safe) apply.add(u);
|
|
404
423
|
if (risky.length) deps.log(`
|
|
@@ -469,8 +488,10 @@ async function pull(opts = {}) {
|
|
|
469
488
|
closePrompt();
|
|
470
489
|
}
|
|
471
490
|
}
|
|
491
|
+
|
|
472
492
|
export {
|
|
473
493
|
PullError,
|
|
474
|
-
|
|
475
|
-
runPull
|
|
494
|
+
numberTakenAdvice,
|
|
495
|
+
runPull,
|
|
496
|
+
pull
|
|
476
497
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ci
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-2VM54R5K.js";
|
|
4
4
|
import "./chunk-KPQ42YE6.js";
|
|
5
|
-
import "./chunk-
|
|
5
|
+
import "./chunk-HWMSGXLQ.js";
|
|
6
6
|
import "./chunk-WRRUCCVZ.js";
|
|
7
7
|
import "./chunk-XZE2XP6O.js";
|
|
8
8
|
import "./chunk-UYTVTYNB.js";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
login,
|
|
4
|
+
logout
|
|
5
|
+
} from "./chunk-64I7RLP3.js";
|
|
2
6
|
import {
|
|
3
7
|
appendToNotes
|
|
4
8
|
} from "./chunk-GFKZ5CRL.js";
|
|
@@ -8,11 +12,11 @@ import {
|
|
|
8
12
|
} from "./chunk-UQDMUKLP.js";
|
|
9
13
|
import {
|
|
10
14
|
ci
|
|
11
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-2VM54R5K.js";
|
|
12
16
|
import {
|
|
13
17
|
setup,
|
|
14
18
|
sync
|
|
15
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-2NSRHMTH.js";
|
|
16
20
|
import {
|
|
17
21
|
criterionPriority,
|
|
18
22
|
criterionStatusLabel,
|
|
@@ -31,11 +35,7 @@ import {
|
|
|
31
35
|
} from "./chunk-KPQ42YE6.js";
|
|
32
36
|
import {
|
|
33
37
|
scope
|
|
34
|
-
} from "./chunk-
|
|
35
|
-
import {
|
|
36
|
-
login,
|
|
37
|
-
logout
|
|
38
|
-
} from "./chunk-64I7RLP3.js";
|
|
38
|
+
} from "./chunk-7ONMS2RJ.js";
|
|
39
39
|
import {
|
|
40
40
|
amendDecision,
|
|
41
41
|
apiFetch,
|
|
@@ -57,7 +57,7 @@ import {
|
|
|
57
57
|
readConfig,
|
|
58
58
|
requireConfig,
|
|
59
59
|
writeConfig
|
|
60
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-HWMSGXLQ.js";
|
|
61
61
|
import {
|
|
62
62
|
ask,
|
|
63
63
|
closePrompt,
|
|
@@ -304,7 +304,7 @@ Connecting to "${map2.title}"${project.workspace ? ` in ${project.workspace.name
|
|
|
304
304
|
await offerAllowList((q) => ask2(rl, q));
|
|
305
305
|
const setUpCi = await ask2(rl, " Set up CI test reporting now? It creates a key and adds the workflow. (y/N): ");
|
|
306
306
|
if (/^y(es)?$/i.test(setUpCi.trim())) {
|
|
307
|
-
const { ci: ci2 } = await import("./ci-
|
|
307
|
+
const { ci: ci2 } = await import("./ci-LG4NM2DU.js");
|
|
308
308
|
await ci2();
|
|
309
309
|
} else {
|
|
310
310
|
console.log(" You can run `npx intentdocs ci` any time to turn it on.\n");
|
|
@@ -1663,7 +1663,7 @@ async function start() {
|
|
|
1663
1663
|
closePrompt();
|
|
1664
1664
|
return;
|
|
1665
1665
|
}
|
|
1666
|
-
const { scope: scope2 } = await import("./scope-
|
|
1666
|
+
const { scope: scope2 } = await import("./scope-PFHPW6Y6.js");
|
|
1667
1667
|
await scope2(projectId);
|
|
1668
1668
|
}
|
|
1669
1669
|
|
|
@@ -3048,10 +3048,10 @@ program.command("projects").description("List the projects your token can reach
|
|
|
3048
3048
|
import("./projects-AYAYVFKL.js").then((m) => void m.projects());
|
|
3049
3049
|
});
|
|
3050
3050
|
program.command("push").description("Upload this repo's nikOS intent/ folder: log in, create the project, and link the repo").action(() => {
|
|
3051
|
-
import("./push-
|
|
3051
|
+
import("./push-62T2TMKN.js").then((m) => m.push());
|
|
3052
3052
|
});
|
|
3053
3053
|
program.command("pull").description("Show web edits to this repo's feature files as a diff, then write the ones you agree to").option("-y, --yes", "write web changes without asking (never settles a story changed on both sides)").action((opts) => {
|
|
3054
|
-
import("./pull-
|
|
3054
|
+
import("./pull-6GAAR6NP.js").then((m) => m.pull(opts));
|
|
3055
3055
|
});
|
|
3056
3056
|
program.command("init [token]").description("Connect this project to a intentdocs story map").action((token) => void init(token));
|
|
3057
3057
|
program.command("sync").description("Refresh INTENT.md from the live story map").option("--context", "Refresh only the CLAUDE.md/AGENTS.md context file (not stories)").action((opts) => void sync(opts));
|
|
@@ -3066,36 +3066,36 @@ program.command("done <id>").description("Mark a story as done (accepts its key
|
|
|
3066
3066
|
program.command("stop <id>").description("Stop development of an in-progress story (resets to todo, signals agents to stop; accepts its key or an ID prefix)").action((id) => void stop(id));
|
|
3067
3067
|
program.command("add <title>").description("Create a new story").option("-a, --activity <activity>", "Activity to add the story under").option("-p, --priority <priority>", "Priority: must, should, could", "should").option("-e, --effort <effort>", "Effort: S, M, L, XL", "M").action((title, opts) => void add(title, opts));
|
|
3068
3068
|
var decide = program.command("decide [title]").description("Log an architectural or product decision").option("-d, --description <desc>", "Decision description").option("-c, --category <cat>", "Category: architecture, product, technical, trade-off", "technical").option("-s, --story <id>", "Link to a story (its key like PB-42, or an ID prefix)").action((title, opts) => {
|
|
3069
|
-
import("./log-
|
|
3069
|
+
import("./log-ELEPANI3.js").then((m) => void m.logDecision(title, opts));
|
|
3070
3070
|
});
|
|
3071
3071
|
decide.command("list").description("List logged decisions (id, category, title)").action(() => {
|
|
3072
|
-
import("./log-
|
|
3072
|
+
import("./log-ELEPANI3.js").then((m) => void m.listLoggedDecisions());
|
|
3073
3073
|
});
|
|
3074
3074
|
decide.command("amend <id>").description("Amend a logged decision's title, description, or category (accepts an ID prefix)").option("-t, --title <title>", "New title").option("-d, --description <desc>", "New description").option("-c, --category <cat>", "New category: architecture, product, technical, trade-off").action((id, opts) => {
|
|
3075
|
-
import("./log-
|
|
3075
|
+
import("./log-ELEPANI3.js").then((m) => void m.amendDecision(id, opts));
|
|
3076
3076
|
});
|
|
3077
3077
|
decide.command("delete <id>").alias("retract").description("Retract a logged decision \u2014 soft-deleted and audited, not removed (accepts an ID prefix)").option("-r, --reason <reason>", "Why this decision is being retracted").option("-y, --yes", "Skip the confirmation prompt (required when there's no TTY)").action((id, opts) => {
|
|
3078
|
-
import("./log-
|
|
3078
|
+
import("./log-ELEPANI3.js").then((m) => void m.deleteDecision(id, opts));
|
|
3079
3079
|
});
|
|
3080
3080
|
program.command("note <storyId> [note]").description("Add an implementation note to a story (appended to its notes)").action((storyId, note) => {
|
|
3081
|
-
import("./log-
|
|
3081
|
+
import("./log-ELEPANI3.js").then((m) => void m.logNote(storyId, note));
|
|
3082
3082
|
});
|
|
3083
3083
|
program.command("example").description("Add a few-shot reference pattern (before/after code) to the project").action(() => void example());
|
|
3084
3084
|
program.command("complexity [storyId]").description("Analyze story complexity with AI \u2014 scores, risks, effort estimates").action((id) => {
|
|
3085
|
-
import("./complexity-
|
|
3085
|
+
import("./complexity-6XVLG3EH.js").then((m) => void m.complexity(id));
|
|
3086
3086
|
});
|
|
3087
3087
|
program.command("research [query]").description("Research a topic with AI using your project context").action((query) => {
|
|
3088
|
-
import("./research-
|
|
3088
|
+
import("./research-XMUAQOVB.js").then((m) => void m.research(query));
|
|
3089
3089
|
});
|
|
3090
3090
|
program.command("import [file]").description("Import a PRD or spec into your story map as stories (reads standard input when no file is given; needs --yes then)").option("-y, --yes", "Import without asking for confirmation (required when reading from standard input)").action((file, opts) => {
|
|
3091
|
-
import("./import-prd-
|
|
3091
|
+
import("./import-prd-DTO5LTWA.js").then((m) => void m.importPrd(file, opts));
|
|
3092
3092
|
});
|
|
3093
3093
|
var map = program.command("map").description("Import or extract story maps from codebases");
|
|
3094
3094
|
map.command("extract").description("Output a prompt for your coding agent to extract a story map from an existing codebase").action(() => {
|
|
3095
|
-
import("./map-extract-
|
|
3095
|
+
import("./map-extract-MUGIIXTP.js").then((m) => void m.mapExtract());
|
|
3096
3096
|
});
|
|
3097
3097
|
map.command("import <file>").description("Import a storymap.json file generated by your coding agent").option("--yes", "Skip confirmation prompt").action((file, opts) => {
|
|
3098
|
-
import("./map-import-
|
|
3098
|
+
import("./map-import-TDBELC77.js").then((m) => void m.mapImport(file, opts));
|
|
3099
3099
|
});
|
|
3100
3100
|
map.command("schema").description("Print the JSON Schema for storymap.json").action(() => {
|
|
3101
3101
|
import("./map-schema-5BEIJM2J.js").then((m) => void m.mapSchema());
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PullError,
|
|
3
|
+
numberTakenAdvice,
|
|
4
|
+
pull,
|
|
5
|
+
runPull
|
|
6
|
+
} from "./chunk-JDK3RCQU.js";
|
|
7
|
+
import "./chunk-KTGQO3AE.js";
|
|
8
|
+
import "./chunk-HWMSGXLQ.js";
|
|
9
|
+
import "./chunk-WRRUCCVZ.js";
|
|
10
|
+
import "./chunk-XZE2XP6O.js";
|
|
11
|
+
import "./chunk-UYTVTYNB.js";
|
|
12
|
+
export {
|
|
13
|
+
PullError,
|
|
14
|
+
numberTakenAdvice,
|
|
15
|
+
pull,
|
|
16
|
+
runPull
|
|
17
|
+
};
|
|
@@ -2,17 +2,23 @@ import {
|
|
|
2
2
|
login
|
|
3
3
|
} from "./chunk-64I7RLP3.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
5
|
+
numberTakenAdvice
|
|
6
|
+
} from "./chunk-JDK3RCQU.js";
|
|
7
|
+
import {
|
|
8
|
+
checkoutMismatch,
|
|
9
|
+
listStories
|
|
6
10
|
} from "./chunk-KTGQO3AE.js";
|
|
7
11
|
import {
|
|
8
12
|
checkoutConfig,
|
|
13
|
+
featureFiles,
|
|
14
|
+
findIntentDir,
|
|
9
15
|
readConfig,
|
|
10
16
|
readIntentFolder,
|
|
11
17
|
readSyncBase,
|
|
12
18
|
specOfPushStory,
|
|
13
19
|
writeConfig,
|
|
14
20
|
writeSyncBase
|
|
15
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-HWMSGXLQ.js";
|
|
16
22
|
import {
|
|
17
23
|
choose,
|
|
18
24
|
closePrompt,
|
|
@@ -36,12 +42,13 @@ var PUSH_ENDPOINTS = {
|
|
|
36
42
|
projectMaps: (projectId) => `/api/cli/projects/${encodeURIComponent(projectId)}/maps`
|
|
37
43
|
};
|
|
38
44
|
var PushApiError = class extends Error {
|
|
39
|
-
constructor(message, status, code = null, problems = [], projectId = null) {
|
|
45
|
+
constructor(message, status, code = null, problems = [], projectId = null, keys = []) {
|
|
40
46
|
super(message);
|
|
41
47
|
this.status = status;
|
|
42
48
|
this.code = code;
|
|
43
49
|
this.problems = problems;
|
|
44
50
|
this.projectId = projectId;
|
|
51
|
+
this.keys = keys;
|
|
45
52
|
this.name = "PushApiError";
|
|
46
53
|
}
|
|
47
54
|
};
|
|
@@ -56,7 +63,8 @@ async function call(fetcher, path, init, what) {
|
|
|
56
63
|
res.status,
|
|
57
64
|
typeof body.error === "string" ? body.error : null,
|
|
58
65
|
Array.isArray(body.problems) ? body.problems : [],
|
|
59
|
-
body.project_id ?? null
|
|
66
|
+
body.project_id ?? null,
|
|
67
|
+
Array.isArray(body.keys) ? body.keys.filter((k) => typeof k === "string") : []
|
|
60
68
|
);
|
|
61
69
|
}
|
|
62
70
|
return await res.json();
|
|
@@ -169,6 +177,13 @@ function openBrowser(url) {
|
|
|
169
177
|
const cmd = process.platform === "darwin" ? `open "${url}"` : process.platform === "win32" ? `start "" "${url}"` : `xdg-open "${url}"`;
|
|
170
178
|
exec(cmd);
|
|
171
179
|
}
|
|
180
|
+
async function numberTakenSteps(keys, localKeys, remoteKeys) {
|
|
181
|
+
const remote = await remoteKeys().catch(() => []);
|
|
182
|
+
return [
|
|
183
|
+
...numberTakenAdvice(keys, [...keys, ...localKeys, ...remote]).slice(1),
|
|
184
|
+
" Changes to stories intentdocs already had may have been saved; pushing again is safe."
|
|
185
|
+
];
|
|
186
|
+
}
|
|
172
187
|
async function push() {
|
|
173
188
|
const deps = {
|
|
174
189
|
cwd: process.cwd(),
|
|
@@ -201,6 +216,11 @@ async function push() {
|
|
|
201
216
|
if (err instanceof PushError) {
|
|
202
217
|
console.error(`\u2717 ${err.message}`);
|
|
203
218
|
for (const d of err.details) console.error(` - ${d}`);
|
|
219
|
+
} else if (err instanceof PushApiError && err.code === "NUMBER_TAKEN" && err.keys.length) {
|
|
220
|
+
console.error(`\u2717 ${err.message}`);
|
|
221
|
+
const config = readConfig();
|
|
222
|
+
const remote = async () => config?.mapId ? (await listStories(config)).stories.map((s) => s.key ?? "") : [];
|
|
223
|
+
for (const line of await numberTakenSteps(err.keys, featureFiles(findIntentDir(deps.cwd)).keys(), remote)) console.error(line);
|
|
204
224
|
} else if (err instanceof PushApiError) {
|
|
205
225
|
console.error(`\u2717 ${err.message}`);
|
|
206
226
|
for (const p of err.problems) console.error(` - ${p}`);
|
|
@@ -214,6 +234,7 @@ async function push() {
|
|
|
214
234
|
}
|
|
215
235
|
export {
|
|
216
236
|
PushError,
|
|
237
|
+
numberTakenSteps,
|
|
217
238
|
push,
|
|
218
239
|
pushNotes,
|
|
219
240
|
runPush
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
connectCheckout,
|
|
3
3
|
scope
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-7ONMS2RJ.js";
|
|
5
5
|
import "./chunk-KTGQO3AE.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-HWMSGXLQ.js";
|
|
7
7
|
import "./chunk-WRRUCCVZ.js";
|
|
8
8
|
import "./chunk-XZE2XP6O.js";
|
|
9
9
|
import "./chunk-UYTVTYNB.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
setup
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-2NSRHMTH.js";
|
|
4
4
|
import "./chunk-BNEU6TLJ.js";
|
|
5
5
|
import "./chunk-LQTPZL2Y.js";
|
|
6
6
|
import "./chunk-KPQ42YE6.js";
|
|
7
7
|
import "./chunk-KTGQO3AE.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-HWMSGXLQ.js";
|
|
9
9
|
import "./chunk-WRRUCCVZ.js";
|
|
10
10
|
import "./chunk-XZE2XP6O.js";
|
|
11
11
|
import "./chunk-UYTVTYNB.js";
|