azcodr 2.6.0 → 2.7.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/.agents/hooks.json +3 -3
- package/.agents/hooks.json.example +4 -4
- package/.agents/lib/agent-guard-command.js +6 -0
- package/.agents/lib/agent-guard-file.js +15 -0
- package/.agents/lib/agent-guard-tdd.js +30 -0
- package/.agents/lib/boundaries.js +35 -0
- package/.agents/scripts/desktop_doctor.js +108 -0
- package/.agents/scripts/safety_guard.js +82 -0
- package/.agents/scripts/smoke_test.js +78 -0
- package/.agents/scripts/verify_completion.js +76 -0
- package/.agents/skills/lets-build/scripts/bootstrap_workspace.sh +6 -0
- package/.gitignore +1 -0
- package/lib/agent-guard-command.d.ts +17 -0
- package/lib/agent-guard-command.d.ts.map +1 -1
- package/lib/agent-guard-command.js +6 -0
- package/lib/agent-guard-command.js.map +1 -1
- package/lib/agent-guard-file.d.ts +31 -0
- package/lib/agent-guard-file.d.ts.map +1 -1
- package/lib/agent-guard-file.js +15 -0
- package/lib/agent-guard-file.js.map +1 -1
- package/lib/agent-guard-tdd.d.ts +42 -0
- package/lib/agent-guard-tdd.d.ts.map +1 -1
- package/lib/agent-guard-tdd.js +30 -0
- package/lib/agent-guard-tdd.js.map +1 -1
- package/lib/agent-guard.d.ts +17 -0
- package/lib/agent-guard.d.ts.map +1 -1
- package/lib/agent-guard.js.map +1 -1
- package/lib/boundaries.d.ts +54 -0
- package/lib/boundaries.d.ts.map +1 -1
- package/lib/boundaries.js +35 -0
- package/lib/boundaries.js.map +1 -1
- package/lib/errors.d.ts +16 -0
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +8 -0
- package/lib/errors.js.map +1 -1
- package/lib/guards.d.ts +4 -0
- package/lib/guards.d.ts.map +1 -1
- package/lib/guards.js.map +1 -1
- package/lib/links.d.ts +4 -0
- package/lib/links.d.ts.map +1 -1
- package/lib/links.js.map +1 -1
- package/lib/repo.d.ts +2 -0
- package/lib/repo.d.ts.map +1 -1
- package/lib/repo.js.map +1 -1
- package/lib/scaffold.d.ts +19 -0
- package/lib/scaffold.d.ts.map +1 -1
- package/lib/scaffold.js +4 -0
- package/lib/scaffold.js.map +1 -1
- package/lib/validate.d.ts +17 -0
- package/lib/validate.d.ts.map +1 -1
- package/lib/validate.js.map +1 -1
- package/memory.md +8 -0
- package/package.json +1 -1
- package/src/agent-guard-command.ts +17 -0
- package/src/agent-guard-file.ts +31 -0
- package/src/agent-guard-tdd.ts +42 -0
- package/src/agent-guard.ts +17 -0
- package/src/boundaries.ts +54 -0
- package/src/errors.ts +10 -0
- package/src/guards.ts +4 -0
- package/src/links.ts +4 -0
- package/src/repo.ts +2 -0
- package/src/scaffold.ts +22 -7
- package/src/validate.ts +17 -0
package/src/errors.ts
CHANGED
|
@@ -7,11 +7,17 @@
|
|
|
7
7
|
* tests/error-codes.test.js.
|
|
8
8
|
*/
|
|
9
9
|
export const ERROR_CODES = {
|
|
10
|
+
/** Target directory matches template repository root itself. */
|
|
10
11
|
E_TARGET_IS_TEMPLATE: 'Cannot scaffold into the azcodr template directory itself',
|
|
12
|
+
/** Target directory exists and already contains non-empty files without --force. */
|
|
11
13
|
E_TARGET_NOT_EMPTY: 'Target directory is not empty',
|
|
14
|
+
/** Target path matches protected system, home, or root directory. */
|
|
12
15
|
E_TARGET_IS_PROTECTED: 'Refusing to scaffold into a protected system directory',
|
|
16
|
+
/** runGit invoked with empty or missing argument array. */
|
|
13
17
|
E_GIT_ARGS_INVALID: 'runGit requires a non-empty argv array',
|
|
18
|
+
/** Attempted git subcommand not in the explicit allowlist. */
|
|
14
19
|
E_GIT_BLOCKED: 'Blocked git subcommand',
|
|
20
|
+
/** Relative path navigation escapes allowed root directory. */
|
|
15
21
|
E_PATH_ESCAPE: 'Path escapes allowed root'
|
|
16
22
|
} as const;
|
|
17
23
|
|
|
@@ -24,7 +30,9 @@ export type ScaffoldErrorCode = keyof typeof ERROR_CODES;
|
|
|
24
30
|
* Structural interface contract for errors thrown by the scaffolder.
|
|
25
31
|
*/
|
|
26
32
|
export interface ScaffoldErrorShape extends Error {
|
|
33
|
+
/** Error class discriminator name. */
|
|
27
34
|
name: 'ScaffoldError';
|
|
35
|
+
/** Machine-readable error code. */
|
|
28
36
|
code: ScaffoldErrorCode;
|
|
29
37
|
}
|
|
30
38
|
|
|
@@ -32,7 +40,9 @@ export interface ScaffoldErrorShape extends Error {
|
|
|
32
40
|
* Custom error class thrown by scaffolding operations, carrying a machine-readable code.
|
|
33
41
|
*/
|
|
34
42
|
export class ScaffoldError extends Error implements ScaffoldErrorShape {
|
|
43
|
+
/** Error class name identifier. */
|
|
35
44
|
override readonly name: 'ScaffoldError' = 'ScaffoldError';
|
|
45
|
+
/** Machine-readable error code identifying failure cause. */
|
|
36
46
|
readonly code: ScaffoldErrorCode;
|
|
37
47
|
|
|
38
48
|
/**
|
package/src/guards.ts
CHANGED
|
@@ -19,9 +19,13 @@ export function getTemplateDir(): string {
|
|
|
19
19
|
* Options for configuring protected target verification.
|
|
20
20
|
*/
|
|
21
21
|
export interface ProtectedTargetOptions {
|
|
22
|
+
/** Optional custom template directory path. */
|
|
22
23
|
templateDir?: string;
|
|
24
|
+
/** Force overwrite flag. */
|
|
23
25
|
force?: boolean;
|
|
26
|
+
/** Dry-run execution simulation flag. */
|
|
24
27
|
dryRun?: boolean;
|
|
28
|
+
/** Allow targeting protected directories (internal testing only). */
|
|
25
29
|
allowProtected?: boolean;
|
|
26
30
|
}
|
|
27
31
|
|
package/src/links.ts
CHANGED
|
@@ -5,9 +5,13 @@ import path from 'node:path';
|
|
|
5
5
|
* Configuration options for symlink and pointer creation.
|
|
6
6
|
*/
|
|
7
7
|
export interface EnsureSymlinkOptions {
|
|
8
|
+
/** Target directory containing the files and proposed link. */
|
|
8
9
|
targetDir: string;
|
|
10
|
+
/** Name of the symbolic link or alias pointer file to create. */
|
|
9
11
|
linkName: string;
|
|
12
|
+
/** Name of the target file that the symlink or pointer points to. */
|
|
10
13
|
targetFileName: string;
|
|
14
|
+
/** When true, simulate link creation without disk mutations. */
|
|
11
15
|
dryRun?: boolean;
|
|
12
16
|
}
|
|
13
17
|
|
package/src/repo.ts
CHANGED
|
@@ -9,7 +9,9 @@ const INITIAL_COMMIT_MESSAGE = 'chore: initial scaffold from azcodr template';
|
|
|
9
9
|
* Options controlling git repository initialization.
|
|
10
10
|
*/
|
|
11
11
|
export interface InitGitOptions {
|
|
12
|
+
/** If true, skip git repository initialization entirely. */
|
|
12
13
|
noGit?: boolean;
|
|
14
|
+
/** If true, simulate git repository initialization without invoking git. */
|
|
13
15
|
dryRun?: boolean;
|
|
14
16
|
}
|
|
15
17
|
|
package/src/scaffold.ts
CHANGED
|
@@ -34,11 +34,17 @@ export const TEMPLATE_ITEMS: readonly string[] = [
|
|
|
34
34
|
* Configuration options for the primary scaffold orchestration function.
|
|
35
35
|
*/
|
|
36
36
|
export interface ScaffoldOptions {
|
|
37
|
+
/** Target directory path where project will be scaffolded (defaults to process.cwd()). */
|
|
37
38
|
targetDir?: string;
|
|
39
|
+
/** Force overwrite if target directory exists and is non-empty. */
|
|
38
40
|
force?: boolean;
|
|
41
|
+
/** Skip git repository initialization. */
|
|
39
42
|
noGit?: boolean;
|
|
43
|
+
/** Optional custom template directory path. */
|
|
40
44
|
templateDir?: string;
|
|
45
|
+
/** Simulate scaffolding without writing files to disk. */
|
|
41
46
|
dryRun?: boolean;
|
|
47
|
+
/** Suppress non-error console output. */
|
|
42
48
|
silent?: boolean;
|
|
43
49
|
}
|
|
44
50
|
|
|
@@ -46,10 +52,15 @@ export interface ScaffoldOptions {
|
|
|
46
52
|
* Result object returned upon completion of a scaffold operation.
|
|
47
53
|
*/
|
|
48
54
|
export interface ScaffoldResult {
|
|
55
|
+
/** Whether the scaffolding operation completed successfully. */
|
|
49
56
|
success: boolean;
|
|
57
|
+
/** Absolute filesystem path of the scaffolded target directory. */
|
|
50
58
|
targetDir: string;
|
|
59
|
+
/** Whether a git repository was initialized and committed. */
|
|
51
60
|
gitInitialized: boolean;
|
|
61
|
+
/** Whether execution was a dry-run simulation without disk mutations. */
|
|
52
62
|
dryRun: boolean;
|
|
63
|
+
/** List of recorded scaffolding action descriptions taken. */
|
|
53
64
|
actions: string[];
|
|
54
65
|
}
|
|
55
66
|
|
|
@@ -57,9 +68,13 @@ export interface ScaffoldResult {
|
|
|
57
68
|
* Options controlling pre-scaffold target directory validation.
|
|
58
69
|
*/
|
|
59
70
|
export interface ValidateTargetOptions {
|
|
71
|
+
/** Custom template root directory path. */
|
|
60
72
|
templateDir?: string;
|
|
73
|
+
/** Allow non-empty directory when force is true. */
|
|
61
74
|
force?: boolean;
|
|
75
|
+
/** Simulate validation checks without erroring on non-empty targets. */
|
|
62
76
|
dryRun?: boolean;
|
|
77
|
+
/** Allow targeting protected directories (internal testing only). */
|
|
63
78
|
allowProtected?: boolean;
|
|
64
79
|
}
|
|
65
80
|
|
|
@@ -67,10 +82,10 @@ export interface ValidateTargetOptions {
|
|
|
67
82
|
* Options controlling template file copying and file generation.
|
|
68
83
|
*/
|
|
69
84
|
export interface CopyTemplateOptions {
|
|
85
|
+
/** Simulate copying without disk mutations. */
|
|
70
86
|
dryRun?: boolean;
|
|
71
87
|
}
|
|
72
88
|
|
|
73
|
-
|
|
74
89
|
function rejectTemplateSelf(resolvedTarget: string, resolvedTemplate: string): void {
|
|
75
90
|
if (resolvedTarget !== resolvedTemplate) return;
|
|
76
91
|
throw new ScaffoldError(
|
|
@@ -191,6 +206,7 @@ function starterPackageJson(resolvedTarget: string): Record<string, unknown> {
|
|
|
191
206
|
'test:coverage': 'jest --coverage',
|
|
192
207
|
lint: 'echo "No linter configured yet. Run /lets-build to configure toolchain."',
|
|
193
208
|
boundaries: 'node .agents/scripts/boundary_guard.js',
|
|
209
|
+
smoke: 'node .agents/scripts/smoke_test.js',
|
|
194
210
|
validate: 'node scripts/validate-cli.js'
|
|
195
211
|
}
|
|
196
212
|
};
|
|
@@ -252,11 +268,8 @@ export function copyTemplate(
|
|
|
252
268
|
*/
|
|
253
269
|
export function scaffold(options: ScaffoldOptions = {}): ScaffoldResult {
|
|
254
270
|
const {
|
|
255
|
-
targetDir = process.cwd(),
|
|
256
|
-
|
|
257
|
-
noGit = false,
|
|
258
|
-
templateDir = getTemplateDir(),
|
|
259
|
-
dryRun = false
|
|
271
|
+
targetDir = process.cwd(), force = false,
|
|
272
|
+
noGit = false, templateDir = getTemplateDir(), dryRun = false
|
|
260
273
|
} = options;
|
|
261
274
|
const resolvedTarget = path.resolve(targetDir);
|
|
262
275
|
validateTarget(resolvedTarget, { templateDir, force, dryRun });
|
|
@@ -271,9 +284,11 @@ export {
|
|
|
271
284
|
makeScriptsExecutable, isInsideGitWorkTree, initGit, runGit,
|
|
272
285
|
assertInside, ScaffoldError, ERROR_CODES, isProtectedTarget
|
|
273
286
|
};
|
|
274
|
-
|
|
275
287
|
export type { EnsureSymlinkOptions, InitGitOptions, ScaffoldErrorCode, ScaffoldErrorShape };
|
|
276
288
|
|
|
289
|
+
/**
|
|
290
|
+
* Unified azcodr scaffolding functions, guards, utilities, and constants module.
|
|
291
|
+
*/
|
|
277
292
|
export default {
|
|
278
293
|
scaffold, validateTarget, copyTemplate, ensureSymlink,
|
|
279
294
|
ensureSymlinkOrPointer, isSameCaseInsensitiveFile, makeScriptsExecutable,
|
package/src/validate.ts
CHANGED
|
@@ -1,20 +1,37 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Tally and results returned by the architecture governance validator.
|
|
6
|
+
*/
|
|
4
7
|
export interface ValidationResult {
|
|
8
|
+
/** Total count of fatal governance errors encountered. */
|
|
5
9
|
errors: number;
|
|
10
|
+
/** Total count of non-fatal governance warnings encountered. */
|
|
6
11
|
warnings: number;
|
|
12
|
+
/** Number of progressive disclosure domain rule files verified. */
|
|
7
13
|
validatedRules: number;
|
|
14
|
+
/** Number of agent skills verified under .agents/skills/. */
|
|
8
15
|
validatedSkills: number;
|
|
16
|
+
/** Total count of internal markdown links verified. */
|
|
9
17
|
totalLinks: number;
|
|
18
|
+
/** List of broken link targets detected across workspace markdown files. */
|
|
10
19
|
brokenLinks: string[];
|
|
11
20
|
}
|
|
12
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Pluggable reporter interface receiving live validation events.
|
|
24
|
+
*/
|
|
13
25
|
export interface ValidationReporter {
|
|
26
|
+
/** Called when a check passes. */
|
|
14
27
|
pass: (msg: string) => void;
|
|
28
|
+
/** Called when a non-fatal warning is raised. */
|
|
15
29
|
warn: (msg: string) => void;
|
|
30
|
+
/** Called when a validation check fails. */
|
|
16
31
|
fail: (msg: string) => void;
|
|
32
|
+
/** Called for informative messages and section spacing. */
|
|
17
33
|
log: (msg: string) => void;
|
|
34
|
+
/** Called when a new validation phase begins. */
|
|
18
35
|
heading: (msg: string) => void;
|
|
19
36
|
}
|
|
20
37
|
|