@ncoderz/awa 1.8.0 → 1.8.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/dist/{chunk-WGGMDWBE.js → chunk-EL7ZWFXO.js} +152 -37
- package/dist/chunk-EL7ZWFXO.js.map +1 -0
- package/dist/index.js +76 -71
- package/dist/index.js.map +1 -1
- package/dist/{renumber-ZCI2H5HZ.js → renumber-TLBGOWZM.js} +2 -2
- package/package.json +1 -1
- package/templates/awa/_partials/awa.core.md +1 -0
- package/templates/awa/_partials/awa.usage.md +5 -2
- package/dist/chunk-WGGMDWBE.js.map +0 -1
- /package/dist/{renumber-ZCI2H5HZ.js.map → renumber-TLBGOWZM.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
import {
|
|
3
3
|
DEFAULT_CHECK_CONFIG,
|
|
4
4
|
collectFiles,
|
|
5
|
+
findSpecFiles,
|
|
6
|
+
hasAnySpecFile,
|
|
5
7
|
matchSimpleGlob,
|
|
6
8
|
parseSpecs,
|
|
7
9
|
propagate,
|
|
8
10
|
renumberCommand,
|
|
9
11
|
scan,
|
|
10
12
|
scanMarkers
|
|
11
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-EL7ZWFXO.js";
|
|
12
14
|
import {
|
|
13
15
|
ConfigError,
|
|
14
16
|
DiffError,
|
|
@@ -34,7 +36,7 @@ import { Command, Option } from "commander";
|
|
|
34
36
|
// src/_generated/package_info.ts
|
|
35
37
|
var PACKAGE_INFO = {
|
|
36
38
|
"name": "@ncoderz/awa",
|
|
37
|
-
"version": "1.8.
|
|
39
|
+
"version": "1.8.1",
|
|
38
40
|
"author": "Richard Sewell <richard.sewell@ncoderz.com>",
|
|
39
41
|
"license": "BSD-3-Clause",
|
|
40
42
|
"description": "awa is an Agent Workflow for AIs. It is also a CLI tool to powerfully manage agent workflow files using templates."
|
|
@@ -3569,9 +3571,6 @@ function validateMerge(sourceCode, targetCode) {
|
|
|
3569
3571
|
}
|
|
3570
3572
|
}
|
|
3571
3573
|
|
|
3572
|
-
// src/core/recode/map-builder.ts
|
|
3573
|
-
import { basename as basename6 } from "path";
|
|
3574
|
-
|
|
3575
3574
|
// src/core/recode/types.ts
|
|
3576
3575
|
var RecodeError = class extends Error {
|
|
3577
3576
|
errorCode;
|
|
@@ -3588,37 +3587,43 @@ function buildRecodeMap(sourceCode, targetCode, specs) {
|
|
|
3588
3587
|
throw new RecodeError("SOURCE_NOT_FOUND", `No spec files found for source code: ${sourceCode}`);
|
|
3589
3588
|
}
|
|
3590
3589
|
const entries = /* @__PURE__ */ new Map();
|
|
3591
|
-
const
|
|
3592
|
-
if (
|
|
3593
|
-
const
|
|
3594
|
-
const reqOffset =
|
|
3595
|
-
buildRequirementEntries(sourceCode, targetCode,
|
|
3590
|
+
const sourceReqs = findSpecFiles(specs.specFiles, sourceCode, "REQ");
|
|
3591
|
+
if (sourceReqs.length > 0) {
|
|
3592
|
+
const targetReqs = findSpecFiles(specs.specFiles, targetCode, "REQ");
|
|
3593
|
+
const reqOffset = findHighestReqNumber(targetReqs);
|
|
3594
|
+
buildRequirementEntries(sourceCode, targetCode, sourceReqs, reqOffset, entries);
|
|
3596
3595
|
}
|
|
3597
|
-
const
|
|
3598
|
-
const
|
|
3599
|
-
if (
|
|
3600
|
-
const propOffset =
|
|
3601
|
-
buildPropertyEntries(sourceCode, targetCode,
|
|
3596
|
+
const sourceDesigns = findSpecFiles(specs.specFiles, sourceCode, "DESIGN");
|
|
3597
|
+
const targetDesigns = findSpecFiles(specs.specFiles, targetCode, "DESIGN");
|
|
3598
|
+
if (sourceDesigns.length > 0) {
|
|
3599
|
+
const propOffset = findHighestPropertyNumber(targetDesigns);
|
|
3600
|
+
buildPropertyEntries(sourceCode, targetCode, sourceDesigns, propOffset, entries);
|
|
3602
3601
|
}
|
|
3603
|
-
if (
|
|
3604
|
-
buildComponentEntries(sourceCode, targetCode,
|
|
3602
|
+
if (sourceDesigns.length > 0) {
|
|
3603
|
+
buildComponentEntries(sourceCode, targetCode, sourceDesigns, entries);
|
|
3605
3604
|
}
|
|
3606
3605
|
const noChange = entries.size === 0;
|
|
3607
3606
|
const map = { code: sourceCode, entries };
|
|
3608
3607
|
return { map, noChange };
|
|
3609
3608
|
}
|
|
3610
|
-
function buildRequirementEntries(_sourceCode, targetCode,
|
|
3609
|
+
function buildRequirementEntries(_sourceCode, targetCode, sourceReqs, reqOffset, entries) {
|
|
3611
3610
|
const topLevelReqs = [];
|
|
3612
3611
|
const subReqsByParent = /* @__PURE__ */ new Map();
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3612
|
+
const allAcIds = [];
|
|
3613
|
+
for (const sourceReq of sourceReqs) {
|
|
3614
|
+
for (const id of sourceReq.requirementIds) {
|
|
3615
|
+
if (id.includes(".")) {
|
|
3616
|
+
const dotIdx = id.lastIndexOf(".");
|
|
3617
|
+
const parent = id.slice(0, dotIdx);
|
|
3618
|
+
const subs = subReqsByParent.get(parent) ?? [];
|
|
3619
|
+
subs.push(id);
|
|
3620
|
+
subReqsByParent.set(parent, subs);
|
|
3621
|
+
} else {
|
|
3622
|
+
topLevelReqs.push(id);
|
|
3623
|
+
}
|
|
3624
|
+
}
|
|
3625
|
+
for (const acId of sourceReq.acIds) {
|
|
3626
|
+
allAcIds.push(acId);
|
|
3622
3627
|
}
|
|
3623
3628
|
}
|
|
3624
3629
|
const reqNumberMap = /* @__PURE__ */ new Map();
|
|
@@ -3642,7 +3647,7 @@ function buildRequirementEntries(_sourceCode, targetCode, sourceReq, reqOffset,
|
|
|
3642
3647
|
}
|
|
3643
3648
|
}
|
|
3644
3649
|
const acsByParent = /* @__PURE__ */ new Map();
|
|
3645
|
-
for (const acId of
|
|
3650
|
+
for (const acId of allAcIds) {
|
|
3646
3651
|
const parent = acId.split("_AC-")[0];
|
|
3647
3652
|
const acs = acsByParent.get(parent) ?? [];
|
|
3648
3653
|
acs.push(acId);
|
|
@@ -3658,59 +3663,54 @@ function buildRequirementEntries(_sourceCode, targetCode, sourceReq, reqOffset,
|
|
|
3658
3663
|
}
|
|
3659
3664
|
}
|
|
3660
3665
|
}
|
|
3661
|
-
function buildPropertyEntries(_sourceCode, targetCode,
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
const
|
|
3665
|
-
|
|
3666
|
-
|
|
3666
|
+
function buildPropertyEntries(_sourceCode, targetCode, sourceDesigns, propOffset, entries) {
|
|
3667
|
+
let counter = 0;
|
|
3668
|
+
for (const sourceDesign of sourceDesigns) {
|
|
3669
|
+
for (const oldId of sourceDesign.propertyIds) {
|
|
3670
|
+
counter++;
|
|
3671
|
+
const newId = `${targetCode}_P-${propOffset + counter}`;
|
|
3672
|
+
entries.set(oldId, newId);
|
|
3673
|
+
}
|
|
3667
3674
|
}
|
|
3668
3675
|
}
|
|
3669
|
-
function buildComponentEntries(sourceCode, targetCode,
|
|
3670
|
-
for (const
|
|
3671
|
-
const
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3676
|
+
function buildComponentEntries(sourceCode, targetCode, sourceDesigns, entries) {
|
|
3677
|
+
for (const sourceDesign of sourceDesigns) {
|
|
3678
|
+
for (const compName of sourceDesign.componentNames) {
|
|
3679
|
+
const prefix = `${sourceCode}-`;
|
|
3680
|
+
if (compName.startsWith(prefix)) {
|
|
3681
|
+
const suffix = compName.slice(prefix.length);
|
|
3682
|
+
entries.set(compName, `${targetCode}-${suffix}`);
|
|
3683
|
+
}
|
|
3675
3684
|
}
|
|
3676
3685
|
}
|
|
3677
3686
|
}
|
|
3678
|
-
function findHighestReqNumber(
|
|
3687
|
+
function findHighestReqNumber(reqFiles) {
|
|
3679
3688
|
let max = 0;
|
|
3680
|
-
for (const
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3689
|
+
for (const reqFile of reqFiles) {
|
|
3690
|
+
for (const id of reqFile.requirementIds) {
|
|
3691
|
+
if (id.includes(".")) continue;
|
|
3692
|
+
const match = id.match(/-(\d+)$/);
|
|
3693
|
+
if (match) {
|
|
3694
|
+
const num = Number.parseInt(match[1], 10);
|
|
3695
|
+
if (num > max) max = num;
|
|
3696
|
+
}
|
|
3686
3697
|
}
|
|
3687
3698
|
}
|
|
3688
3699
|
return max;
|
|
3689
3700
|
}
|
|
3690
|
-
function findHighestPropertyNumber(
|
|
3701
|
+
function findHighestPropertyNumber(designFiles) {
|
|
3691
3702
|
let max = 0;
|
|
3692
|
-
for (const
|
|
3693
|
-
const
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3703
|
+
for (const designFile of designFiles) {
|
|
3704
|
+
for (const id of designFile.propertyIds) {
|
|
3705
|
+
const match = id.match(/_P-(\d+)$/);
|
|
3706
|
+
if (match) {
|
|
3707
|
+
const num = Number.parseInt(match[1], 10);
|
|
3708
|
+
if (num > max) max = num;
|
|
3709
|
+
}
|
|
3697
3710
|
}
|
|
3698
3711
|
}
|
|
3699
3712
|
return max;
|
|
3700
3713
|
}
|
|
3701
|
-
function findSpecFile(specFiles, code, prefix) {
|
|
3702
|
-
return specFiles.find((sf) => {
|
|
3703
|
-
const name = basename6(sf.filePath);
|
|
3704
|
-
return name.startsWith(`${prefix}-${code}-`);
|
|
3705
|
-
});
|
|
3706
|
-
}
|
|
3707
|
-
var SPEC_PREFIXES = ["FEAT", "REQ", "DESIGN", "EXAMPLE", "API", "TASK"];
|
|
3708
|
-
function hasAnySpecFile(specFiles, code) {
|
|
3709
|
-
return specFiles.some((sf) => {
|
|
3710
|
-
const name = basename6(sf.filePath);
|
|
3711
|
-
return SPEC_PREFIXES.some((prefix) => name.startsWith(`${prefix}-${code}-`));
|
|
3712
|
-
});
|
|
3713
|
-
}
|
|
3714
3714
|
|
|
3715
3715
|
// src/commands/merge.ts
|
|
3716
3716
|
async function mergeCommand(options) {
|
|
@@ -3764,7 +3764,7 @@ async function mergeCommand(options) {
|
|
|
3764
3764
|
return 2;
|
|
3765
3765
|
}
|
|
3766
3766
|
if (options.renumber && !dryRun && !noChange) {
|
|
3767
|
-
const { renumberCommand: renumberCommand2 } = await import("./renumber-
|
|
3767
|
+
const { renumberCommand: renumberCommand2 } = await import("./renumber-TLBGOWZM.js");
|
|
3768
3768
|
await renumberCommand2({
|
|
3769
3769
|
code: options.targetCode,
|
|
3770
3770
|
dryRun: false,
|
|
@@ -3948,7 +3948,7 @@ import { intro as intro4, outro as outro4 } from "@clack/prompts";
|
|
|
3948
3948
|
|
|
3949
3949
|
// src/core/template-test/fixture-loader.ts
|
|
3950
3950
|
import { readdir as readdir2 } from "fs/promises";
|
|
3951
|
-
import { basename as
|
|
3951
|
+
import { basename as basename6, extname as extname2, join as join10 } from "path";
|
|
3952
3952
|
import { parse } from "smol-toml";
|
|
3953
3953
|
async function discoverFixtures(templatePath) {
|
|
3954
3954
|
const testsDir = join10(templatePath, "_tests");
|
|
@@ -3970,7 +3970,7 @@ async function discoverFixtures(templatePath) {
|
|
|
3970
3970
|
async function parseFixture(filePath) {
|
|
3971
3971
|
const content = await readTextFile(filePath);
|
|
3972
3972
|
const parsed = parse(content);
|
|
3973
|
-
const name =
|
|
3973
|
+
const name = basename6(filePath, extname2(filePath));
|
|
3974
3974
|
const features = toStringArray2(parsed.features) ?? [];
|
|
3975
3975
|
const preset = toStringArray2(parsed.preset) ?? [];
|
|
3976
3976
|
const removeFeatures = toStringArray2(parsed["remove-features"]) ?? [];
|
|
@@ -5545,13 +5545,18 @@ function configureTraceCommand(cmd) {
|
|
|
5545
5545
|
}
|
|
5546
5546
|
configureTraceCommand(spec.command("trace"));
|
|
5547
5547
|
function configureRenumberCommand(cmd) {
|
|
5548
|
-
return cmd.description("Renumber traceability IDs to match document order").argument("[code]", "Feature code to renumber (e.g. CHK, TRC)").option("--all", "Renumber all feature codes", false).option("--dry-run", "Preview changes without modifying files", false).option("--json", "Output results as JSON", false).option(
|
|
5548
|
+
return cmd.description("Renumber traceability IDs to match document order").argument("[code]", "Feature code to renumber (e.g. CHK, TRC)").option("--all", "Renumber all feature codes", false).option("--dry-run", "Preview changes without modifying files", false).option("--json", "Output results as JSON", false).option(
|
|
5549
|
+
"--expand-unambiguous-ids",
|
|
5550
|
+
"Expand unambiguous malformed ID shorthand (slash ranges, dot-dot ranges) before renumbering",
|
|
5551
|
+
false
|
|
5552
|
+
).option("-c, --config <path>", "Path to configuration file").action(async (code, options) => {
|
|
5549
5553
|
const renumberOptions = {
|
|
5550
5554
|
code,
|
|
5551
5555
|
all: options.all,
|
|
5552
5556
|
dryRun: options.dryRun,
|
|
5553
5557
|
json: options.json,
|
|
5554
|
-
config: options.config
|
|
5558
|
+
config: options.config,
|
|
5559
|
+
expandUnambiguousIds: options.expandUnambiguousIds
|
|
5555
5560
|
};
|
|
5556
5561
|
const exitCode = await renumberCommand(renumberOptions);
|
|
5557
5562
|
process.exit(exitCode);
|