@deftai/directive 0.87.0 → 0.88.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/dist/cli-router/route-argv.js +2 -0
- package/dist/dispatch.js +2 -0
- package/dist/policy.d.ts +1 -1
- package/dist/policy.js +53 -4
- package/package.json +5 -3
|
@@ -70,6 +70,8 @@ export const SUBCOMMAND_ROUTES = {
|
|
|
70
70
|
"cache:prune": ["cache", "prune"],
|
|
71
71
|
"cache:clear": ["cache", "clear"],
|
|
72
72
|
"policy:show": ["policy", "show"],
|
|
73
|
+
"policy:disable-directive": ["policy", "disable-directive"],
|
|
74
|
+
"policy:enable-directive": ["policy", "enable-directive"],
|
|
73
75
|
"policy:enforce-branches": ["policy", "enforce-branches"],
|
|
74
76
|
"policy:allow-direct-commits": ["policy", "allow-direct-commits"],
|
|
75
77
|
"policy:enable-value-feedback": ["policy", "enable-value-feedback"],
|
package/dist/dispatch.js
CHANGED
|
@@ -195,6 +195,8 @@ export const POLICY_ACTION_ALIAS_SUBCOMMANDS = {
|
|
|
195
195
|
"policy:allow-direct-commits": "allow-direct-commits",
|
|
196
196
|
"policy:enable-value-feedback": "enable-value-feedback",
|
|
197
197
|
"policy:clear-value-feedback": "clear-value-feedback",
|
|
198
|
+
"policy:disable-directive": "disable-directive",
|
|
199
|
+
"policy:enable-directive": "enable-directive",
|
|
198
200
|
};
|
|
199
201
|
const POLICY_ACTION_COLON_ALIASES = Object.fromEntries(Object.keys(POLICY_ACTION_ALIAS_SUBCOMMANDS).map((alias) => [alias, "policy"]));
|
|
200
202
|
/** Colon aliases for plan-sequence subcommands (#2402). */
|
package/dist/policy.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ interface ShowArgs {
|
|
|
7
7
|
error?: string;
|
|
8
8
|
}
|
|
9
9
|
interface SetArgs {
|
|
10
|
-
cmd: "show" | "enforce-branches" | "allow-direct-commits" | "enable-value-feedback" | "clear-value-feedback" | "resolve";
|
|
10
|
+
cmd: "show" | "enforce-branches" | "allow-direct-commits" | "enable-value-feedback" | "clear-value-feedback" | "disable-directive" | "enable-directive" | "resolve";
|
|
11
11
|
confirm: boolean;
|
|
12
12
|
actor: string;
|
|
13
13
|
note: string;
|
package/dist/policy.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { existsSync } from "node:fs";
|
|
7
7
|
import { resolve as pathResolve, relative } from "node:path";
|
|
8
8
|
import { fileURLToPath } from "node:url";
|
|
9
|
-
import { clearValueFeedback, describeShadowedPlanExtension, detectShadowedPlanExtensions, disclosureLine, enableValueFeedback, FIELD_VALUE_FEEDBACK, FIELD_VALUE_FEEDBACK_CLI_ALIAS, formatValueFeedbackStatusLine, inspectAllPolicies, inspectOnePolicy, loadProjectDefinition, policyColonInvocation, projectDefinitionPath, pythonListRepr, pythonStringRepr, registeredPolicyNames, renderJson, renderText, resolvePolicy, resolveValueFeedback, setPolicy, } from "@deftai/directive-core/policy";
|
|
9
|
+
import { clearValueFeedback, createNoDeftDirectiveFlag, describeShadowedPlanExtension, detectNoDeftDirective, detectShadowedPlanExtensions, disclosureLine, enableValueFeedback, FIELD_VALUE_FEEDBACK, FIELD_VALUE_FEEDBACK_CLI_ALIAS, formatValueFeedbackStatusLine, inspectAllPolicies, inspectOnePolicy, loadProjectDefinition, NO_DEFT_DIRECTIVE_DISABLED_MESSAGE, NO_DEFT_DIRECTIVE_FLAG_NAME, NO_DEFT_DIRECTIVE_INCONSISTENT_MESSAGE, policyColonInvocation, projectDefinitionPath, pythonListRepr, pythonStringRepr, registeredPolicyNames, removeNoDeftDirectiveFlag, renderJson, renderText, resolvePolicy, resolveValueFeedback, setPolicy, } from "@deftai/directive-core/policy";
|
|
10
10
|
const CAPABILITY_COST_DISCLOSURE = "\u26a0 Capability-cost disclosure -- enabling direct commits to the default " +
|
|
11
11
|
"branch turns OFF the deft branch-protection policy.\n" +
|
|
12
12
|
" \u2022 Pre-commit + pre-push hooks will no longer block default-branch " +
|
|
@@ -114,7 +114,7 @@ export function parseShowArgs(argv) {
|
|
|
114
114
|
/** Parse argv for the policy CLI (show + set subcommands). */
|
|
115
115
|
export function parseArgs(argv) {
|
|
116
116
|
if (argv.length === 0) {
|
|
117
|
-
const usage = "usage: policy [show|enforce-branches|allow-direct-commits|enable-value-feedback|clear-value-feedback|resolve] ...";
|
|
117
|
+
const usage = "usage: policy [show|enforce-branches|allow-direct-commits|enable-value-feedback|clear-value-feedback|disable-directive|enable-directive|resolve] ...";
|
|
118
118
|
return makeSetError(usage);
|
|
119
119
|
}
|
|
120
120
|
const cmd = argv[0];
|
|
@@ -149,7 +149,9 @@ export function parseArgs(argv) {
|
|
|
149
149
|
if (cmd === "enforce-branches" ||
|
|
150
150
|
cmd === "allow-direct-commits" ||
|
|
151
151
|
cmd === "enable-value-feedback" ||
|
|
152
|
-
cmd === "clear-value-feedback"
|
|
152
|
+
cmd === "clear-value-feedback" ||
|
|
153
|
+
cmd === "disable-directive" ||
|
|
154
|
+
cmd === "enable-directive") {
|
|
153
155
|
let confirm = false;
|
|
154
156
|
let actor = cmd === "enforce-branches"
|
|
155
157
|
? policyColonInvocation("enforce-branches")
|
|
@@ -157,7 +159,11 @@ export function parseArgs(argv) {
|
|
|
157
159
|
? policyColonInvocation("allow-direct-commits")
|
|
158
160
|
: cmd === "enable-value-feedback"
|
|
159
161
|
? policyColonInvocation("enable-value-feedback")
|
|
160
|
-
:
|
|
162
|
+
: cmd === "clear-value-feedback"
|
|
163
|
+
? policyColonInvocation("clear-value-feedback")
|
|
164
|
+
: cmd === "disable-directive"
|
|
165
|
+
? policyColonInvocation("disable-directive")
|
|
166
|
+
: policyColonInvocation("enable-directive");
|
|
161
167
|
let note = "";
|
|
162
168
|
let projectRoot = ".";
|
|
163
169
|
for (let i = 1; i < argv.length; i += 1) {
|
|
@@ -338,6 +344,43 @@ function runClearValueFeedback(args) {
|
|
|
338
344
|
process.stdout.write(result.stdout);
|
|
339
345
|
return result.exitCode;
|
|
340
346
|
}
|
|
347
|
+
/** Create root `.no-deft-directive` opt-out flag (#2926). Does not delete deposits. */
|
|
348
|
+
function runDisableDirective(args) {
|
|
349
|
+
const projectRoot = pathResolve(args.projectRoot);
|
|
350
|
+
const before = detectNoDeftDirective(projectRoot);
|
|
351
|
+
if (before.present) {
|
|
352
|
+
process.stdout.write(`${NO_DEFT_DIRECTIVE_DISABLED_MESSAGE} (already present)\n`);
|
|
353
|
+
if (before.inconsistent) {
|
|
354
|
+
process.stderr.write(`${NO_DEFT_DIRECTIVE_INCONSISTENT_MESSAGE}\n`);
|
|
355
|
+
return 1;
|
|
356
|
+
}
|
|
357
|
+
return 0;
|
|
358
|
+
}
|
|
359
|
+
const path = createNoDeftDirectiveFlag(projectRoot, {
|
|
360
|
+
rationale: args.note.trim().length > 0 ? args.note.trim() : undefined,
|
|
361
|
+
});
|
|
362
|
+
process.stdout.write(`Created ${NO_DEFT_DIRECTIVE_FLAG_NAME} at ${path}\n`);
|
|
363
|
+
process.stdout.write(`${NO_DEFT_DIRECTIVE_DISABLED_MESSAGE}\n`);
|
|
364
|
+
const after = detectNoDeftDirective(projectRoot);
|
|
365
|
+
if (after.inconsistent) {
|
|
366
|
+
process.stderr.write(`${NO_DEFT_DIRECTIVE_INCONSISTENT_MESSAGE}\n`);
|
|
367
|
+
return 1;
|
|
368
|
+
}
|
|
369
|
+
return 0;
|
|
370
|
+
}
|
|
371
|
+
/** Remove root `.no-deft-directive` so Directive may be installed/used again (#2926). */
|
|
372
|
+
function runEnableDirective(args) {
|
|
373
|
+
const projectRoot = pathResolve(args.projectRoot);
|
|
374
|
+
const removed = removeNoDeftDirectiveFlag(projectRoot);
|
|
375
|
+
if (removed) {
|
|
376
|
+
process.stdout.write(`Removed ${NO_DEFT_DIRECTIVE_FLAG_NAME}\n`);
|
|
377
|
+
}
|
|
378
|
+
else {
|
|
379
|
+
process.stdout.write(`${NO_DEFT_DIRECTIVE_FLAG_NAME} was not present\n`);
|
|
380
|
+
}
|
|
381
|
+
process.stdout.write("Directive opt-out cleared. Run `directive init` or `directive update` to ensure install.\n");
|
|
382
|
+
return 0;
|
|
383
|
+
}
|
|
341
384
|
/** Run the policy CLI; returns process exit code. */
|
|
342
385
|
export function run(argv) {
|
|
343
386
|
const args = parseArgs(argv);
|
|
@@ -365,6 +408,12 @@ export function run(argv) {
|
|
|
365
408
|
if (args.cmd === "clear-value-feedback") {
|
|
366
409
|
return runClearValueFeedback(args);
|
|
367
410
|
}
|
|
411
|
+
if (args.cmd === "disable-directive") {
|
|
412
|
+
return runDisableDirective(args);
|
|
413
|
+
}
|
|
414
|
+
if (args.cmd === "enable-directive") {
|
|
415
|
+
return runEnableDirective(args);
|
|
416
|
+
}
|
|
368
417
|
return 2;
|
|
369
418
|
}
|
|
370
419
|
if (process.argv[1] !== undefined && fileURLToPath(import.meta.url) === process.argv[1]) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deftai/directive",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.88.0",
|
|
4
4
|
"description": "Directive CLI — npm install path for the Deft Directive framework.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://deftai.github.io/directive/",
|
|
5
7
|
"type": "module",
|
|
6
8
|
"main": "./dist/index.js",
|
|
7
9
|
"types": "./dist/index.d.ts",
|
|
@@ -32,8 +34,8 @@
|
|
|
32
34
|
"provenance": true
|
|
33
35
|
},
|
|
34
36
|
"dependencies": {
|
|
35
|
-
"@deftai/directive-core": "^0.
|
|
36
|
-
"@deftai/directive-content": "^0.
|
|
37
|
+
"@deftai/directive-core": "^0.88.0",
|
|
38
|
+
"@deftai/directive-content": "^0.88.0"
|
|
37
39
|
},
|
|
38
40
|
"scripts": {
|
|
39
41
|
"build": "tsc -b"
|