azcodr 2.2.0 → 2.4.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.
- package/.agents/scripts/agent_guard.js +63 -0
- package/.agents/skills/lets-build/SKILL.md +1 -1
- package/.github/workflows/ci.yml +21 -0
- package/.github/workflows/publish.yml +7 -0
- package/CODE_OF_CONDUCT.md +122 -0
- package/CONTRIBUTING.md +85 -0
- package/README.md +73 -3
- package/SECURITY.md +32 -0
- package/data/memory.template +36 -0
- package/docs/rules/clean_code.md +13 -0
- package/docs/tipping-points.md +37 -0
- package/lib/agent-guard-command.d.ts +28 -0
- package/lib/agent-guard-command.d.ts.map +1 -0
- package/lib/agent-guard-command.js +103 -0
- package/lib/agent-guard-command.js.map +1 -0
- package/lib/agent-guard-file.d.ts +32 -0
- package/lib/agent-guard-file.d.ts.map +1 -0
- package/lib/agent-guard-file.js +77 -0
- package/lib/agent-guard-file.js.map +1 -0
- package/lib/agent-guard-tdd.d.ts +34 -0
- package/lib/agent-guard-tdd.d.ts.map +1 -0
- package/lib/agent-guard-tdd.js +77 -0
- package/lib/agent-guard-tdd.js.map +1 -0
- package/lib/agent-guard.d.ts +38 -0
- package/lib/agent-guard.d.ts.map +1 -0
- package/lib/agent-guard.js +80 -0
- package/lib/agent-guard.js.map +1 -0
- package/lib/boundaries.d.ts +41 -0
- package/lib/boundaries.d.ts.map +1 -0
- package/lib/boundaries.js +158 -0
- package/lib/boundaries.js.map +1 -0
- package/lib/cli-boundaries.d.ts +18 -0
- package/lib/cli-boundaries.d.ts.map +1 -0
- package/lib/cli-boundaries.js +46 -0
- package/lib/cli-boundaries.js.map +1 -0
- package/lib/cli-parse.d.ts +5 -0
- package/lib/cli-parse.d.ts.map +1 -1
- package/lib/cli-parse.js +35 -5
- package/lib/cli-parse.js.map +1 -1
- package/lib/cli.d.ts +17 -0
- package/lib/cli.d.ts.map +1 -1
- package/lib/cli.js +47 -5
- package/lib/cli.js.map +1 -1
- package/lib/guards.d.ts +6 -0
- package/lib/guards.d.ts.map +1 -1
- package/lib/guards.js +10 -1
- package/lib/guards.js.map +1 -1
- package/lib/index.d.ts +15 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +12 -0
- package/lib/index.js.map +1 -1
- package/lib/repo.js +4 -4
- package/lib/repo.js.map +1 -1
- package/lib/scaffold.d.ts +2 -7
- package/lib/scaffold.d.ts.map +1 -1
- package/lib/scaffold.js +7 -10
- package/lib/scaffold.js.map +1 -1
- package/lib/validate.d.ts +33 -0
- package/lib/validate.d.ts.map +1 -0
- package/lib/validate.js +24 -0
- package/lib/validate.js.map +1 -0
- package/memory.md +24 -0
- package/package.json +10 -2
- package/scripts/validate/links.js +0 -1
- package/scripts/validate/root.js +1 -1
- package/src/agent-guard-command.ts +118 -0
- package/src/agent-guard-file.ts +107 -0
- package/src/agent-guard-tdd.ts +96 -0
- package/src/agent-guard.ts +123 -0
- package/src/boundaries.ts +198 -0
- package/src/cli-boundaries.ts +67 -0
- package/src/cli-parse.ts +40 -4
- package/src/cli.ts +57 -15
- package/src/guards.ts +11 -1
- package/src/index.ts +40 -0
- package/src/repo.ts +4 -4
- package/src/scaffold.ts +7 -10
- package/src/validate.ts +47 -0
package/src/scaffold.ts
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import process from 'node:process';
|
|
4
|
-
import { fileURLToPath } from 'node:url';
|
|
5
4
|
import { ScaffoldError, ERROR_CODES } from './errors.js';
|
|
6
5
|
import type { ScaffoldErrorCode, ScaffoldErrorShape } from './errors.js';
|
|
7
6
|
import { runGit } from './git.js';
|
|
8
|
-
import { assertInside, isProtectedTarget } from './guards.js';
|
|
7
|
+
import { assertInside, isProtectedTarget, getTemplateDir } from './guards.js';
|
|
9
8
|
import { ensureSymlink, ensureSymlinkOrPointer, isSameCaseInsensitiveFile } from './links.js';
|
|
10
9
|
import type { EnsureSymlinkOptions } from './links.js';
|
|
11
10
|
import { makeScriptsExecutable } from './permissions.js';
|
|
12
11
|
import { isInsideGitWorkTree, initGit } from './repo.js';
|
|
13
12
|
import type { InitGitOptions } from './repo.js';
|
|
14
13
|
|
|
14
|
+
export { getTemplateDir };
|
|
15
|
+
|
|
15
16
|
/**
|
|
16
17
|
* Canonical list of template files and directories copied into a new workspace.
|
|
17
18
|
*/
|
|
@@ -68,14 +69,6 @@ export interface CopyTemplateOptions {
|
|
|
68
69
|
dryRun?: boolean;
|
|
69
70
|
}
|
|
70
71
|
|
|
71
|
-
/**
|
|
72
|
-
* Resolves the root filesystem directory of the azcodr template files.
|
|
73
|
-
*
|
|
74
|
-
* @returns Absolute filesystem path to the template root directory.
|
|
75
|
-
*/
|
|
76
|
-
export function getTemplateDir(): string {
|
|
77
|
-
return path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
78
|
-
}
|
|
79
72
|
|
|
80
73
|
function rejectTemplateSelf(resolvedTarget: string, resolvedTemplate: string): void {
|
|
81
74
|
if (resolvedTarget !== resolvedTemplate) return;
|
|
@@ -130,6 +123,10 @@ export function validateTarget(targetDir: string, options: ValidateTargetOptions
|
|
|
130
123
|
}
|
|
131
124
|
|
|
132
125
|
function resolveTemplateItem(resolvedTemplate: string, item: string): string {
|
|
126
|
+
if (item === 'memory.md') {
|
|
127
|
+
const memTpl = path.join(resolvedTemplate, 'data', 'memory.template');
|
|
128
|
+
if (fs.existsSync(memTpl)) return memTpl;
|
|
129
|
+
}
|
|
133
130
|
let srcPath = path.join(resolvedTemplate, item);
|
|
134
131
|
if (item === '.gitignore' && !fs.existsSync(srcPath)) {
|
|
135
132
|
const npmIgnorePath = path.join(resolvedTemplate, '.npmignore');
|
package/src/validate.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
3
|
+
|
|
4
|
+
export interface ValidationResult {
|
|
5
|
+
errors: number;
|
|
6
|
+
warnings: number;
|
|
7
|
+
validatedRules: number;
|
|
8
|
+
validatedSkills: number;
|
|
9
|
+
totalLinks: number;
|
|
10
|
+
brokenLinks: string[];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface ValidationReporter {
|
|
14
|
+
pass: (msg: string) => void;
|
|
15
|
+
warn: (msg: string) => void;
|
|
16
|
+
fail: (msg: string) => void;
|
|
17
|
+
log: (msg: string) => void;
|
|
18
|
+
heading: (msg: string) => void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Validates the agentic architecture and governance files of a workspace.
|
|
23
|
+
*
|
|
24
|
+
* @param workspaceRoot - Path to the workspace directory (defaults to cwd).
|
|
25
|
+
* @param reporter - Optional custom reporter hooks.
|
|
26
|
+
* @returns Object containing error and warning tallies and validation counts.
|
|
27
|
+
*/
|
|
28
|
+
export async function validate(
|
|
29
|
+
workspaceRoot: string = process.cwd(),
|
|
30
|
+
reporter?: ValidationReporter
|
|
31
|
+
): Promise<ValidationResult> {
|
|
32
|
+
const baseDir = import.meta.dirname ?? path.dirname(fileURLToPath(import.meta.url));
|
|
33
|
+
const scriptPath = path.resolve(baseDir, '../scripts/validate.js');
|
|
34
|
+
const mod = await import(pathToFileURL(scriptPath).href);
|
|
35
|
+
return mod.runValidation(path.resolve(workspaceRoot), reporter);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const noop = (): void => {};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Creates a silent reporter that suppresses all status reports.
|
|
42
|
+
*/
|
|
43
|
+
export function createSilentReporter(): ValidationReporter {
|
|
44
|
+
return { pass: noop, warn: noop, fail: noop, log: noop, heading: noop };
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export default { validate, createSilentReporter };
|